Auto merge of #1019 - ebfull:mempool-integrity-chained-pours, r=ebfull
Ensure mempool integrity checks don't trip on chained joinsplits.
This commit is contained in:
commit
c80ce72845
|
@ -314,14 +314,28 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
||||||
assert(it3->second.n == i);
|
assert(it3->second.n == i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates;
|
||||||
|
|
||||||
BOOST_FOREACH(const CPourTx &pour, tx.vpour) {
|
BOOST_FOREACH(const CPourTx &pour, tx.vpour) {
|
||||||
BOOST_FOREACH(const uint256 &serial, pour.serials) {
|
BOOST_FOREACH(const uint256 &serial, pour.serials) {
|
||||||
assert(!pcoins->GetSerial(serial));
|
assert(!pcoins->GetSerial(serial));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: chained pours
|
|
||||||
ZCIncrementalMerkleTree tree;
|
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)
|
if (fDependsWait)
|
||||||
waitingOnDependants.push_back(&it->second);
|
waitingOnDependants.push_back(&it->second);
|
||||||
|
|
Loading…
Reference in New Issue