mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
interface: validate field order in "mempool.get_fee_histogram" response
This commit is contained in:
parent
25d4a40d6e
commit
5481fd8af6
1 changed files with 4 additions and 0 deletions
|
@ -993,9 +993,13 @@ class Interface(Logger):
|
||||||
res = await self.session.send_request('mempool.get_fee_histogram')
|
res = await self.session.send_request('mempool.get_fee_histogram')
|
||||||
# check response
|
# check response
|
||||||
assert_list_or_tuple(res)
|
assert_list_or_tuple(res)
|
||||||
|
prev_fee = float('inf')
|
||||||
for fee, s in res:
|
for fee, s in res:
|
||||||
assert_non_negative_int_or_float(fee)
|
assert_non_negative_int_or_float(fee)
|
||||||
assert_non_negative_integer(s)
|
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
|
return res
|
||||||
|
|
||||||
async def get_server_banner(self) -> str:
|
async def get_server_banner(self) -> str:
|
||||||
|
|
Loading…
Add table
Reference in a new issue