Skip to content

Commit 655cbe3

Browse files
committed
f drop Channel::block_disconnected
1 parent 25c0a7d commit 655cbe3

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

lightning/src/ln/channel.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
use bitcoin::blockdata::block::BlockHeader;
1110
use bitcoin::blockdata::script::{Script,Builder};
1211
use bitcoin::blockdata::transaction::{TxIn, TxOut, Transaction, SigHashType};
1312
use bitcoin::blockdata::opcodes;
@@ -3625,16 +3624,6 @@ impl<Signer: Sign> Channel<Signer> {
36253624
Ok((None, timed_out_htlcs))
36263625
}
36273626

3628-
/// Called by channelmanager based on chain blocks being disconnected.
3629-
/// Returns true if we need to close the channel now due to funding transaction
3630-
/// unconfirmation/reorg.
3631-
pub fn block_disconnected(&mut self, header: &BlockHeader, new_height: u32) -> bool {
3632-
if self.update_best_block(new_height, header.time).is_err() {
3633-
return true;
3634-
}
3635-
false
3636-
}
3637-
36383627
// Methods to get unprompted messages to send to the remote end (or where we already returned
36393628
// something in the handler for the message that prompted this message):
36403629

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3390,7 +3390,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
33903390
let short_to_id = &mut channel_state.short_to_id;
33913391
let pending_msg_events = &mut channel_state.pending_msg_events;
33923392
channel_state.by_id.retain(|_, v| {
3393-
if v.block_disconnected(header, new_height) {
3393+
if let Err(err_msg) = v.update_best_block(new_height, header.time) {
33943394
if let Some(short_id) = v.get_short_channel_id() {
33953395
short_to_id.remove(&short_id);
33963396
}
@@ -3400,6 +3400,10 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34003400
msg: update
34013401
});
34023402
}
3403+
pending_msg_events.push(events::MessageSendEvent::HandleError {
3404+
node_id: v.get_counterparty_node_id(),
3405+
action: msgs::ErrorAction::SendErrorMessage { msg: err_msg },
3406+
});
34033407
false
34043408
} else {
34053409
true

0 commit comments

Comments
 (0)