@@ -16,6 +16,7 @@ use core::ops::Deref;
16
16
use crate :: chain:: chaininterface:: BroadcasterInterface ;
17
17
use crate :: chain:: ClaimId ;
18
18
use crate :: io_extras:: sink;
19
+ use crate :: ln:: channel:: ANCHOR_OUTPUT_VALUE_SATOSHI ;
19
20
use crate :: ln:: chan_utils;
20
21
use crate :: ln:: chan_utils:: {
21
22
ANCHOR_INPUT_WITNESS_WEIGHT , HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT ,
@@ -74,6 +75,15 @@ pub struct AnchorDescriptor {
74
75
}
75
76
76
77
impl AnchorDescriptor {
78
+ /// Returns the UTXO to be spent by the anchor input, which can be obtained via
79
+ /// [`Self::unsigned_tx_input`].
80
+ pub fn spending_utxo ( & self ) -> TxOut {
81
+ TxOut {
82
+ script_pubkey : self . witness_script ( ) . to_v0_p2wsh ( ) ,
83
+ value : ANCHOR_OUTPUT_VALUE_SATOSHI ,
84
+ }
85
+ }
86
+
77
87
/// Returns the unsigned transaction input spending the anchor output in the commitment
78
88
/// transaction.
79
89
pub fn unsigned_tx_input ( & self ) -> TxIn {
@@ -134,6 +144,15 @@ pub struct HTLCDescriptor {
134
144
}
135
145
136
146
impl HTLCDescriptor {
147
+ /// Returns the UTXO to be spent by the HTLC input, which can be obtained via
148
+ /// [`Self::unsigned_tx_input`].
149
+ pub fn spending_utxo < C : secp256k1:: Signing + secp256k1:: Verification > ( & self , secp : & Secp256k1 < C > ) -> TxOut {
150
+ TxOut {
151
+ script_pubkey : self . witness_script ( secp) . to_v0_p2wsh ( ) ,
152
+ value : self . htlc . amount_msat / 1000 ,
153
+ }
154
+ }
155
+
137
156
/// Returns the unsigned transaction input spending the HTLC output in the commitment
138
157
/// transaction.
139
158
pub fn unsigned_tx_input ( & self ) -> TxIn {
0 commit comments