diff --git a/zebra-chain/src/orchard/tree.rs b/zebra-chain/src/orchard/tree.rs index 2bbe4872..3e571f42 100644 --- a/zebra-chain/src/orchard/tree.rs +++ b/zebra-chain/src/orchard/tree.rs @@ -440,7 +440,12 @@ impl NoteCommitmentTree { return self.is_complete_subtree(); } - // If `self` is the next index, check for spurious index differences. + // If `self` is the next index, check if the last note completed a subtree. + if self.is_complete_subtree() { + return true; + } + + // Then check for spurious index differences. // // There is one new subtree somewhere in the trees. It is either: // - a new subtree at the end of the previous tree, or diff --git a/zebra-chain/src/sapling/tree.rs b/zebra-chain/src/sapling/tree.rs index c940b94d..80b77ed2 100644 --- a/zebra-chain/src/sapling/tree.rs +++ b/zebra-chain/src/sapling/tree.rs @@ -421,7 +421,12 @@ impl NoteCommitmentTree { return self.is_complete_subtree(); } - // If `self` is the next index, check for spurious index differences. + // If `self` is the next index, check if the last note completed a subtree. + if self.is_complete_subtree() { + return true; + } + + // Then check for spurious index differences. // // There is one new subtree somewhere in the trees. It is either: // - a new subtree at the end of the previous tree, or