close connection if server sends invalid headers
This commit is contained in:
parent
94f7a87e47
commit
311f9eda17
|
@ -830,6 +830,9 @@ class Network(util.DaemonThread):
|
|||
interface.bad_header = header
|
||||
if interface.bad != interface.good + 1:
|
||||
next_height = (interface.bad + interface.good) // 2
|
||||
elif not interface.blockchain.can_connect(interface.bad_header, check_height=False):
|
||||
self.connection_down(interface.server)
|
||||
next_height = None
|
||||
else:
|
||||
branch = self.blockchains.get(interface.bad)
|
||||
if branch is not None:
|
||||
|
@ -853,7 +856,6 @@ class Network(util.DaemonThread):
|
|||
next_height = None
|
||||
if bh > interface.good:
|
||||
if not interface.blockchain.check_header(interface.bad_header):
|
||||
if interface.blockchain.can_connect(interface.bad_header, check_height=False):
|
||||
b = interface.blockchain.fork(interface.bad_header)
|
||||
self.blockchains[interface.bad] = b
|
||||
interface.blockchain = b
|
||||
|
|
Loading…
Reference in New Issue