The Fee Filter Logic: How `FEEFILTER` saves bandwidth
15. The Fee Filter Logic: How FEEFILTER saves bandwidth
Not all transactions are "Welcome" in every node. If a transaction pays a fee of only 1 satoshi per byte, and your node's minimum "Mempool Fee" is 5 satoshis per byte, that transaction will be rejected. Why should your peer even waste the bandwidth telling you about it? To solve this, Bitcoin Core uses the FEEFILTER message.
For the Sovereign Architect, Fee Filtering is the "Economic Shield." It is the way your node tells the world: "Don't bother me with 'Cheap' gossip."
Analyzing the Shield: FEEFILTER
In the source code, we see how the node calculates its "Minimum Fee" and tells its peers.
/**
* PEDAGOGICAL ANALYSIS: THE ECONOMIC SCREENER
* This logic tells our peers exactly what "Price" a transaction
* must pay for us to even look at it.
*/
void PeerManagerImpl::SendFeeFilter(CNode& pfrom)
{
// 1. Look at our own Mempool's "Minimum Fee".
CAmount nMinFee = m_mempool.GetMinFee(MAX_MEMPOOL_SIZE);
// 2. Send a "FEEFILTER" message to the peer.
pfrom.PushMessage(NetMsgType::FEEFILTER, nMinFee);
}
Explaining the Shield: The Efficiency of the Market
-
GetMinFee: If your mempool is full of transactions, it will naturally start "Raising the Price." It says: "I only have room for the best transactions." TheFEEFILTERlogic takes this internal price and "Exports" it to the network. It is the Economy of the Sovereign. -
"The Bandwidth Savings": During "Fee Spikes," thousands of low-fee transactions are broadcast to the network. Without a fee filter, your node would download them all, check them, and then throw them away. With the filter, your peers won't even send the
inv(the postcard) for those transactions. It is the Frugality of the Machine. -
"The Dynamic Nature": As the mempool empties out, the node sends a new
FEEFILTERwith a lower price. This ensures you are always "Open for Business" at the current market rate. It is the Flexibility of the Protocol. -
"The Privacy Benefit": By telling your peers your fee requirements, you are also making it harder for "Spies" to guess your mempool state, because they can't "Test" your node with random transactions as easily. It is the Defense of the Sovereign.
The Sovereignty of the Shield
Fee Filtering is the "Intelligent Gate" that protects your node from "Information Overload." As a Sovereign Architect, you know that "Not all information is valuable." By setting an economic threshold for the gossip you receive, you are ensuring your node's "Digital Energy" is only spent on transactions that have a real chance of becoming history. You are the "Master of the Shield."
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: