@@ -733,8 +733,8 @@ func (h *HtlcScriptTree) WitnessScriptForPath(path ScriptPath) ([]byte, error) {
733733
734734// CtrlBlockForPath returns the control block for the given spending path. For
735735// script types that don't have a control block, nil is returned.
736- func (h * HtlcScriptTree ) CtrlBlockForPath (path ScriptPath ,
737- ) (* txscript.ControlBlock , error ) {
736+ func (h * HtlcScriptTree ) CtrlBlockForPath (
737+ path ScriptPath ) (* txscript.ControlBlock , error ) {
738738
739739 switch path {
740740 case ScriptPathSuccess :
@@ -752,6 +752,11 @@ func (h *HtlcScriptTree) CtrlBlockForPath(path ScriptPath,
752752 }
753753}
754754
755+ // Tree returns the underlying ScriptTree of the HtlcScriptTree.
756+ func (h * HtlcScriptTree ) Tree () ScriptTree {
757+ return h .ScriptTree
758+ }
759+
755760// A compile time check to ensure HtlcScriptTree implements the
756761// TapscriptMultiplexer interface.
757762var _ TapscriptDescriptor = (* HtlcScriptTree )(nil )
@@ -1752,18 +1757,18 @@ func TaprootSecondLevelScriptTree(revokeKey, delayKey *btcec.PublicKey,
17521757 }, nil
17531758}
17541759
1755- // WitnessScript returns the witness script that we'll use when signing for the
1756- // remote party, and also verifying signatures on our transactions. As an
1757- // example, when we create an outgoing HTLC for the remote party, we want to
1760+ // WitnessScriptToSign returns the witness script that we'll use when signing
1761+ // for the remote party, and also verifying signatures on our transactions. As
1762+ // an example, when we create an outgoing HTLC for the remote party, we want to
17581763// sign their success path.
17591764func (s * SecondLevelScriptTree ) WitnessScriptToSign () []byte {
17601765 return s .SuccessTapLeaf .Script
17611766}
17621767
17631768// WitnessScriptForPath returns the witness script for the given spending path.
17641769// An error is returned if the path is unknown.
1765- func (s * SecondLevelScriptTree ) WitnessScriptForPath (path ScriptPath ,
1766- ) ([]byte , error ) {
1770+ func (s * SecondLevelScriptTree ) WitnessScriptForPath (
1771+ path ScriptPath ) ([]byte , error ) {
17671772
17681773 switch path {
17691774 case ScriptPathDelay :
@@ -1778,8 +1783,8 @@ func (s *SecondLevelScriptTree) WitnessScriptForPath(path ScriptPath,
17781783
17791784// CtrlBlockForPath returns the control block for the given spending path. For
17801785// script types that don't have a control block, nil is returned.
1781- func (s * SecondLevelScriptTree ) CtrlBlockForPath (path ScriptPath ,
1782- ) (* txscript.ControlBlock , error ) {
1786+ func (s * SecondLevelScriptTree ) CtrlBlockForPath (
1787+ path ScriptPath ) (* txscript.ControlBlock , error ) {
17831788
17841789 switch path {
17851790 case ScriptPathDelay :
@@ -1795,6 +1800,11 @@ func (s *SecondLevelScriptTree) CtrlBlockForPath(path ScriptPath,
17951800 }
17961801}
17971802
1803+ // Tree returns the underlying ScriptTree of the SecondLevelScriptTree.
1804+ func (s * SecondLevelScriptTree ) Tree () ScriptTree {
1805+ return s .ScriptTree
1806+ }
1807+
17981808// A compile time check to ensure SecondLevelScriptTree implements the
17991809// TapscriptDescriptor interface.
18001810var _ TapscriptDescriptor = (* SecondLevelScriptTree )(nil )
@@ -2137,9 +2147,9 @@ type CommitScriptTree struct {
21372147// TapscriptDescriptor interface.
21382148var _ TapscriptDescriptor = (* CommitScriptTree )(nil )
21392149
2140- // WitnessScript returns the witness script that we'll use when signing for the
2141- // remote party, and also verifying signatures on our transactions. As an
2142- // example, when we create an outgoing HTLC for the remote party, we want to
2150+ // WitnessScriptToSign returns the witness script that we'll use when signing
2151+ // for the remote party, and also verifying signatures on our transactions. As
2152+ // an example, when we create an outgoing HTLC for the remote party, we want to
21432153// sign their success path.
21442154func (c * CommitScriptTree ) WitnessScriptToSign () []byte {
21452155 // TODO(roasbeef): abstraction leak here? always dependent
@@ -2148,8 +2158,8 @@ func (c *CommitScriptTree) WitnessScriptToSign() []byte {
21482158
21492159// WitnessScriptForPath returns the witness script for the given spending path.
21502160// An error is returned if the path is unknown.
2151- func (c * CommitScriptTree ) WitnessScriptForPath (path ScriptPath ,
2152- ) ([]byte , error ) {
2161+ func (c * CommitScriptTree ) WitnessScriptForPath (
2162+ path ScriptPath ) ([]byte , error ) {
21532163
21542164 switch path {
21552165 // For the commitment output, the delay and success path are the same,
@@ -2167,8 +2177,8 @@ func (c *CommitScriptTree) WitnessScriptForPath(path ScriptPath,
21672177
21682178// CtrlBlockForPath returns the control block for the given spending path. For
21692179// script types that don't have a control block, nil is returned.
2170- func (c * CommitScriptTree ) CtrlBlockForPath (path ScriptPath ,
2171- ) (* txscript.ControlBlock , error ) {
2180+ func (c * CommitScriptTree ) CtrlBlockForPath (
2181+ path ScriptPath ) (* txscript.ControlBlock , error ) {
21722182
21732183 switch path {
21742184 case ScriptPathDelay :
@@ -2188,6 +2198,11 @@ func (c *CommitScriptTree) CtrlBlockForPath(path ScriptPath,
21882198 }
21892199}
21902200
2201+ // Tree returns the underlying ScriptTree of the CommitScriptTree.
2202+ func (c * CommitScriptTree ) Tree () ScriptTree {
2203+ return c .ScriptTree
2204+ }
2205+
21912206// NewLocalCommitScriptTree returns a new CommitScript tree that can be used to
21922207// create and spend the commitment output for the local party.
21932208func NewLocalCommitScriptTree (csvTimeout uint32 , selfKey ,
@@ -2315,7 +2330,7 @@ func TaprootCommitScriptToSelf(csvTimeout uint32,
23152330 return commitScriptTree .TaprootKey , nil
23162331}
23172332
2318- // MakeTaprootSCtrlBlock takes a leaf script, the internal key (usually the
2333+ // MakeTaprootCtrlBlock takes a leaf script, the internal key (usually the
23192334// revoke key), and a script tree and creates a valid control block for a spend
23202335// of the leaf.
23212336func MakeTaprootCtrlBlock (leafScript []byte , internalKey * btcec.PublicKey ,
@@ -2370,9 +2385,6 @@ func TaprootCommitSpendSuccess(signer Signer, signDesc *SignDescriptor,
23702385 witnessStack [0 ] = maybeAppendSighash (sweepSig , signDesc .HashType )
23712386 witnessStack [1 ] = signDesc .WitnessScript
23722387 witnessStack [2 ] = ctrlBlockBytes
2373- if err != nil {
2374- return nil , err
2375- }
23762388
23772389 return witnessStack , nil
23782390}
@@ -2854,8 +2866,8 @@ type AnchorScriptTree struct {
28542866
28552867// NewAnchorScriptTree makes a new script tree for an anchor output with the
28562868// passed anchor key.
2857- func NewAnchorScriptTree (anchorKey * btcec. PublicKey ,
2858- ) (* AnchorScriptTree , error ) {
2869+ func NewAnchorScriptTree (
2870+ anchorKey * btcec. PublicKey ) (* AnchorScriptTree , error ) {
28592871
28602872 // The main script used is just a OP_16 CSV (anyone can sweep after 16
28612873 // blocks).
@@ -2891,18 +2903,18 @@ func NewAnchorScriptTree(anchorKey *btcec.PublicKey,
28912903 }, nil
28922904}
28932905
2894- // WitnessScript returns the witness script that we'll use when signing for the
2895- // remote party, and also verifying signatures on our transactions. As an
2896- // example, when we create an outgoing HTLC for the remote party, we want to
2906+ // WitnessScriptToSign returns the witness script that we'll use when signing
2907+ // for the remote party, and also verifying signatures on our transactions. As
2908+ // an example, when we create an outgoing HTLC for the remote party, we want to
28972909// sign their success path.
28982910func (a * AnchorScriptTree ) WitnessScriptToSign () []byte {
28992911 return a .SweepLeaf .Script
29002912}
29012913
29022914// WitnessScriptForPath returns the witness script for the given spending path.
29032915// An error is returned if the path is unknown.
2904- func (a * AnchorScriptTree ) WitnessScriptForPath (path ScriptPath ,
2905- ) ([]byte , error ) {
2916+ func (a * AnchorScriptTree ) WitnessScriptForPath (
2917+ path ScriptPath ) ([]byte , error ) {
29062918
29072919 switch path {
29082920 case ScriptPathDelay :
@@ -2917,8 +2929,8 @@ func (a *AnchorScriptTree) WitnessScriptForPath(path ScriptPath,
29172929
29182930// CtrlBlockForPath returns the control block for the given spending path. For
29192931// script types that don't have a control block, nil is returned.
2920- func (a * AnchorScriptTree ) CtrlBlockForPath (path ScriptPath ,
2921- ) (* txscript.ControlBlock , error ) {
2932+ func (a * AnchorScriptTree ) CtrlBlockForPath (
2933+ path ScriptPath ) (* txscript.ControlBlock , error ) {
29222934
29232935 switch path {
29242936 case ScriptPathDelay :
@@ -2934,6 +2946,11 @@ func (a *AnchorScriptTree) CtrlBlockForPath(path ScriptPath,
29342946 }
29352947}
29362948
2949+ // Tree returns the underlying ScriptTree of the AnchorScriptTree.
2950+ func (a * AnchorScriptTree ) Tree () ScriptTree {
2951+ return a .ScriptTree
2952+ }
2953+
29372954// A compile time check to ensure AnchorScriptTree implements the
29382955// TapscriptDescriptor interface.
29392956var _ TapscriptDescriptor = (* AnchorScriptTree )(nil )
0 commit comments