@@ -47,7 +47,7 @@ use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, Channel
47
47
use crate::chain::transaction::{OutPoint, TransactionData};
48
48
use crate::sign::ecdsa::EcdsaChannelSigner;
49
49
use crate::sign::{EntropySource, ChannelSigner, SignerProvider, NodeSigner, Recipient};
50
- use crate::events::ClosureReason;
50
+ use crate::events::{ ClosureReason, MessageSendEvent} ;
51
51
use crate::routing::gossip::NodeId;
52
52
use crate::util::ser::{Readable, ReadableArgs, TransactionU16LenLimited, Writeable, Writer};
53
53
use crate::util::logger::{Logger, Record, WithContext};
@@ -8440,7 +8440,7 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
8440
8440
their_features: &InitFeatures, msg: &msgs::OpenChannelV2,
8441
8441
funding_inputs: Vec<(TxIn, TransactionU16LenLimited)>, user_id: u128, config: &UserConfig,
8442
8442
current_chain_height: u32, logger: &L,
8443
- ) -> Result<InboundV2Channel<SP>, ChannelError>
8443
+ ) -> Result<( InboundV2Channel<SP>, Option<MessageSendEvent>) , ChannelError>
8444
8444
where ES::Target: EntropySource,
8445
8445
F::Target: FeeEstimator,
8446
8446
L::Target: Logger,
@@ -8501,7 +8501,7 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
8501
8501
&context.get_counterparty_pubkeys().revocation_basepoint);
8502
8502
context.channel_id = channel_id;
8503
8503
8504
- let chan = Self {
8504
+ let mut channel = Self {
8505
8505
context,
8506
8506
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 },
8507
8507
dual_funding_context: DualFundingChannelContext {
@@ -8514,7 +8514,34 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
8514
8514
interactive_tx_constructor: None,
8515
8515
};
8516
8516
8517
- Ok(chan)
8517
+ let tx_msg_opt_res = channel.begin_interactive_funding_tx_construction(
8518
+ entropy_source,
8519
+ );
8520
+ let pending_msg_send_event = match tx_msg_opt_res {
8521
+ Ok(tx_msg_opt) => {
8522
+ if let Some(tx_msg) = tx_msg_opt {
8523
+ let msg_send_event = match tx_msg {
8524
+ InteractiveTxMessageSend::TxAddInput(msg) => MessageSendEvent::SendTxAddInput {
8525
+ node_id: channel.context.counterparty_node_id, msg },
8526
+ InteractiveTxMessageSend::TxAddOutput(msg) => MessageSendEvent::SendTxAddOutput {
8527
+ node_id: channel.context.counterparty_node_id, msg },
8528
+ InteractiveTxMessageSend::TxComplete(msg) => MessageSendEvent::SendTxComplete {
8529
+ node_id: channel.context.counterparty_node_id, msg },
8530
+ };
8531
+ Some(msg_send_event)
8532
+ } else {
8533
+ None
8534
+ }
8535
+ },
8536
+ Err(_) => {
8537
+ return Err(ChannelError::Close((
8538
+ "V2 channel rejected due to sender error".into(),
8539
+ ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
8540
+ )));
8541
+ }
8542
+ };
8543
+
8544
+ Ok((channel, pending_msg_send_event))
8518
8545
}
8519
8546
8520
8547
/// Marks an inbound channel as accepted and generates a [`msgs::AcceptChannelV2`] message which
0 commit comments