Skip to content

Commit d439f1b

Browse files
committed
Handle event_queue push failure in ChannelClosed.
1 parent 2d9d385 commit d439f1b

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/event.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,17 +1204,18 @@ where
12041204
..
12051205
} => {
12061206
log_info!(self.logger, "Channel {} closed due to: {}", channel_id, reason);
1207-
self.event_queue
1208-
.add_event(Event::ChannelClosed {
1209-
channel_id,
1210-
user_channel_id: UserChannelId(user_channel_id),
1211-
counterparty_node_id,
1212-
reason: Some(reason),
1213-
})
1214-
.unwrap_or_else(|e| {
1207+
match self.event_queue.add_event(Event::ChannelClosed {
1208+
channel_id,
1209+
user_channel_id: UserChannelId(user_channel_id),
1210+
counterparty_node_id,
1211+
reason: Some(reason),
1212+
}) {
1213+
Ok(_) => {},
1214+
Err(e) => {
12151215
log_error!(self.logger, "Failed to push to event queue: {}", e);
1216-
panic!("Failed to push to event queue");
1217-
});
1216+
return Err(ReplayEvent());
1217+
},
1218+
};
12181219
},
12191220
LdkEvent::DiscardFunding { .. } => {},
12201221
LdkEvent::HTLCIntercepted { .. } => {},

0 commit comments

Comments
 (0)