Skip to content

Commit c8f981c

Browse files
committed
f create event within channelmanager and not channel
1 parent 0995cb1 commit c8f981c

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::chain::channelmonitor::{
3535
use crate::chain::transaction::{OutPoint, TransactionData};
3636
use crate::chain::BestBlock;
3737
use crate::events::bump_transaction::BASE_INPUT_WEIGHT;
38-
use crate::events::{ClosureReason, Event};
38+
use crate::events::ClosureReason;
3939
use crate::ln::chan_utils;
4040
#[cfg(splicing)]
4141
use crate::ln::chan_utils::FUNDING_TRANSACTION_WITNESS_WEIGHT;
@@ -1763,7 +1763,7 @@ where
17631763

17641764
pub fn funding_tx_constructed<L: Deref>(
17651765
&mut self, signing_session: InteractiveTxSigningSession, logger: &L,
1766-
) -> Result<(msgs::CommitmentSigned, Option<Event>), ChannelError>
1766+
) -> Result<(msgs::CommitmentSigned, Option<Transaction>), ChannelError>
17671767
where
17681768
L::Target: Logger,
17691769
{
@@ -2925,7 +2925,7 @@ where
29252925
#[rustfmt::skip]
29262926
pub fn funding_tx_constructed<L: Deref>(
29272927
&mut self, mut signing_session: InteractiveTxSigningSession, logger: &L
2928-
) -> Result<(msgs::CommitmentSigned, Option<Event>), ChannelError>
2928+
) -> Result<(msgs::CommitmentSigned, Option<Transaction>), ChannelError>
29292929
where
29302930
L::Target: Logger
29312931
{
@@ -2967,7 +2967,7 @@ where
29672967
},
29682968
};
29692969

2970-
let funding_ready_for_sig_event_opt = if signing_session.local_inputs_count() == 0 {
2970+
let funding_tx_opt = if signing_session.local_inputs_count() == 0 {
29712971
debug_assert_eq!(our_funding_satoshis, 0);
29722972
if signing_session.provide_holder_witnesses(self.context.channel_id, Vec::new()).is_err() {
29732973
debug_assert!(
@@ -2981,12 +2981,7 @@ where
29812981
}
29822982
None
29832983
} else {
2984-
Some(Event::FundingTransactionReadyForSigning {
2985-
channel_id: self.context.channel_id,
2986-
counterparty_node_id: self.context.counterparty_node_id,
2987-
user_channel_id: self.context.user_id,
2988-
unsigned_transaction: signing_session.unsigned_tx().build_unsigned_tx(),
2989-
})
2984+
Some(signing_session.unsigned_tx().build_unsigned_tx())
29902985
};
29912986

29922987
let mut channel_state = ChannelState::FundingNegotiated(FundingNegotiatedFlags::new());
@@ -2997,7 +2992,7 @@ where
29972992
self.interactive_tx_constructor.take();
29982993
self.interactive_tx_signing_session = Some(signing_session);
29992994

3000-
Ok((commitment_signed, funding_ready_for_sig_event_opt))
2995+
Ok((commitment_signed, funding_tx_opt))
30012996
}
30022997
}
30032998

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9108,13 +9108,19 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
91089108
peer_state.pending_msg_events.push(msg_send_event);
91099109
};
91109110
if let Some(signing_session) = signing_session_opt {
9111-
let (commitment_signed, funding_ready_for_sig_event_opt) = chan_entry
9111+
let (commitment_signed, funding_tx_opt) = chan_entry
91129112
.get_mut()
91139113
.funding_tx_constructed(signing_session, &self.logger)
91149114
.map_err(|err| MsgHandleErrInternal::send_err_msg_no_close(format!("{}", err), msg.channel_id))?;
9115-
if let Some(funding_ready_for_sig_event) = funding_ready_for_sig_event_opt {
9115+
if let Some(unsigned_transaction) = funding_tx_opt {
91169116
let mut pending_events = self.pending_events.lock().unwrap();
9117-
pending_events.push_back((funding_ready_for_sig_event, None));
9117+
pending_events.push_back((
9118+
Event::FundingTransactionReadyForSigning {
9119+
unsigned_transaction,
9120+
counterparty_node_id,
9121+
channel_id: msg.channel_id,
9122+
user_channel_id: chan_entry.get().context().get_user_id(),
9123+
}, None));
91189124
}
91199125
peer_state.pending_msg_events.push(MessageSendEvent::UpdateHTLCs {
91209126
node_id: counterparty_node_id,

0 commit comments

Comments
 (0)