Skip to content

Commit f386285

Browse files
committed
f funding time-out event reason
1 parent 4a69dbf commit f386285

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4168,10 +4168,10 @@ impl<Signer: Sign> Channel<Signer> {
41684168
// If funding_tx_confirmed_in is unset, the channel must not be active
41694169
assert!(non_shutdown_state <= ChannelState::ChannelFunded as u32);
41704170
assert_eq!(non_shutdown_state & ChannelState::OurFundingLocked as u32, 0);
4171-
return Err(msgs::ErrorMessage {
4171+
return Err((msgs::ErrorMessage {
41724172
channel_id: self.channel_id(),
41734173
data: format!("Funding transaction failed to confirm within {} blocks", FUNDING_CONF_DEADLINE_BLOCKS),
4174-
});
4174+
}, ClosureReason::FundingTimedOut));
41754175
}
41764176

41774177
Ok((None, timed_out_htlcs))

lightning/src/ln/functional_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8195,6 +8195,7 @@ fn test_channel_conf_timeout() {
81958195

81968196
connect_blocks(&nodes[1], 1);
81978197
check_added_monitors!(nodes[1], 1);
8198+
check_closed_event!(nodes[1], 1, ClosureReason::FundingTimedOut);
81988199
let close_ev = nodes[1].node.get_and_clear_pending_msg_events();
81998200
assert_eq!(close_ev.len(), 1);
82008201
match close_ev[0] {

lightning/src/util/events.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ pub enum ClosureReason {
9797
/// commitment transaction came from our counterparty, but it may also have come from
9898
/// a copy of our own `ChannelMonitor`.
9999
CommitmentTxConfirmed,
100+
/// The commitment transaction failed to confirm in a timely manner on an inbound channel.
101+
FundingTimedOut,
100102
/// Closure generated from processing an event, likely a HTLC forward/relay/reception.
101103
ProcessingError {
102104
/// A developer-readable error message which we generated.
@@ -116,6 +118,7 @@ pub enum ClosureReason {
116118

117119
impl_writeable_tlv_based_enum_upgradable!(ClosureReason,
118120
(0, CounterpartyForceClosed) => { (1, peer_msg, required) },
121+
(1, FundingTimedOut) => {},
119122
(2, HolderForceClosed) => {},
120123
(6, CommitmentTxConfirmed) => {},
121124
(4, CooperativeClosure) => {},

0 commit comments

Comments
 (0)