bitcoin/bitcoin — pull request #4575 by sipa (2014-07-23 13:31:59+00:00)
Title: Bugfix: make CCoinsViewMemPool support pruned entries in underlying cache

Since #4505 it can happen that pcoinsTip contains pruned but existing CCoins entries, representing deleted/reorged transactions.

CCoinsViewMemPool::GetCoins does not deal correctly with this, as it first checks for an entry in the underlying cache (which can be pruned) and then for one in the mempool. Swap these, as the mempool is guaranteed never to conflict with the underlying cache, and the mempool cannot contain pruned transactions.