bitcoin/bitcoin — pull request #5368 by gavinandresen (2014-11-25 19:47:58+00:00)
Title: Evict coinbase spends from memory pool during re-org

This is an alternative version of #5267

It works by having DisconnectTip() lookup the block at height current-COINBASE_MATURITY, and then removing any transactions spending that coinbase (recursively) from the memory pool.

Since re-orgs happen by repeated calls to DisconnectTip(), this will keep the memory pool always consistent, even in the middle of a re-org.

Builds on #5316

Includes a new regression test.