Skip to content

Commit

Permalink
asset: copy TapBranchHash from commitment package
Browse files Browse the repository at this point in the history
  • Loading branch information
ffranr committed Dec 13, 2024
1 parent a8feedf commit 1eed5fc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,15 @@ func CheckTapLeafSanity(leaf *txscript.TapLeaf) error {
return nil
}

// TapBranchHash takes the tap hashes of the left and right nodes and hashes
// them into a branch.
func TapBranchHash(l, r chainhash.Hash) chainhash.Hash {
if bytes.Compare(l[:], r[:]) > 0 {
l, r = r, l
}
return *chainhash.TaggedHash(chainhash.TagTapBranch, l[:], r[:])
}

// TapLeafNodes represents an ordered list of TapLeaf objects, that have been
// checked for their script version and size. These leaves can be stored to and
// loaded from the DB.
Expand Down

0 comments on commit 1eed5fc

Please sign in to comment.