From dcbbf43d8b6c842f1c7fc6bfff3ba5d1c69abe8a Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Tue, 6 Jul 2021 10:54:14 -0600 Subject: [PATCH 1/2] 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; From ec4e9ae509150157de71d5e6d39352976f4b4852 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 29 Jul 2021 14:17:35 +0100 Subject: [PATCH 2/2] Improve error message when a block would overfill the Orchard commitment tree. Co-authored-by: str4d --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ee8796d5e..53d073979 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3240,7 +3240,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin if (!orchard_tree.AppendBundle(tx.GetOrchardBundle())) { return state.DoS(100, - error("ConnectBlock(): the Orchard commitment tree is full."), + error("ConnectBlock(): block would overfill the Orchard commitment tree."), REJECT_INVALID, "orchard-commitment-tree-full"); };