diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-06-07 13:44:56 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-06-07 13:44:56 +0200 |
commit | 288d85ddf2e0a0c9d25a23db56052883170466d0 (patch) | |
tree | 79da8673928fa0254b103a983b137136ea8de40c /src/txmempool.cpp | |
parent | c2a4724642400bc9200aeef4c725b5c07eee9d90 (diff) |
Get rid of CTxMempool::lookup() entirely
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r-- | src/txmempool.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index d39c9577f2..205ffd6379 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -831,16 +831,6 @@ std::shared_ptr<const CTransaction> CTxMemPool::get(const uint256& hash) const return i->GetSharedTx(); } -bool CTxMemPool::lookup(uint256 hash, CTransaction& result) const -{ - auto tx = get(hash); - if (tx) { - result = *tx; - return true; - } - return false; -} - TxMempoolInfo CTxMemPool::info(const uint256& hash) const { LOCK(cs); @@ -960,9 +950,9 @@ bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) const { // If an entry in the mempool exists, always return that one, as it's guaranteed to never // conflict with the underlying cache, and it cannot have pruned entries (as it contains full) // transactions. First checking the underlying cache risks returning a pruned entry instead. - CTransaction tx; - if (mempool.lookup(txid, tx)) { - coins = CCoins(tx, MEMPOOL_HEIGHT); + shared_ptr<const CTransaction> ptx = mempool.get(txid); + if (ptx) { + coins = CCoins(*ptx, MEMPOOL_HEIGHT); return true; } return (base->GetCoins(txid, coins) && !coins.IsPruned()); |