@@ -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};
@@ -8390,7 +8390,7 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
8390
8390
their_features: &InitFeatures, msg: &msgs::OpenChannelV2,
8391
8391
funding_inputs: Vec<(TxIn, TransactionU16LenLimited)>, user_id: u128, config: &UserConfig,
8392
8392
current_chain_height: u32, logger: &L,
8393
- ) -> Result<InboundV2Channel<SP>, ChannelError>
8393
+ ) -> Result<( InboundV2Channel<SP>, Option<MessageSendEvent>) , ChannelError>
8394
8394
where ES::Target: EntropySource,
8395
8395
F::Target: FeeEstimator,
8396
8396
L::Target: Logger,
@@ -8451,7 +8451,7 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
8451
8451
&context.get_counterparty_pubkeys().revocation_basepoint);
8452
8452
context.channel_id = channel_id;
8453
8453
8454
- let chan = Self {
8454
+ let mut channel = Self {
8455
8455
context,
8456
8456
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 },
8457
8457
dual_funding_context: DualFundingChannelContext {
@@ -8464,7 +8464,34 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
8464
8464
interactive_tx_constructor: None,
8465
8465
};
8466
8466
8467
- Ok(chan)
8467
+ let tx_msg_opt_res = channel.begin_interactive_funding_tx_construction(
8468
+ entropy_source,
8469
+ );
8470
+ let pending_msg_send_event = match tx_msg_opt_res {
8471
+ Ok(tx_msg_opt) => {
8472
+ if let Some(tx_msg) = tx_msg_opt {
8473
+ let msg_send_event = match tx_msg {
8474
+ InteractiveTxMessageSend::TxAddInput(msg) => MessageSendEvent::SendTxAddInput {
8475
+ node_id: channel.context.counterparty_node_id, msg },
8476
+ InteractiveTxMessageSend::TxAddOutput(msg) => MessageSendEvent::SendTxAddOutput {
8477
+ node_id: channel.context.counterparty_node_id, msg },
8478
+ InteractiveTxMessageSend::TxComplete(msg) => MessageSendEvent::SendTxComplete {
8479
+ node_id: channel.context.counterparty_node_id, msg },
8480
+ };
8481
+ Some(msg_send_event)
8482
+ } else {
8483
+ None
8484
+ }
8485
+ },
8486
+ Err(_) => {
8487
+ return Err(ChannelError::Close((
8488
+ "V2 channel rejected due to sender error".into(),
8489
+ ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
8490
+ )));
8491
+ }
8492
+ };
8493
+
8494
+ Ok((channel, pending_msg_send_event))
8468
8495
}
8469
8496
8470
8497
/// Marks an inbound channel as accepted and generates a [`msgs::AcceptChannelV2`] message which
0 commit comments