Skip to content

Commit

Permalink
Merge #950: Fix TapTree derserialization
Browse files Browse the repository at this point in the history
c97589f Fix TapTree derserialization (sanket1729)

Pull request description:

  Trees should only be serialized if both of the following conditions
  hold:
  1) Tree is complete binary tree(is_finalized)
  2) Tree does not have any hidden nodes

ACKs for top commit:
  tcharding:
    ACK c97589f
  apoelstra:
    ACK c97589f

Tree-SHA512: 33d16f2d532cb24acba4ab847d493e550f7b279567678f3f2cd7e4161dea8b720a0e35be32b6c506e467c3526a29042aad8f4b5f45133b9a32028d4ee6a48f8e
  • Loading branch information
apoelstra committed Apr 20, 2022
2 parents 221e153 + c97589f commit 1e58208
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/psbt/serialize.rs
Expand Up @@ -355,7 +355,7 @@ impl Deserialize for TapTree {
builder = builder.add_leaf_with_ver(*depth, script, leaf_version)
.map_err(|_| encode::Error::ParseFailed("Tree not in DFS order"))?;
}
if builder.is_finalized() || !builder.has_hidden_nodes() {
if builder.is_finalized() && !builder.has_hidden_nodes() {
Ok(TapTree(builder))
} else {
Err(encode::Error::ParseFailed("Incomplete taproot Tree"))
Expand Down

0 comments on commit 1e58208

Please sign in to comment.