66 "github.com/btcsuite/btcd/btcutil"
77 "github.com/btcsuite/btcd/txscript"
88 "github.com/btcsuite/btcd/wire"
9+ "github.com/lightningnetwork/lnd/fn"
910 "github.com/lightningnetwork/lnd/lntypes"
11+ "github.com/lightningnetwork/lnd/tlv"
1012)
1113
1214// EmptyOutPoint is a zeroed outpoint.
@@ -63,6 +65,10 @@ type Input interface {
6365 // UnconfParent returns information about a possibly unconfirmed parent
6466 // tx.
6567 UnconfParent () * TxInfo
68+
69+ // ResolutionBlob returns a special opaque blob to be used to
70+ // sweep/resolve this input.
71+ ResolutionBlob () fn.Option [tlv.Blob ]
6672}
6773
6874// TxInfo describes properties of a parent tx that are relevant for CPFP.
@@ -106,6 +112,8 @@ type inputKit struct {
106112 // unconfParent contains information about a potential unconfirmed
107113 // parent transaction.
108114 unconfParent * TxInfo
115+
116+ resolutionBlob fn.Option [tlv.Blob ]
109117}
110118
111119// OutPoint returns the breached output's identifier that is to be included as
@@ -156,18 +164,36 @@ func (i *inputKit) UnconfParent() *TxInfo {
156164 return i .unconfParent
157165}
158166
159- // inputOpts holds options for the input.
167+ // ResolutionBlob returns a special opaque blob to be used to sweep/resolve
168+ // this input.
169+ func (i * inputKit ) ResolutionBlob () fn.Option [tlv.Blob ] {
170+ return i .resolutionBlob
171+ }
172+
173+ // inputOpts contains options for constructing a new input.
160174type inputOpts struct {
175+ // resolutionBlob is an optional blob that can be used to resolve an
176+ // input.
177+ resolutionBlob fn.Option [tlv.Blob ]
161178}
162179
163180// defaultInputOpts returns a new inputOpts with default values.
164181func defaultInputOpts () * inputOpts {
165182 return & inputOpts {}
166183}
167184
168- // InputOpt is a functional option argument to the input constructor.
185+ // InputOpt is a functional option that can be used to modify the default input
186+ // options.
169187type InputOpt func (* inputOpts ) //nolint:revive
170188
189+ // WithResolutionBlob is an option that can be used to set a resolution blob on
190+ // for an input.
191+ func WithResolutionBlob (b fn.Option [tlv.Blob ]) InputOpt {
192+ return func (o * inputOpts ) {
193+ o .resolutionBlob = b
194+ }
195+ }
196+
171197// BaseInput contains all the information needed to sweep a basic
172198// output (CSV/CLTV/no time lock).
173199type BaseInput struct {
@@ -187,11 +213,12 @@ func MakeBaseInput(outpoint *wire.OutPoint, witnessType WitnessType,
187213
188214 return BaseInput {
189215 inputKit {
190- outpoint : * outpoint ,
191- witnessType : witnessType ,
192- signDesc : * signDescriptor ,
193- heightHint : heightHint ,
194- unconfParent : unconfParent ,
216+ outpoint : * outpoint ,
217+ witnessType : witnessType ,
218+ signDesc : * signDescriptor ,
219+ heightHint : heightHint ,
220+ unconfParent : unconfParent ,
221+ resolutionBlob : opt .resolutionBlob ,
195222 },
196223 }
197224}
0 commit comments