From bf25d765d93da2176b85aa293326586b166b7f6e Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 9 Oct 2018 15:35:42 +0200 Subject: [PATCH] simplify ChannelDB.on_channel_update --- electrum/lnbase.py | 1 + electrum/lnrouter.py | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/electrum/lnbase.py b/electrum/lnbase.py index 3e75a0257..3bc74c0e9 100644 --- a/electrum/lnbase.py +++ b/electrum/lnbase.py @@ -816,6 +816,7 @@ class Peer(PrintError): per_commitment_secret_index = RevocationStore.START_INDEX - 1 per_commitment_point_second = secret_to_pubkey(int.from_bytes( get_per_commitment_secret_from_seed(chan.local_state.per_commitment_secret_seed, per_commitment_secret_index), 'big')) + # note: if funding_locked was not yet received, we might send it multiple times self.send_message(gen_msg("funding_locked", channel_id=channel_id, next_per_commitment_point=per_commitment_point_second)) if chan.local_state.funding_locked_received: self.mark_open(chan) diff --git a/electrum/lnrouter.py b/electrum/lnrouter.py index e9e72f292..c1afd3aeb 100644 --- a/electrum/lnrouter.py +++ b/electrum/lnrouter.py @@ -393,14 +393,10 @@ class ChannelDB(JsonDB): short_channel_id = msg_payload['short_channel_id'] if constants.net.rev_genesis_bytes() != msg_payload['chain_hash']: return - # try finding channel in verified db - channel_info = self._id_to_channel_info.get(short_channel_id, None) + # try finding channel in pending db + channel_info = self.ca_verifier.get_pending_channel_info(short_channel_id) if channel_info is None: - # try finding channel in pending db - channel_info = self.ca_verifier.get_pending_channel_info(short_channel_id) - if channel_info is None: - # try finding channel in verified db, again - # (maybe this is redundant but this should prevent a race..) + # try finding channel in verified db channel_info = self._id_to_channel_info.get(short_channel_id, None) if channel_info is None: self.print_error("could not find", short_channel_id)