From dcbbf43d8b6c842f1c7fc6bfff3ba5d1c69abe8a Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Tue, 6 Jul 2021 10:54:14 -0600 Subject: [PATCH] Ensure that the Orchard note commitment tree does not exceed its maximum size. --- src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 957b54495..ee8796d5e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(): the Orchard commitment tree is full."), + REJECT_INVALID, "orchard-commitment-tree-full"); + }; if (!(tx.vShieldedSpend.empty() && tx.vShieldedOutput.empty())) { total_sapling_tx += 1;