Browse Source
network: handle reorg (sooner) in case of multiple forks at given height (#4537)
3.2.x
ghost43
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
1 deletions
-
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 |
|
|
|