@@ -32,7 +32,7 @@ use bitcoin::secp256k1::Secp256k1;
32
32
use bitcoin::secp256k1::{PublicKey, SecretKey};
33
33
#[cfg(splicing)]
34
34
use bitcoin::ScriptBuf;
35
- use bitcoin::{secp256k1, Sequence, SignedAmount, Weight };
35
+ use bitcoin::{secp256k1, Sequence, SignedAmount};
36
36
37
37
use crate::blinded_path::message::MessageForwardNode;
38
38
use crate::blinded_path::message::{AsyncPaymentsContext, OffersContext};
@@ -51,7 +51,6 @@ use crate::chain::channelmonitor::{
51
51
};
52
52
use crate::chain::transaction::{OutPoint, TransactionData};
53
53
use crate::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm, Watch};
54
- use crate::events::bump_transaction::{Utxo, EMPTY_SCRIPT_SIG_WEIGHT};
55
54
use crate::events::{
56
55
self, ClosureReason, Event, EventHandler, EventsProvider, HTLCHandlingFailureType,
57
56
InboundChannelFunds, PaymentFailureReason, ReplayEvent,
@@ -66,6 +65,8 @@ use crate::ln::channel::{
66
65
UpdateFulfillCommitFetch, WithChannelContext,
67
66
};
68
67
use crate::ln::channel_state::ChannelDetails;
68
+ #[cfg(splicing)]
69
+ use crate::ln::funding::FundingTxInput;
69
70
use crate::ln::inbound_payment;
70
71
use crate::ln::interactivetxs::{HandleTxCompleteResult, InteractiveTxMessageSendResult};
71
72
use crate::ln::msgs;
@@ -117,10 +118,7 @@ use crate::routing::router::{
117
118
RouteParameters, RouteParametersConfig, Router,
118
119
};
119
120
use crate::sign::ecdsa::EcdsaChannelSigner;
120
- use crate::sign::{
121
- EntropySource, NodeSigner, Recipient, SignerProvider, P2TR_KEY_PATH_WITNESS_WEIGHT,
122
- P2WPKH_WITNESS_WEIGHT,
123
- };
121
+ use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
124
122
#[cfg(any(feature = "_test_utils", test))]
125
123
use crate::types::features::Bolt11InvoiceFeatures;
126
124
use crate::types::features::{
@@ -204,101 +202,6 @@ pub use crate::ln::outbound_payment::{
204
202
};
205
203
use crate::ln::script::ShutdownScript;
206
204
207
- /// An input to contribute to a channel's funding transaction either when using the v2 channel
208
- /// establishment protocol or when splicing.
209
- #[derive(Clone)]
210
- pub struct FundingTxInput {
211
- /// The unspent [`TxOut`] that the input spends.
212
- ///
213
- /// [`TxOut`]: bitcoin::TxOut
214
- pub(super) utxo: Utxo,
215
-
216
- /// The sequence number to use in the [`TxIn`].
217
- ///
218
- /// [`TxIn`]: bitcoin::TxIn
219
- pub(super) sequence: Sequence,
220
-
221
- /// The transaction containing the unspent [`TxOut`] referenced by [`utxo`].
222
- ///
223
- /// [`TxOut`]: bitcoin::TxOut
224
- /// [`utxo`]: Self::utxo
225
- pub(super) prevtx: Transaction,
226
- }
227
-
228
- impl FundingTxInput {
229
- fn new<F: FnOnce(&bitcoin::Script) -> bool>(
230
- prevtx: Transaction, vout: u32, sequence: Sequence, witness_weight: Weight,
231
- script_filter: F,
232
- ) -> Result<Self, ()> {
233
- Ok(FundingTxInput {
234
- utxo: Utxo {
235
- outpoint: bitcoin::OutPoint { txid: prevtx.compute_txid(), vout },
236
- output: prevtx
237
- .output
238
- .get(vout as usize)
239
- .filter(|output| script_filter(&output.script_pubkey))
240
- .ok_or(())?
241
- .clone(),
242
- satisfaction_weight: EMPTY_SCRIPT_SIG_WEIGHT + witness_weight.to_wu(),
243
- },
244
- sequence,
245
- prevtx,
246
- })
247
- }
248
-
249
- /// Creates an input spending a P2WPKH output from the given `prevtx` at index `vout` using the
250
- /// provided `sequence` number.
251
- ///
252
- /// Returns `Err` if no such output exists in `prevtx` at index `vout`.
253
- pub fn new_p2wpkh(prevtx: Transaction, vout: u32, sequence: Sequence) -> Result<Self, ()> {
254
- let witness_weight = Weight::from_wu(P2WPKH_WITNESS_WEIGHT);
255
- FundingTxInput::new(prevtx, vout, sequence, witness_weight, bitcoin::Script::is_p2wpkh)
256
- }
257
-
258
- /// Creates an input spending a P2WSH output from the given `prevtx` at index `vout` using the
259
- /// provided `sequence` number.
260
- ///
261
- /// Requires passing the weight of witness needed to satisfy the output's script.
262
- ///
263
- /// Returns `Err` if no such output exists in `prevtx` at index `vout`.
264
- pub fn new_p2wsh(
265
- prevtx: Transaction, vout: u32, sequence: Sequence, witness_weight: Weight,
266
- ) -> Result<Self, ()> {
267
- FundingTxInput::new(prevtx, vout, sequence, witness_weight, bitcoin::Script::is_p2wsh)
268
- }
269
-
270
- /// Creates an input spending a P2TR output from the given `prevtx` at index `vout` using the
271
- /// provided `sequence` number.
272
- ///
273
- /// This is meant for inputs spending a taproot output using the key path. See
274
- /// [`new_p2tr_script_spend`] for when spending using a script path.
275
- ///
276
- /// Returns `Err` if no such output exists in `prevtx` at index `vout`.
277
- ///
278
- /// [`new_p2tr_script_spend`]: Self::new_p2tr_script_spend
279
- pub fn new_p2tr_key_spend(
280
- prevtx: Transaction, vout: u32, sequence: Sequence,
281
- ) -> Result<Self, ()> {
282
- let witness_weight = Weight::from_wu(P2TR_KEY_PATH_WITNESS_WEIGHT);
283
- FundingTxInput::new(prevtx, vout, sequence, witness_weight, bitcoin::Script::is_p2tr)
284
- }
285
-
286
- /// Creates an input spending a P2TR output from the given `prevtx` at index `vout` using the
287
- /// provided `sequence` number.
288
- ///
289
- /// Requires passing the weight of witness needed to satisfy a script path of the taproot
290
- /// output. See [`new_p2tr_key_spend`] for when spending using the key path.
291
- ///
292
- /// Returns `Err` if no such output exists in `prevtx` at index `vout`.
293
- ///
294
- /// [`new_p2tr_key_spend`]: Self::new_p2tr_key_spend
295
- pub fn new_p2tr_script_spend(
296
- prevtx: Transaction, vout: u32, sequence: Sequence, witness_weight: Weight,
297
- ) -> Result<Self, ()> {
298
- FundingTxInput::new(prevtx, vout, sequence, witness_weight, bitcoin::Script::is_p2tr)
299
- }
300
- }
301
-
302
205
// We hold various information about HTLC relay in the HTLC objects in Channel itself:
303
206
//
304
207
// Upon receipt of an HTLC from a peer, we'll give it a PendingHTLCStatus indicating if it should
0 commit comments