Skip to content

Commit 1c8ef1b

Browse files
committed
f missing calls in tick
1 parent c446ae5 commit 1c8ef1b

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

lightning/src/ln/channel.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5489,7 +5489,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
54895489
/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.
54905490
pub(super) struct OutboundV1Channel<Signer: ChannelSigner> {
54915491
pub context: ChannelContext<Signer>,
5492-
pub pending_context: UnfundedChannelContext,
5492+
pub unfunded_context: UnfundedChannelContext,
54935493
}
54945494

54955495
impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
@@ -5687,7 +5687,7 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
56875687

56885688
blocked_monitor_updates: Vec::new(),
56895689
},
5690-
pending_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 }
5690+
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 }
56915691
})
56925692
}
56935693

@@ -5986,7 +5986,7 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
59865986
/// A not-yet-funded inbound (from counterparty) channel using V1 channel establishment.
59875987
pub(super) struct InboundV1Channel<Signer: ChannelSigner> {
59885988
pub context: ChannelContext<Signer>,
5989-
pub pending_context: UnfundedChannelContext,
5989+
pub unfunded_context: UnfundedChannelContext,
59905990
}
59915991

59925992
impl<Signer: WriteableEcdsaChannelSigner> InboundV1Channel<Signer> {
@@ -6315,7 +6315,7 @@ impl<Signer: WriteableEcdsaChannelSigner> InboundV1Channel<Signer> {
63156315

63166316
blocked_monitor_updates: Vec::new(),
63176317
},
6318-
pending_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 }
6318+
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 }
63196319
};
63206320

63216321
Ok(chan)

lightning/src/ln/channelmanager.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ use core::ops::Deref;
8080
pub use crate::ln::outbound_payment::{PaymentSendFailure, Retry, RetryableSendFailure, RecipientOnionFields};
8181
use crate::ln::script::ShutdownScript;
8282

83+
use super::channel::UnfundedChannelContext;
84+
8385
// We hold various information about HTLC relay in the HTLC objects in Channel itself:
8486
//
8587
// Upon receipt of an HTLC from a peer, we'll give it a PendingHTLCStatus indicating if it should
@@ -4410,26 +4412,24 @@ where
44104412
true
44114413
});
44124414

4413-
let force_close_expired_unfunded_channel = |chan_id: &[u8; 32], chan_context: &mut ChannelContext<<SP::Target as SignerProvider>::Signer>| {
4414-
log_error!(self.logger, "Force-closing pending outbound channel {} for not establishing in a timely manner", log_bytes!(&chan_id[..]));
4415-
self.issue_channel_close_events(&chan_context, ClosureReason::HolderForceClosed);
4416-
self.finish_force_close_channel(chan_context.force_shutdown(false));
4417-
false
4418-
};
4419-
peer_state.outbound_v1_channel_by_id.retain(|chan_id, chan| {
4420-
if chan.pending_context.should_expire_unfunded_channel() {
4421-
force_close_expired_unfunded_channel(chan_id, &mut chan.context)
4415+
let process_unfunded_channel_tick = |
4416+
chan_id: &[u8; 32],
4417+
chan_context: &mut ChannelContext<<SP::Target as SignerProvider>::Signer>,
4418+
unfunded_chan_context: &mut UnfundedChannelContext,
4419+
| {
4420+
chan_context.maybe_expire_prev_config();
4421+
if unfunded_chan_context.should_expire_unfunded_channel() {
4422+
log_error!(self.logger, "Force-closing pending outbound channel {} for not establishing in a timely manner", log_bytes!(&chan_id[..]));
4423+
update_maps_on_chan_removal!(self, &chan_context);
4424+
self.issue_channel_close_events(&chan_context, ClosureReason::HolderForceClosed);
4425+
self.finish_force_close_channel(chan_context.force_shutdown(false));
4426+
false
44224427
} else {
44234428
true
44244429
}
4425-
});
4426-
peer_state.inbound_v1_channel_by_id.retain(|chan_id, chan| {
4427-
if chan.pending_context.should_expire_unfunded_channel() {
4428-
force_close_expired_unfunded_channel(chan_id, &mut chan.context)
4429-
} else {
4430-
true
4431-
}
4432-
});
4430+
};
4431+
peer_state.outbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context));
4432+
peer_state.inbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context));
44334433

44344434
if peer_state.ok_to_remove(true) {
44354435
pending_peers_awaiting_removal.push(counterparty_node_id);

0 commit comments

Comments
 (0)