Browse Source

fix: handle multiple forks at same checkpoint

2.9.x
ThomasV 8 years ago
parent
commit
d5d5e8af5c
  1. 12
      lib/network.py

12
lib/network.py

@ -835,13 +835,19 @@ class Network(util.DaemonThread):
if branch is not None: if branch is not None:
if branch.check_header(interface.bad_header): if branch.check_header(interface.bad_header):
interface.print_error('joining chain', interface.bad) interface.print_error('joining chain', interface.bad)
next_height = None
elif branch.parent().check_header(header): elif branch.parent().check_header(header):
interface.print_error('reorg', interface.bad, interface.tip) interface.print_error('reorg', interface.bad, interface.tip)
interface.blockchain = branch.parent() interface.blockchain = branch.parent()
next_height = None
else: else:
# should not happen interface.print_error('checkpoint conflicts with existing fork', branch.path())
raise BaseException('error') open(branch.path(), 'w+').close()
next_height = None branch.save_header(interface.bad_header)
interface.mode = 'catch_up'
interface.blockchain = branch
next_height = interface.bad + 1
interface.blockchain.catch_up = interface.server
else: else:
bh = interface.blockchain.height() bh = interface.blockchain.height()
next_height = None next_height = None

Loading…
Cancel
Save