34

How does my bitcoin core client know when to drop a transaction from the memory pool?

Is it as simple as a specific period of time?

3 Answers 3

50

As of Bitcoin Core 0.14.0, these are the ways a transaction can leave the mempool:

  • The transaction was included in a block.
  • The transaction or one of its unconfirmed ancestors conflicts with a transaction that was included in a block.
  • The transaction was replaced by a newer version (see BIP 125).
  • The transaction was at the bottom of the mempool (when sorted by fee per size), the mempool had reached its size limit (see the -maxmempool option), and a new higher-fee transaction was accepted, evicting the bottom.
  • The transaction expired by timeout (by default 14 days after entering).

Also, transactions that have left the mempool can always enter them again. For example, when they're part of the local wallet and get rebroadcast, or when they're received again over the network. Eviction does not imply a transaction is cancelled.

Since Bitcoin Core 0.14.0, the mempool is saved to disk, so it persists across restarts. In earlier versions a restart would also result in a wiped mempool.

6
  • 2
    How can one change the timeout?
    – Nick ODell
    Commented Jun 25, 2016 at 1:04
  • 3
    Using -mempoolexpiry=N with N in hours. Commented Jun 25, 2016 at 10:10
  • 1
    I think the default timeout for transactions has been increased to 14 days, right?
    – Murch
    Commented May 13, 2017 at 19:27
  • @Murch It seems like from 0.14, it's 14 days, according to this reddit comment.
    – nopara73
    Commented May 14, 2017 at 8:09
  • 1
    @zono: Yes, if they are rebroadcast and exceed the minRelayTxFee that you require for transactions.
    – Murch
    Commented May 16, 2017 at 15:27
7

There is no fixed expiration time for each node, but the default setting is 72 hours.

https://bitcoin.stackexchange.com/a/43165/24926

1

In my particular case (unconfirmed not broadcasted transaction in memory pool of bitcoin core 0.14.1) the only way to remove that transaction was to delete mempool.dat after wallet close.

So deleting mempool.dat effectively forces transactions to leave memory pool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.