diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 0a202229a..edffcec78 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -314,14 +314,28 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const assert(it3->second.n == i); i++; } + + boost::unordered_map intermediates; + BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const uint256 &serial, pour.serials) { assert(!pcoins->GetSerial(serial)); } - // TODO: chained pours ZCIncrementalMerkleTree tree; - assert(pcoins->GetAnchorAt(pour.anchor, tree)); + auto it = intermediates.find(pour.anchor); + if (it != intermediates.end()) { + tree = it->second; + } else { + assert(pcoins->GetAnchorAt(pour.anchor, tree)); + } + + BOOST_FOREACH(const uint256& commitment, pour.commitments) + { + tree.append(commitment); + } + + intermediates.insert(std::make_pair(tree.root(), tree)); } if (fDependsWait) waitingOnDependants.push_back(&it->second);