network: handle one-block-long fork
also add fixme about incorrect behaviour in case of a fork height higher than our local chain tip
This commit is contained in:
@@ -912,6 +912,9 @@ class Network(util.DaemonThread):
|
|||||||
next_height = height + 1
|
next_height = height + 1
|
||||||
interface.blockchain.catch_up = interface.server
|
interface.blockchain.catch_up = interface.server
|
||||||
elif chain:
|
elif chain:
|
||||||
|
# FIXME should await "initial chunk download".
|
||||||
|
# binary search will NOT do the correct thing if we don't yet
|
||||||
|
# have all headers up to the fork height
|
||||||
interface.print_error("binary search")
|
interface.print_error("binary search")
|
||||||
interface.mode = 'binary'
|
interface.mode = 'binary'
|
||||||
interface.blockchain = chain
|
interface.blockchain = chain
|
||||||
@@ -973,8 +976,10 @@ class Network(util.DaemonThread):
|
|||||||
interface.blockchain = b
|
interface.blockchain = b
|
||||||
interface.print_error("new chain", b.checkpoint)
|
interface.print_error("new chain", b.checkpoint)
|
||||||
interface.mode = 'catch_up'
|
interface.mode = 'catch_up'
|
||||||
next_height = interface.bad + 1
|
maybe_next_height = interface.bad + 1
|
||||||
interface.blockchain.catch_up = interface.server
|
if maybe_next_height <= interface.tip:
|
||||||
|
next_height = maybe_next_height
|
||||||
|
interface.blockchain.catch_up = interface.server
|
||||||
else:
|
else:
|
||||||
assert bh == interface.good
|
assert bh == interface.good
|
||||||
if interface.blockchain.catch_up is None and bh < interface.tip:
|
if interface.blockchain.catch_up is None and bh < interface.tip:
|
||||||
|
|||||||
Reference in New Issue
Block a user