mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +00:00
test_integration.py -> fixed issue with block object
This commit is contained in:
parent
6e78ca5287
commit
96472d6bb9
@ -169,18 +169,19 @@ def get_latest_block(connection): # TODO Here is used DESCENDING OPERATOR
|
|||||||
space = connection.space("blocks")
|
space = connection.space("blocks")
|
||||||
_all_blocks = space.select()
|
_all_blocks = space.select()
|
||||||
_all_blocks = _all_blocks.data
|
_all_blocks = _all_blocks.data
|
||||||
hash = ''
|
block = {"app_hash": '', "height": 0, "transactions": []}
|
||||||
heigth = 0
|
|
||||||
txs = []
|
|
||||||
if len(_all_blocks) > 0:
|
if len(_all_blocks) > 0:
|
||||||
_block = sorted(_all_blocks, key=itemgetter(1), reverse=True)[0]
|
_block = sorted(_all_blocks, key=itemgetter(1), reverse=True)[0]
|
||||||
space = connection.space("blocks_tx")
|
space = connection.space("blocks_tx")
|
||||||
_txids = space.select(_block[2], index="block_search")
|
_txids = space.select(_block[2], index="block_search")
|
||||||
_txids = _txids.data
|
_txids = _txids.data
|
||||||
hash = _block[0]
|
block["app_hash"] = _block[0]
|
||||||
heigth = _block[1]
|
block["height"] = _block[1]
|
||||||
txs = [tx[0] for tx in _txids]
|
block["transactions"] = [tx[0] for tx in _txids]
|
||||||
return {"app_hash": hash, "height": heigth, "transactions": txs}
|
else:
|
||||||
|
block = None
|
||||||
|
return block
|
||||||
|
|
||||||
|
|
||||||
@register_query(TarantoolDB)
|
@register_query(TarantoolDB)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user