1
0

network: disconnect from server on incorrect header length

fix #4522
This commit is contained in:
SomberNight
2018-07-13 18:11:48 +02:00
parent 87f6aa09df
commit b44aca1654
2 changed files with 10 additions and 3 deletions

View File

@@ -47,6 +47,7 @@ from .interface import Connection, Interface
from . import blockchain
from .version import ELECTRUM_VERSION, PROTOCOL_VERSION
from .i18n import _
from .blockchain import InvalidHeader
NODES_RETRY_INTERVAL = 60
@@ -1075,7 +1076,11 @@ class Network(util.DaemonThread):
# no point in keeping this connection without headers sub
self.connection_down(interface.server)
return
header = blockchain.deserialize_header(util.bfh(header_hex), height)
try:
header = blockchain.deserialize_header(util.bfh(header_hex), height)
except InvalidHeader:
self.connection_down(interface.server)
return
if height < self.max_checkpoint():
self.connection_down(interface.server)
return