@@ -938,14 +938,21 @@ class Interface(Logger):
|
||||
res = await self.session.send_request('blockchain.scripthash.get_history', [sh])
|
||||
# check response
|
||||
assert_list_or_tuple(res)
|
||||
prev_height = 1
|
||||
for tx_item in res:
|
||||
assert_dict_contains_field(tx_item, field_name='height')
|
||||
height = assert_dict_contains_field(tx_item, field_name='height')
|
||||
assert_dict_contains_field(tx_item, field_name='tx_hash')
|
||||
assert_integer(tx_item['height'])
|
||||
assert_integer(height)
|
||||
assert_hash256_str(tx_item['tx_hash'])
|
||||
if tx_item['height'] in (-1, 0):
|
||||
if height in (-1, 0):
|
||||
assert_dict_contains_field(tx_item, field_name='fee')
|
||||
assert_non_negative_integer(tx_item['fee'])
|
||||
prev_height = - float("inf") # this ensures confirmed txs can't follow mempool txs
|
||||
else:
|
||||
# check monotonicity of heights
|
||||
if height < prev_height:
|
||||
raise RequestCorrupted(f'heights of confirmed txs must be in increasing order')
|
||||
prev_height = height
|
||||
return res
|
||||
|
||||
async def listunspent_for_scripthash(self, sh: str) -> List[dict]:
|
||||
|
||||
Reference in New Issue
Block a user