commit 5481fd8af692b7e24b4e904b115ea6a1f80e6a0b
parent 25d4a40d6e635bb024c047ffd1ce6810961eab1a
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 26 Oct 2020 02:07:30 +0100
interface: validate field order in "mempool.get_fee_histogram" response
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -993,9 +993,13 @@ class Interface(Logger):
res = await self.session.send_request('mempool.get_fee_histogram')
# check response
assert_list_or_tuple(res)
+ prev_fee = float('inf')
for fee, s in res:
assert_non_negative_int_or_float(fee)
assert_non_negative_integer(s)
+ if fee >= prev_fee: # check monotonicity
+ raise RequestCorrupted(f'fees must be in decreasing order')
+ prev_fee = fee
return res
async def get_server_banner(self) -> str: