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?

up vote 35 down vote accepted

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.

  • 2
    How can one change the timeout? – Nick ODell Jun 25 '16 at 1:04
  • 3
    Using -mempoolexpiry=N with N in hours. – Pieter Wuille Jun 25 '16 at 10:10
  • I think the default timeout for transactions has been increased to 14 days, right? – Murch May 13 '17 at 19:27
  • @Murch It seems like from 0.14, it's 14 days, according to this reddit comment. – nopara73 May 14 '17 at 8:09
  • @murch Will evicted (or deleted) tx by timeout enter into mempool again? – zono May 16 '17 at 15:22

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

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

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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