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?
As of Bitcoin Core 0.14.0, these are the ways a transaction can leave the mempool:
-maxmempool
option), and a new higher-fee transaction was accepted, evicting the bottom.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.
There is no fixed expiration time for each node, but the default setting is 72 hours.
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.