@@ -31,8 +31,9 @@ use crate::types::payment::{PaymentPreimage, PaymentHash};
3131use crate::types::features::{ChannelTypeFeatures, InitFeatures};
3232use crate::ln::interactivetxs::{
3333 ConstructedTransaction, estimate_input_weight, get_output_weight,
34- HandleTxCompleteResult, InteractiveTxConstructor, InteractiveTxConstructorArgs,
35- InteractiveTxSigningSession, InteractiveTxMessageSendResult, TX_COMMON_FIELDS_WEIGHT,
34+ HandleTxCompleteValue, HandleTxCompleteResult, InteractiveTxConstructor,
35+ InteractiveTxConstructorArgs, InteractiveTxSigningSession, InteractiveTxMessageSendResult,
36+ TX_COMMON_FIELDS_WEIGHT,
3637};
3738use crate::ln::msgs;
3839use crate::ln::msgs::{ClosingSigned, ClosingSignedFeeRange, DecodeError};
@@ -1726,8 +1727,16 @@ pub(super) trait InteractivelyFunded<SP: Deref> where SP::Target: SignerProvider
17261727
17271728 fn tx_complete(&mut self, msg: &msgs::TxComplete) -> HandleTxCompleteResult {
17281729 HandleTxCompleteResult(match self.interactive_tx_constructor_mut() {
1729- Some(ref mut tx_constructor) => tx_constructor.handle_tx_complete(msg).map_err(
1730- |reason| reason.into_tx_abort_msg(self.context().channel_id())),
1730+ Some(ref mut tx_constructor) => tx_constructor.handle_tx_complete(msg)
1731+ // TODO: Change this to Result::inspect when MSRV >= 1.76
1732+ // See: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect
1733+ .map(|tx_complete_value| {
1734+ if let HandleTxCompleteValue::SendTxComplete(_, ref signing_session) = tx_complete_value {
1735+ self.context_mut().next_funding_txid = Some(signing_session.unsigned_tx.txid());
1736+ }
1737+ tx_complete_value
1738+ })
1739+ .map_err(|reason| reason.into_tx_abort_msg(self.context().channel_id())),
17311740 None => Err(msgs::TxAbort {
17321741 channel_id: self.context().channel_id(),
17331742 data: b"No interactive transaction negotiation in progress".to_vec()
@@ -4672,14 +4681,6 @@ impl<SP: Deref> Channel<SP> where
46724681 self.context.channel_state.clear_waiting_for_batch();
46734682 }
46744683
4675- pub fn set_next_funding_txid(&mut self, txid: &Txid) {
4676- self.context.next_funding_txid = Some(*txid);
4677- }
4678-
4679- pub fn clear_next_funding_txid(&mut self) {
4680- self.context.next_funding_txid = None;
4681- }
4682-
46834684 /// Unsets the existing funding information.
46844685 ///
46854686 /// This must only be used if the channel has not yet completed funding and has not been used.
@@ -5701,6 +5702,8 @@ impl<SP: Deref> Channel<SP> where
57015702 }
57025703 self.context.funding_transaction = funding_tx_opt.clone();
57035704
5705+ self.context.next_funding_txid = None;
5706+
57045707 // Clear out the signing session
57055708 self.interactive_tx_signing_session = None;
57065709
0 commit comments