Browse Source

Auto merge of #1019 - ebfull:mempool-integrity-chained-pours, r=ebfull

Ensure mempool integrity checks don't trip on chained joinsplits.
pull/145/head
zkbot 8 years ago
parent
commit
c80ce72845
  1. 18
      src/txmempool.cpp

18
src/txmempool.cpp

@ -314,14 +314,28 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
assert(it3->second.n == i);
i++;
}
boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> 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);

Loading…
Cancel
Save