Auto merge of #5241 - nuttycom:consensus/check_orchard_root_bottom, r=daira

Consensus: Add check to ensure that the Orchard commitment tree is not overfull after AppendBundle.

Part of #5197.
This commit is contained in:
Homu 2021-07-29 13:20:34 +00:00
commit 81da4f92ab
1 changed files with 5 additions and 1 deletions

View File

@ -3238,7 +3238,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
sapling_tree.append(outputDescription.cmu);
}
orchard_tree.AppendBundle(tx.GetOrchardBundle());
if (!orchard_tree.AppendBundle(tx.GetOrchardBundle())) {
return state.DoS(100,
error("ConnectBlock(): block would overfill the Orchard commitment tree."),
REJECT_INVALID, "orchard-commitment-tree-full");
};
if (!(tx.vShieldedSpend.empty() && tx.vShieldedOutput.empty())) {
total_sapling_tx += 1;