File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -538,6 +538,15 @@ impl SpendableOutputDescriptor {
538538 } ;
539539 Ok ( ( psbt, expected_max_weight) )
540540 }
541+
542+ /// Returns the outpoint of the spendable output.
543+ pub fn outpoint ( & self ) -> OutPoint {
544+ match self {
545+ Self :: StaticOutput { outpoint, .. } => * outpoint,
546+ Self :: StaticPaymentOutput ( descriptor) => descriptor. outpoint ,
547+ Self :: DelayedPaymentOutput ( descriptor) => descriptor. outpoint ,
548+ }
549+ }
541550}
542551
543552/// The parameters required to derive a channel signer via [`SignerProvider`].
Original file line number Diff line number Diff line change @@ -71,13 +71,7 @@ impl TrackedSpendableOutput {
7171
7272 /// Returns whether the output is spent in the given transaction.
7373 pub fn is_spent_in ( & self , tx : & Transaction ) -> bool {
74- let prev_outpoint = match & self . descriptor {
75- SpendableOutputDescriptor :: StaticOutput { outpoint, .. } => * outpoint,
76- SpendableOutputDescriptor :: DelayedPaymentOutput ( output) => output. outpoint ,
77- SpendableOutputDescriptor :: StaticPaymentOutput ( output) => output. outpoint ,
78- }
79- . into_bitcoin_outpoint ( ) ;
80-
74+ let prev_outpoint = self . descriptor . outpoint ( ) . into_bitcoin_outpoint ( ) ;
8175 tx. input . iter ( ) . any ( |input| input. previous_output == prev_outpoint)
8276 }
8377}
You can’t perform that action at this time.
0 commit comments