Browse Source

interface: "block.headers": nicer error if server uses too low 'max'

related 4ff6a9c4f0
patch-4
SomberNight 4 years ago
parent
commit
1ee99cf9c4
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 3
      electrum/interface.py

3
electrum/interface.py

@ -608,6 +608,9 @@ class Interface(Logger):
assert_hex_str(res['hex'])
if len(res['hex']) != HEADER_SIZE * 2 * res['count']:
raise RequestCorrupted('inconsistent chunk hex and count')
# we never request more than 2016 headers, but we enforce those fit in a single response
if res['max'] < 2016:
raise RequestCorrupted(f"server uses too low 'max' count for block.headers: {res['max']} < 2016")
if res['count'] != size:
raise RequestCorrupted(f"expected {size} headers but only got {res['count']}")
conn = self.blockchain.connect_chunk(index, res['hex'])

Loading…
Cancel
Save