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.)
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.