@@ -728,8 +728,8 @@ func (h *HtlcScriptTree) WitnessScriptForPath(path ScriptPath) ([]byte, error) {
728728
729729// CtrlBlockForPath returns the control block for the given spending path. For
730730// script types that don't have a control block, nil is returned.
731- func (h * HtlcScriptTree ) CtrlBlockForPath (path ScriptPath ,
732- ) (* txscript.ControlBlock , error ) {
731+ func (h * HtlcScriptTree ) CtrlBlockForPath (
732+ path ScriptPath ) (* txscript.ControlBlock , error ) {
733733
734734 switch path {
735735 case ScriptPathSuccess :
@@ -747,6 +747,11 @@ func (h *HtlcScriptTree) CtrlBlockForPath(path ScriptPath,
747747 }
748748}
749749
750+ // Tree returns the underlying ScriptTree of the HtlcScriptTree.
751+ func (h * HtlcScriptTree ) Tree () ScriptTree {
752+ return h .ScriptTree
753+ }
754+
750755// A compile time check to ensure HtlcScriptTree implements the
751756// TapscriptMultiplexer interface.
752757var _ 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 )
@@ -2139,9 +2149,9 @@ type CommitScriptTree struct {
21392149// TapscriptDescriptor interface.
21402150var _ TapscriptDescriptor = (* CommitScriptTree )(nil )
21412151
2142- // WitnessScript returns the witness script that we'll use when signing for the
2143- // remote party, and also verifying signatures on our transactions. As an
2144- // example, when we create an outgoing HTLC for the remote party, we want to
2152+ // WitnessScriptToSign returns the witness script that we'll use when signing
2153+ // for the remote party, and also verifying signatures on our transactions. As
2154+ // an example, when we create an outgoing HTLC for the remote party, we want to
21452155// sign their success path.
21462156func (c * CommitScriptTree ) WitnessScriptToSign () []byte {
21472157 // TODO(roasbeef): abstraction leak here? always dependent
@@ -2150,8 +2160,8 @@ func (c *CommitScriptTree) WitnessScriptToSign() []byte {
21502160
21512161// WitnessScriptForPath returns the witness script for the given spending path.
21522162// An error is returned if the path is unknown.
2153- func (c * CommitScriptTree ) WitnessScriptForPath (path ScriptPath ,
2154- ) ([]byte , error ) {
2163+ func (c * CommitScriptTree ) WitnessScriptForPath (
2164+ path ScriptPath ) ([]byte , error ) {
21552165
21562166 switch path {
21572167 // For the commitment output, the delay and success path are the same,
@@ -2169,8 +2179,8 @@ func (c *CommitScriptTree) WitnessScriptForPath(path ScriptPath,
21692179
21702180// CtrlBlockForPath returns the control block for the given spending path. For
21712181// script types that don't have a control block, nil is returned.
2172- func (c * CommitScriptTree ) CtrlBlockForPath (path ScriptPath ,
2173- ) (* txscript.ControlBlock , error ) {
2182+ func (c * CommitScriptTree ) CtrlBlockForPath (
2183+ path ScriptPath ) (* txscript.ControlBlock , error ) {
21742184
21752185 switch path {
21762186 case ScriptPathDelay :
@@ -2190,6 +2200,11 @@ func (c *CommitScriptTree) CtrlBlockForPath(path ScriptPath,
21902200 }
21912201}
21922202
2203+ // Tree returns the underlying ScriptTree of the CommitScriptTree.
2204+ func (c * CommitScriptTree ) Tree () ScriptTree {
2205+ return c .ScriptTree
2206+ }
2207+
21932208// NewLocalCommitScriptTree returns a new CommitScript tree that can be used to
21942209// create and spend the commitment output for the local party.
21952210func NewLocalCommitScriptTree (csvTimeout uint32 ,
@@ -2319,7 +2334,7 @@ func TaprootCommitScriptToSelf(csvTimeout uint32,
23192334 return commitScriptTree .TaprootKey , nil
23202335}
23212336
2322- // MakeTaprootSCtrlBlock takes a leaf script, the internal key (usually the
2337+ // MakeTaprootCtrlBlock takes a leaf script, the internal key (usually the
23232338// revoke key), and a script tree and creates a valid control block for a spend
23242339// of the leaf.
23252340func MakeTaprootCtrlBlock (leafScript []byte , internalKey * btcec.PublicKey ,
@@ -2374,9 +2389,6 @@ func TaprootCommitSpendSuccess(signer Signer, signDesc *SignDescriptor,
23742389 witnessStack [0 ] = maybeAppendSighash (sweepSig , signDesc .HashType )
23752390 witnessStack [1 ] = signDesc .WitnessScript
23762391 witnessStack [2 ] = ctrlBlockBytes
2377- if err != nil {
2378- return nil , err
2379- }
23802392
23812393 return witnessStack , nil
23822394}
@@ -2858,8 +2870,8 @@ type AnchorScriptTree struct {
28582870
28592871// NewAnchorScriptTree makes a new script tree for an anchor output with the
28602872// passed anchor key.
2861- func NewAnchorScriptTree (anchorKey * btcec. PublicKey ,
2862- ) (* AnchorScriptTree , error ) {
2873+ func NewAnchorScriptTree (
2874+ anchorKey * btcec. PublicKey ) (* AnchorScriptTree , error ) {
28632875
28642876 // The main script used is just a OP_16 CSV (anyone can sweep after 16
28652877 // blocks).
@@ -2895,18 +2907,18 @@ func NewAnchorScriptTree(anchorKey *btcec.PublicKey,
28952907 }, nil
28962908}
28972909
2898- // WitnessScript returns the witness script that we'll use when signing for the
2899- // remote party, and also verifying signatures on our transactions. As an
2900- // example, when we create an outgoing HTLC for the remote party, we want to
2910+ // WitnessScriptToSign returns the witness script that we'll use when signing
2911+ // for the remote party, and also verifying signatures on our transactions. As
2912+ // an example, when we create an outgoing HTLC for the remote party, we want to
29012913// sign their success path.
29022914func (a * AnchorScriptTree ) WitnessScriptToSign () []byte {
29032915 return a .SweepLeaf .Script
29042916}
29052917
29062918// WitnessScriptForPath returns the witness script for the given spending path.
29072919// An error is returned if the path is unknown.
2908- func (a * AnchorScriptTree ) WitnessScriptForPath (path ScriptPath ,
2909- ) ([]byte , error ) {
2920+ func (a * AnchorScriptTree ) WitnessScriptForPath (
2921+ path ScriptPath ) ([]byte , error ) {
29102922
29112923 switch path {
29122924 case ScriptPathDelay :
@@ -2921,8 +2933,8 @@ func (a *AnchorScriptTree) WitnessScriptForPath(path ScriptPath,
29212933
29222934// CtrlBlockForPath returns the control block for the given spending path. For
29232935// script types that don't have a control block, nil is returned.
2924- func (a * AnchorScriptTree ) CtrlBlockForPath (path ScriptPath ,
2925- ) (* txscript.ControlBlock , error ) {
2936+ func (a * AnchorScriptTree ) CtrlBlockForPath (
2937+ path ScriptPath ) (* txscript.ControlBlock , error ) {
29262938
29272939 switch path {
29282940 case ScriptPathDelay :
@@ -2938,6 +2950,11 @@ func (a *AnchorScriptTree) CtrlBlockForPath(path ScriptPath,
29382950 }
29392951}
29402952
2953+ // Tree returns the underlying ScriptTree of the AnchorScriptTree.
2954+ func (a * AnchorScriptTree ) Tree () ScriptTree {
2955+ return a .ScriptTree
2956+ }
2957+
29412958// A compile time check to ensure AnchorScriptTree implements the
29422959// TapscriptDescriptor interface.
29432960var _ TapscriptDescriptor = (* AnchorScriptTree )(nil )
0 commit comments