My understanding is that we model “how many blocks does it take for a tx at this fee rate to be confirmed”, and we count from when a tx entered the mempool until it was confirmed in a block. But if we have a CPFP where tx C pays for tx P, we might initially have a chunk [P] in the mempool at 50sat/vb, then later a chunk [P,C] in the mempool at 90sat/vb. If [P,C] then confirms, presumably we count how many blocks since we say P. But what if C gets RBF’ed by some unrelated tx D, and then P eventually confirms on its own at 50sat/vb? Do we bump the count back up to however long P has been sitting in the mempool?
I think maybe you could do a rule like:
- for every chunk in our mempool that had some txs included in the block
- if some tx in the chunk was not in the block, nevermind; ignore this for fee estimation
- otherwise, use the feerate of the chunk, and the time-in-mempool of the youngest tx in chunk, and add that info to the fee estimation