From 0d05b84dc3234791d73f6aa098d7d799910943b4 Mon Sep 17 00:00:00 2001 From: ghost43 Date: Sun, 29 Jul 2018 03:56:10 +0200 Subject: [PATCH] network: handle reorg (sooner) in case of multiple forks at given height (#4537) --- electrum/network.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/electrum/network.py b/electrum/network.py index 5b8a2c869..86e48cc52 100644 --- a/electrum/network.py +++ b/electrum/network.py @@ -897,6 +897,7 @@ class Network(util.DaemonThread): self.connection_down(interface.server) return height = header.get('block_height') + #interface.print_error('got header', height, blockchain.hash_header(header)) if interface.request != height: interface.print_error("unsolicited header",interface.request, height) self.connection_down(interface.server) @@ -952,7 +953,7 @@ class Network(util.DaemonThread): elif branch.parent().check_header(header): interface.print_error('reorg', interface.bad, interface.tip) interface.blockchain = branch.parent() - next_height = None + next_height = interface.bad else: interface.print_error('checkpoint conflicts with existing fork', branch.path()) branch.write(b'', 0) @@ -1086,6 +1087,7 @@ class Network(util.DaemonThread): except InvalidHeader: self.connection_down(interface.server) return + #interface.print_error('notified of header', height, blockchain.hash_header(header)) if height < self.max_checkpoint(): self.connection_down(interface.server) return