tinterface: "block.headers": nicer error if server uses too low 'max' - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1ee99cf9c457f1fd1a417a3c04d3fe8af9e860a2 DIR parent d906819b03454dde869237873f6b9285828e1905 HTML Author: SomberNight <somber.night@protonmail.com> Date: Thu, 18 Feb 2021 20:40:38 +0100 interface: "block.headers": nicer error if server uses too low 'max' related https://github.com/spesmilo/electrumx/commit/4ff6a9c4f022bcddad9c7f99d6f2f47360fb222d Diffstat: M electrum/interface.py | 3 +++ 1 file changed, 3 insertions(+), 0 deletions(-) --- DIR diff --git a/electrum/interface.py b/electrum/interface.py t@@ -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'])