<blockquote>
<p>What is the difference between these two variables? and which is for what use cases?</p>
</blockquote>
<p><code>rollingMinimumFeeRate</code> is the minimum feerate for a transaction to be added to the mempool and be further relayed. This is a dynamic value - it changes as the mempool fills up and empties.</p>
<p><code>minRelayTxFee</code> is the absolute minimum feerate. It is a static value. <code>rollingMinimumFeeRate</code> starts with the value of <code>minRelayTxFee</code> and it increases when the mempool becomes full. As the mempool empties and <code>rollingMinimumFeeRate</code> decreases, it will not decrease to be less than
<code>minRelayTxFee</code>. (This is effectively what happens, not actually what the code does.)</p>
<blockquote>
<p>Why the <code>rollingMinimumFeeRate</code> decreases exponentially?</p>
</blockquote>
<p><code>rollingMinimumFeeRate</code> increases when the mempool fills up. Transactions that have a feerate less than this value are evicted from the mempool. It is increased in order to maintain a maximum mempool size - if the mempool is larger than the maximum, the lowest feerate transactions are evicted until the maximum size is reached, and <code>rollingMinimumFeeRate</code> is set to the highest feerate transaction that was evicted.</p>
<p>As transactions are removed from the mempool by blocks, there needs to be a way to decrease <code>rollingMinimumFeeRate</code> to allow lower feerate transactions back in. However because it does not have those transactions anymore, it does not know what value to set it to. So it walks backwards, exponentially, until it either reaches 0, or is increased again, then the exponential decreasing is reset.</p>

CC BY-SA 4.0
2022-07-10T21:27:11.627Z
2022-07-10T21:27:11.627Z
Ava Chow
<p><code>CTxMemPool</code> has a member named <code>rollingMinimumFeeRate</code>:</p>
<pre><code>    mutable double rollingMinimumFeeRate GUARDED_BY(cs); //!&lt; minimum fee to get into the pool, decreases exponentially
</code></pre>
<p>The comment explains that it is the minimum fee to get into the pool. But we have another variable in the code base called <code>minRelayTxFee</code>:</p>
<pre><code>CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
</code></pre>
<pre><code>/** Default for -minrelaytxfee, minimum relay fee for transactions */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
</code></pre>
<p>Two questions:</p>
<ol>
<li><p>What is the difference between these two variables? and which is for what use cases?</p>
</li>
<li><p>Why the <code>rollingMinimumFeeRate</code> decreases exponentially?</p>
</li>
</ol>

<transaction-fees><bitcoin-core-development>
What is the difference between minRelayTxFee and rollingMinimumFeeRate?
Amir reza Riahi
# What is the difference between minRelayTxFee and rollingMinimumFeeRate?

(Asked by: username_0 on 2022-07-10)

`CTxMemPool` has a member named `rollingMinimumFeeRate`:

```
    mutable double rollingMinimumFeeRate GUARDED_BY(cs); //!< minimum fee to get into the pool, decreases exponentially

```

The comment explains that it is the minimum fee to get into the pool. But we have another variable in the code base called `minRelayTxFee`:

```
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);

```

```
/** Default for -minrelaytxfee, minimum relay fee for transactions */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;

```

Two questions:

1. What is the difference between these two variables? and which is for what use cases?
2. Why the `rollingMinimumFeeRate` decreases exponentially?

**Tags:** transaction-fees, bitcoin-core-development


---

## 1 answers

### Answer by username_1 on 2022-07-10. Score: 3 | Accepted answer

> What is the difference between these two variables? and which is for what use cases?

`rollingMinimumFeeRate` is the minimum feerate for a transaction to be added to the mempool and be further relayed. This is a dynamic value - it changes as the mempool fills up and empties.

`minRelayTxFee` is the absolute minimum feerate. It is a static value. `rollingMinimumFeeRate` starts with the value of `minRelayTxFee` and it increases when the mempool becomes full. As the mempool empties and `rollingMinimumFeeRate` decreases, it will not decrease to be less than
`minRelayTxFee`. (This is effectively what happens, not actually what the code does.)

> Why the `rollingMinimumFeeRate` decreases exponentially?

`rollingMinimumFeeRate` increases when the mempool fills up. Transactions that have a feerate less than this value are evicted from the mempool. It is increased in order to maintain a maximum mempool size - if the mempool is larger than the maximum, the lowest feerate transactions are evicted until the maximum size is reached, and `rollingMinimumFeeRate` is set to the highest feerate transaction that was evicted.

As transactions are removed from the mempool by blocks, there needs to be a way to decrease `rollingMinimumFeeRate` to allow lower feerate transactions back in. However because it does not have those transactions anymore, it does not know what value to set it to. So it walks backwards, exponentially, until it either reaches 0, or is increased again, then the exponential decreasing is reset.


---

