bitcoin/bitcoin — pull request #3753 by jgarzik (2014-02-26 22:27:30+00:00)
Title: mempool janitor: periodic sweep and clean of not-confirming transactions

The mempool janitor ("poolman") is a thread that runs every -janitorinterval
seconds. The janitor scans and removes memory pool transactions
older than current time minus -janitorexpire seconds.

By default, janitor runs every 24 hrs, expiring TXs older than 72 hrs.

IsMine() transactions are not touched.

This is *intentionally crude*: easily reviewed, reasoned and tested; fitting easily within the current framework, or being backported to an older bitcoind.

Comments:

* One alternative implementation was considered:
```
while (mempool byte size > limit)
expire oldest !ismine
```
This would work, but require a sort step, as mempool is not time-ordered. There is also the question of how often to run such a while{} loop, likely leading to some sort of high-water/low-water system.