Skip to content

Commit 1da727b

Browse files
committed
commitment: simplify TapscriptRoot
This was always a bit confusing and also unnecessarily complicated. We'll need to manually re-create the tapscript root given a sibling in the next commit, where we'll use similar code. This refactor shows that the root with no sibling can easily be transformed into the root with a sibling.
1 parent 3f20bf3 commit 1da727b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

commitment/tap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ func IsTaprootAssetCommitmentScript(script []byte) bool {
457457
func (c *TapCommitment) TapscriptRoot(sibling *chainhash.Hash) chainhash.Hash {
458458
commitmentLeaf := c.TapLeaf()
459459
if sibling == nil {
460-
return txscript.AssembleTaprootScriptTree(commitmentLeaf).
461-
RootNode.TapHash()
460+
return commitmentLeaf.TapHash()
462461
}
463462

464463
// The ordering of `commitmentLeaf` and `sibling` doesn't matter here as

0 commit comments

Comments
 (0)