@@ -689,8 +689,8 @@ func (h *HtlcScriptTree) WitnessScriptForPath(path ScriptPath) ([]byte, error) {
689689
690690// CtrlBlockForPath returns the control block for the given spending path. For
691691// script types that don't have a control block, nil is returned.
692- func (h * HtlcScriptTree ) CtrlBlockForPath (path ScriptPath ,
693- ) (* txscript.ControlBlock , error ) {
692+ func (h * HtlcScriptTree ) CtrlBlockForPath (
693+ path ScriptPath ) (* txscript.ControlBlock , error ) {
694694
695695 switch path {
696696 case ScriptPathSuccess :
@@ -708,6 +708,11 @@ func (h *HtlcScriptTree) CtrlBlockForPath(path ScriptPath,
708708 }
709709}
710710
711+ // Tree returns the underlying ScriptTree of the HtlcScriptTree.
712+ func (h * HtlcScriptTree ) Tree () ScriptTree {
713+ return h .ScriptTree
714+ }
715+
711716// A compile time check to ensure HtlcScriptTree implements the
712717// TapscriptMultiplexer interface.
713718var _ TapscriptDescriptor = (* HtlcScriptTree )(nil )
@@ -1690,18 +1695,18 @@ func TaprootSecondLevelScriptTree(revokeKey, delayKey *btcec.PublicKey,
16901695 }, nil
16911696}
16921697
1693- // WitnessScript returns the witness script that we'll use when signing for the
1694- // remote party, and also verifying signatures on our transactions. As an
1695- // example, when we create an outgoing HTLC for the remote party, we want to
1698+ // WitnessScriptToSign returns the witness script that we'll use when signing
1699+ // for the remote party, and also verifying signatures on our transactions. As
1700+ // an example, when we create an outgoing HTLC for the remote party, we want to
16961701// sign their success path.
16971702func (s * SecondLevelScriptTree ) WitnessScriptToSign () []byte {
16981703 return s .SuccessTapLeaf .Script
16991704}
17001705
17011706// WitnessScriptForPath returns the witness script for the given spending path.
17021707// An error is returned if the path is unknown.
1703- func (s * SecondLevelScriptTree ) WitnessScriptForPath (path ScriptPath ,
1704- ) ([]byte , error ) {
1708+ func (s * SecondLevelScriptTree ) WitnessScriptForPath (
1709+ path ScriptPath ) ([]byte , error ) {
17051710
17061711 switch path {
17071712 case ScriptPathDelay :
@@ -1716,8 +1721,8 @@ func (s *SecondLevelScriptTree) WitnessScriptForPath(path ScriptPath,
17161721
17171722// CtrlBlockForPath returns the control block for the given spending path. For
17181723// script types that don't have a control block, nil is returned.
1719- func (s * SecondLevelScriptTree ) CtrlBlockForPath (path ScriptPath ,
1720- ) (* txscript.ControlBlock , error ) {
1724+ func (s * SecondLevelScriptTree ) CtrlBlockForPath (
1725+ path ScriptPath ) (* txscript.ControlBlock , error ) {
17211726
17221727 switch path {
17231728 case ScriptPathDelay :
@@ -1733,6 +1738,11 @@ func (s *SecondLevelScriptTree) CtrlBlockForPath(path ScriptPath,
17331738 }
17341739}
17351740
1741+ // Tree returns the underlying ScriptTree of the SecondLevelScriptTree.
1742+ func (s * SecondLevelScriptTree ) Tree () ScriptTree {
1743+ return s .ScriptTree
1744+ }
1745+
17361746// A compile time check to ensure SecondLevelScriptTree implements the
17371747// TapscriptDescriptor interface.
17381748var _ TapscriptDescriptor = (* SecondLevelScriptTree )(nil )
@@ -2069,9 +2079,9 @@ type CommitScriptTree struct {
20692079// TapscriptDescriptor interface.
20702080var _ TapscriptDescriptor = (* CommitScriptTree )(nil )
20712081
2072- // WitnessScript returns the witness script that we'll use when signing for the
2073- // remote party, and also verifying signatures on our transactions. As an
2074- // example, when we create an outgoing HTLC for the remote party, we want to
2082+ // WitnessScriptToSign returns the witness script that we'll use when signing
2083+ // for the remote party, and also verifying signatures on our transactions. As
2084+ // an example, when we create an outgoing HTLC for the remote party, we want to
20752085// sign their success path.
20762086func (c * CommitScriptTree ) WitnessScriptToSign () []byte {
20772087 // TODO(roasbeef): abstraction leak here? always dependent
@@ -2080,8 +2090,8 @@ func (c *CommitScriptTree) WitnessScriptToSign() []byte {
20802090
20812091// WitnessScriptForPath returns the witness script for the given spending path.
20822092// An error is returned if the path is unknown.
2083- func (c * CommitScriptTree ) WitnessScriptForPath (path ScriptPath ,
2084- ) ([]byte , error ) {
2093+ func (c * CommitScriptTree ) WitnessScriptForPath (
2094+ path ScriptPath ) ([]byte , error ) {
20852095
20862096 switch path {
20872097 // For the commitment output, the delay and success path are the same,
@@ -2099,8 +2109,8 @@ func (c *CommitScriptTree) WitnessScriptForPath(path ScriptPath,
20992109
21002110// CtrlBlockForPath returns the control block for the given spending path. For
21012111// script types that don't have a control block, nil is returned.
2102- func (c * CommitScriptTree ) CtrlBlockForPath (path ScriptPath ,
2103- ) (* txscript.ControlBlock , error ) {
2112+ func (c * CommitScriptTree ) CtrlBlockForPath (
2113+ path ScriptPath ) (* txscript.ControlBlock , error ) {
21042114
21052115 switch path {
21062116 case ScriptPathDelay :
@@ -2120,6 +2130,11 @@ func (c *CommitScriptTree) CtrlBlockForPath(path ScriptPath,
21202130 }
21212131}
21222132
2133+ // Tree returns the underlying ScriptTree of the CommitScriptTree.
2134+ func (c * CommitScriptTree ) Tree () ScriptTree {
2135+ return c .ScriptTree
2136+ }
2137+
21232138// NewLocalCommitScriptTree returns a new CommitScript tree that can be used to
21242139// create and spend the commitment output for the local party.
21252140func NewLocalCommitScriptTree (csvTimeout uint32 ,
@@ -2241,7 +2256,7 @@ func TaprootCommitScriptToSelf(csvTimeout uint32,
22412256 return commitScriptTree .TaprootKey , nil
22422257}
22432258
2244- // MakeTaprootSCtrlBlock takes a leaf script, the internal key (usually the
2259+ // MakeTaprootCtrlBlock takes a leaf script, the internal key (usually the
22452260// revoke key), and a script tree and creates a valid control block for a spend
22462261// of the leaf.
22472262func MakeTaprootCtrlBlock (leafScript []byte , internalKey * btcec.PublicKey ,
@@ -2296,9 +2311,6 @@ func TaprootCommitSpendSuccess(signer Signer, signDesc *SignDescriptor,
22962311 witnessStack [0 ] = maybeAppendSighash (sweepSig , signDesc .HashType )
22972312 witnessStack [1 ] = signDesc .WitnessScript
22982313 witnessStack [2 ] = ctrlBlockBytes
2299- if err != nil {
2300- return nil , err
2301- }
23022314
23032315 return witnessStack , nil
23042316}
@@ -2773,8 +2785,8 @@ type AnchorScriptTree struct {
27732785
27742786// NewAnchorScriptTree makes a new script tree for an anchor output with the
27752787// passed anchor key.
2776- func NewAnchorScriptTree (anchorKey * btcec. PublicKey ,
2777- ) (* AnchorScriptTree , error ) {
2788+ func NewAnchorScriptTree (
2789+ anchorKey * btcec. PublicKey ) (* AnchorScriptTree , error ) {
27782790
27792791 // The main script used is just a OP_16 CSV (anyone can sweep after 16
27802792 // blocks).
@@ -2810,18 +2822,18 @@ func NewAnchorScriptTree(anchorKey *btcec.PublicKey,
28102822 }, nil
28112823}
28122824
2813- // WitnessScript returns the witness script that we'll use when signing for the
2814- // remote party, and also verifying signatures on our transactions. As an
2815- // example, when we create an outgoing HTLC for the remote party, we want to
2825+ // WitnessScriptToSign returns the witness script that we'll use when signing
2826+ // for the remote party, and also verifying signatures on our transactions. As
2827+ // an example, when we create an outgoing HTLC for the remote party, we want to
28162828// sign their success path.
28172829func (a * AnchorScriptTree ) WitnessScriptToSign () []byte {
28182830 return a .SweepLeaf .Script
28192831}
28202832
28212833// WitnessScriptForPath returns the witness script for the given spending path.
28222834// An error is returned if the path is unknown.
2823- func (a * AnchorScriptTree ) WitnessScriptForPath (path ScriptPath ,
2824- ) ([]byte , error ) {
2835+ func (a * AnchorScriptTree ) WitnessScriptForPath (
2836+ path ScriptPath ) ([]byte , error ) {
28252837
28262838 switch path {
28272839 case ScriptPathDelay :
@@ -2836,8 +2848,8 @@ func (a *AnchorScriptTree) WitnessScriptForPath(path ScriptPath,
28362848
28372849// CtrlBlockForPath returns the control block for the given spending path. For
28382850// script types that don't have a control block, nil is returned.
2839- func (a * AnchorScriptTree ) CtrlBlockForPath (path ScriptPath ,
2840- ) (* txscript.ControlBlock , error ) {
2851+ func (a * AnchorScriptTree ) CtrlBlockForPath (
2852+ path ScriptPath ) (* txscript.ControlBlock , error ) {
28412853
28422854 switch path {
28432855 case ScriptPathDelay :
@@ -2853,6 +2865,11 @@ func (a *AnchorScriptTree) CtrlBlockForPath(path ScriptPath,
28532865 }
28542866}
28552867
2868+ // Tree returns the underlying ScriptTree of the AnchorScriptTree.
2869+ func (a * AnchorScriptTree ) Tree () ScriptTree {
2870+ return a .ScriptTree
2871+ }
2872+
28562873// A compile time check to ensure AnchorScriptTree implements the
28572874// TapscriptDescriptor interface.
28582875var _ TapscriptDescriptor = (* AnchorScriptTree )(nil )
0 commit comments