File tree 2 files changed +10
-7
lines changed
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -538,6 +538,15 @@ impl SpendableOutputDescriptor {
538
538
} ;
539
539
Ok ( ( psbt, expected_max_weight) )
540
540
}
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
+ }
541
550
}
542
551
543
552
/// 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 {
71
71
72
72
/// Returns whether the output is spent in the given transaction.
73
73
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 ( ) ;
81
75
tx. input . iter ( ) . any ( |input| input. previous_output == prev_outpoint)
82
76
}
83
77
}
You can’t perform that action at this time.
0 commit comments