@@ -729,8 +729,8 @@ func (h *HtlcScriptTree) WitnessScriptForPath(path ScriptPath) ([]byte, error) {
729729
730730// CtrlBlockForPath returns the control block for the given spending path. For
731731// script types that don't have a control block, nil is returned.
732- func (h * HtlcScriptTree ) CtrlBlockForPath (path ScriptPath ,
733- ) (* txscript.ControlBlock , error ) {
732+ func (h * HtlcScriptTree ) CtrlBlockForPath (
733+ path ScriptPath ) (* txscript.ControlBlock , error ) {
734734
735735 switch path {
736736 case ScriptPathSuccess :
@@ -748,6 +748,11 @@ func (h *HtlcScriptTree) CtrlBlockForPath(path ScriptPath,
748748 }
749749}
750750
751+ // Tree returns the underlying ScriptTree of the HtlcScriptTree.
752+ func (h * HtlcScriptTree ) Tree () ScriptTree {
753+ return h .ScriptTree
754+ }
755+
751756// A compile time check to ensure HtlcScriptTree implements the
752757// TapscriptMultiplexer interface.
753758var _ TapscriptDescriptor = (* HtlcScriptTree )(nil )
@@ -1748,18 +1753,18 @@ func TaprootSecondLevelScriptTree(revokeKey, delayKey *btcec.PublicKey,
17481753 }, nil
17491754}
17501755
1751- // WitnessScript returns the witness script that we'll use when signing for the
1752- // remote party, and also verifying signatures on our transactions. As an
1753- // example, when we create an outgoing HTLC for the remote party, we want to
1756+ // WitnessScriptToSign returns the witness script that we'll use when signing
1757+ // for the remote party, and also verifying signatures on our transactions. As
1758+ // an example, when we create an outgoing HTLC for the remote party, we want to
17541759// sign their success path.
17551760func (s * SecondLevelScriptTree ) WitnessScriptToSign () []byte {
17561761 return s .SuccessTapLeaf .Script
17571762}
17581763
17591764// WitnessScriptForPath returns the witness script for the given spending path.
17601765// An error is returned if the path is unknown.
1761- func (s * SecondLevelScriptTree ) WitnessScriptForPath (path ScriptPath ,
1762- ) ([]byte , error ) {
1766+ func (s * SecondLevelScriptTree ) WitnessScriptForPath (
1767+ path ScriptPath ) ([]byte , error ) {
17631768
17641769 switch path {
17651770 case ScriptPathDelay :
@@ -1774,8 +1779,8 @@ func (s *SecondLevelScriptTree) WitnessScriptForPath(path ScriptPath,
17741779
17751780// CtrlBlockForPath returns the control block for the given spending path. For
17761781// script types that don't have a control block, nil is returned.
1777- func (s * SecondLevelScriptTree ) CtrlBlockForPath (path ScriptPath ,
1778- ) (* txscript.ControlBlock , error ) {
1782+ func (s * SecondLevelScriptTree ) CtrlBlockForPath (
1783+ path ScriptPath ) (* txscript.ControlBlock , error ) {
17791784
17801785 switch path {
17811786 case ScriptPathDelay :
@@ -1791,6 +1796,11 @@ func (s *SecondLevelScriptTree) CtrlBlockForPath(path ScriptPath,
17911796 }
17921797}
17931798
1799+ // Tree returns the underlying ScriptTree of the SecondLevelScriptTree.
1800+ func (s * SecondLevelScriptTree ) Tree () ScriptTree {
1801+ return s .ScriptTree
1802+ }
1803+
17941804// A compile time check to ensure SecondLevelScriptTree implements the
17951805// TapscriptDescriptor interface.
17961806var _ TapscriptDescriptor = (* SecondLevelScriptTree )(nil )
@@ -2133,9 +2143,9 @@ type CommitScriptTree struct {
21332143// TapscriptDescriptor interface.
21342144var _ TapscriptDescriptor = (* CommitScriptTree )(nil )
21352145
2136- // WitnessScript returns the witness script that we'll use when signing for the
2137- // remote party, and also verifying signatures on our transactions. As an
2138- // example, when we create an outgoing HTLC for the remote party, we want to
2146+ // WitnessScriptToSign returns the witness script that we'll use when signing
2147+ // for the remote party, and also verifying signatures on our transactions. As
2148+ // an example, when we create an outgoing HTLC for the remote party, we want to
21392149// sign their success path.
21402150func (c * CommitScriptTree ) WitnessScriptToSign () []byte {
21412151 // TODO(roasbeef): abstraction leak here? always dependent
@@ -2144,8 +2154,8 @@ func (c *CommitScriptTree) WitnessScriptToSign() []byte {
21442154
21452155// WitnessScriptForPath returns the witness script for the given spending path.
21462156// An error is returned if the path is unknown.
2147- func (c * CommitScriptTree ) WitnessScriptForPath (path ScriptPath ,
2148- ) ([]byte , error ) {
2157+ func (c * CommitScriptTree ) WitnessScriptForPath (
2158+ path ScriptPath ) ([]byte , error ) {
21492159
21502160 switch path {
21512161 // For the commitment output, the delay and success path are the same,
@@ -2163,8 +2173,8 @@ func (c *CommitScriptTree) WitnessScriptForPath(path ScriptPath,
21632173
21642174// CtrlBlockForPath returns the control block for the given spending path. For
21652175// script types that don't have a control block, nil is returned.
2166- func (c * CommitScriptTree ) CtrlBlockForPath (path ScriptPath ,
2167- ) (* txscript.ControlBlock , error ) {
2176+ func (c * CommitScriptTree ) CtrlBlockForPath (
2177+ path ScriptPath ) (* txscript.ControlBlock , error ) {
21682178
21692179 switch path {
21702180 case ScriptPathDelay :
@@ -2184,6 +2194,11 @@ func (c *CommitScriptTree) CtrlBlockForPath(path ScriptPath,
21842194 }
21852195}
21862196
2197+ // Tree returns the underlying ScriptTree of the CommitScriptTree.
2198+ func (c * CommitScriptTree ) Tree () ScriptTree {
2199+ return c .ScriptTree
2200+ }
2201+
21872202// NewLocalCommitScriptTree returns a new CommitScript tree that can be used to
21882203// create and spend the commitment output for the local party.
21892204func NewLocalCommitScriptTree (csvTimeout uint32 , selfKey ,
@@ -2311,7 +2326,7 @@ func TaprootCommitScriptToSelf(csvTimeout uint32,
23112326 return commitScriptTree .TaprootKey , nil
23122327}
23132328
2314- // MakeTaprootSCtrlBlock takes a leaf script, the internal key (usually the
2329+ // MakeTaprootCtrlBlock takes a leaf script, the internal key (usually the
23152330// revoke key), and a script tree and creates a valid control block for a spend
23162331// of the leaf.
23172332func MakeTaprootCtrlBlock (leafScript []byte , internalKey * btcec.PublicKey ,
@@ -2366,9 +2381,6 @@ func TaprootCommitSpendSuccess(signer Signer, signDesc *SignDescriptor,
23662381 witnessStack [0 ] = maybeAppendSighash (sweepSig , signDesc .HashType )
23672382 witnessStack [1 ] = signDesc .WitnessScript
23682383 witnessStack [2 ] = ctrlBlockBytes
2369- if err != nil {
2370- return nil , err
2371- }
23722384
23732385 return witnessStack , nil
23742386}
@@ -2850,8 +2862,8 @@ type AnchorScriptTree struct {
28502862
28512863// NewAnchorScriptTree makes a new script tree for an anchor output with the
28522864// passed anchor key.
2853- func NewAnchorScriptTree (anchorKey * btcec. PublicKey ,
2854- ) (* AnchorScriptTree , error ) {
2865+ func NewAnchorScriptTree (
2866+ anchorKey * btcec. PublicKey ) (* AnchorScriptTree , error ) {
28552867
28562868 // The main script used is just a OP_16 CSV (anyone can sweep after 16
28572869 // blocks).
@@ -2887,18 +2899,18 @@ func NewAnchorScriptTree(anchorKey *btcec.PublicKey,
28872899 }, nil
28882900}
28892901
2890- // WitnessScript returns the witness script that we'll use when signing for the
2891- // remote party, and also verifying signatures on our transactions. As an
2892- // example, when we create an outgoing HTLC for the remote party, we want to
2902+ // WitnessScriptToSign returns the witness script that we'll use when signing
2903+ // for the remote party, and also verifying signatures on our transactions. As
2904+ // an example, when we create an outgoing HTLC for the remote party, we want to
28932905// sign their success path.
28942906func (a * AnchorScriptTree ) WitnessScriptToSign () []byte {
28952907 return a .SweepLeaf .Script
28962908}
28972909
28982910// WitnessScriptForPath returns the witness script for the given spending path.
28992911// An error is returned if the path is unknown.
2900- func (a * AnchorScriptTree ) WitnessScriptForPath (path ScriptPath ,
2901- ) ([]byte , error ) {
2912+ func (a * AnchorScriptTree ) WitnessScriptForPath (
2913+ path ScriptPath ) ([]byte , error ) {
29022914
29032915 switch path {
29042916 case ScriptPathDelay :
@@ -2913,8 +2925,8 @@ func (a *AnchorScriptTree) WitnessScriptForPath(path ScriptPath,
29132925
29142926// CtrlBlockForPath returns the control block for the given spending path. For
29152927// script types that don't have a control block, nil is returned.
2916- func (a * AnchorScriptTree ) CtrlBlockForPath (path ScriptPath ,
2917- ) (* txscript.ControlBlock , error ) {
2928+ func (a * AnchorScriptTree ) CtrlBlockForPath (
2929+ path ScriptPath ) (* txscript.ControlBlock , error ) {
29182930
29192931 switch path {
29202932 case ScriptPathDelay :
@@ -2930,6 +2942,11 @@ func (a *AnchorScriptTree) CtrlBlockForPath(path ScriptPath,
29302942 }
29312943}
29322944
2945+ // Tree returns the underlying ScriptTree of the AnchorScriptTree.
2946+ func (a * AnchorScriptTree ) Tree () ScriptTree {
2947+ return a .ScriptTree
2948+ }
2949+
29332950// A compile time check to ensure AnchorScriptTree implements the
29342951// TapscriptDescriptor interface.
29352952var _ TapscriptDescriptor = (* AnchorScriptTree )(nil )
0 commit comments