mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 23:15:44 +00:00
Merge pull request #134 from andreitricolici/planetmint-tarantool
Fixed tendermint/test_core.py
This commit is contained in:
commit
02eee46e08
@ -390,12 +390,12 @@ def get_unspent_outputs(connection, query=None): # for now we don't have implem
|
|||||||
@register_query(TarantoolDBConnection)
|
@register_query(TarantoolDBConnection)
|
||||||
def store_pre_commit_state(connection, state: dict):
|
def store_pre_commit_state(connection, state: dict):
|
||||||
_precommit = connection.run(
|
_precommit = connection.run(
|
||||||
connection.space("pre_commits").select(state["height"], index="height_search", limit=1)
|
connection.space("pre_commits").select([], limit=1)
|
||||||
)
|
)
|
||||||
unique_id = token_hex(8) if _precommit is None or len(_precommit) == 0 else _precommit[0][0]
|
_precommitTuple = (token_hex(8), state["height"], state["transactions"]) if _precommit is None or len(_precommit) == 0 else _precommit[0]
|
||||||
connection.run(
|
connection.run(
|
||||||
connection.space("pre_commits").upsert((unique_id, state["height"], state["transactions"]),
|
connection.space("pre_commits").upsert(_precommitTuple,
|
||||||
op_list=[('=', 0, unique_id),
|
op_list=[('=', 0, _precommitTuple[0]),
|
||||||
('=', 1, state["height"]),
|
('=', 1, state["height"]),
|
||||||
('=', 2, state["transactions"])],
|
('=', 2, state["transactions"])],
|
||||||
limit=1),
|
limit=1),
|
||||||
@ -410,7 +410,7 @@ def get_pre_commit_state(connection):
|
|||||||
)
|
)
|
||||||
if _commit is None or len(_commit) == 0:
|
if _commit is None or len(_commit) == 0:
|
||||||
return None
|
return None
|
||||||
_commit = sorted(_commit, key=itemgetter(1), reverse=True)[0]
|
_commit = sorted(_commit, key=itemgetter(1), reverse=False)[0]
|
||||||
return {"height": _commit[1], "transactions": _commit[2]}
|
return {"height": _commit[1], "transactions": _commit[2]}
|
||||||
|
|
||||||
|
|
||||||
@ -519,8 +519,10 @@ def get_asset_tokens_for_public_key(connection, asset_id: str,
|
|||||||
|
|
||||||
@register_query(TarantoolDBConnection)
|
@register_query(TarantoolDBConnection)
|
||||||
def store_abci_chain(connection, height: int, chain_id: str, is_synced: bool = True):
|
def store_abci_chain(connection, height: int, chain_id: str, is_synced: bool = True):
|
||||||
|
_chain = connection.run(connection.space("abci_chains").select(height, index="height_search", limit=1))
|
||||||
|
_chainTuple = (height, is_synced, chain_id) if _chain is None or len(_chain) == 0 else _chain[0]
|
||||||
connection.run(
|
connection.run(
|
||||||
connection.space("abci_chains").upsert((height, is_synced, chain_id),
|
connection.space("abci_chains").upsert(_chainTuple,
|
||||||
op_list=[('=', 0, height),
|
op_list=[('=', 0, height),
|
||||||
('=', 1, is_synced),
|
('=', 1, is_synced),
|
||||||
('=', 2, chain_id)],
|
('=', 2, chain_id)],
|
||||||
@ -548,5 +550,5 @@ def get_latest_abci_chain(connection):
|
|||||||
)
|
)
|
||||||
if _all_chains is None or len(_all_chains) == 0:
|
if _all_chains is None or len(_all_chains) == 0:
|
||||||
return None
|
return None
|
||||||
_chain = sorted(_all_chains, key=itemgetter(0), reverse=False)[0]
|
_chain = sorted(_all_chains, key=itemgetter(0), reverse=True)[0]
|
||||||
return {"height": _chain[0], "is_synced": _chain[1], "chain_id": _chain[2]}
|
return {"height": _chain[0], "is_synced": _chain[1], "chain_id": _chain[2]}
|
||||||
|
|||||||
@ -195,7 +195,6 @@ class App(BaseApplication):
|
|||||||
self.abort_if_abci_chain_is_not_synced()
|
self.abort_if_abci_chain_is_not_synced()
|
||||||
|
|
||||||
chain_shift = 0 if self.chain is None else self.chain['height']
|
chain_shift = 0 if self.chain is None else self.chain['height']
|
||||||
|
|
||||||
height = request_end_block.height + chain_shift
|
height = request_end_block.height + chain_shift
|
||||||
self.new_height = height
|
self.new_height = height
|
||||||
|
|
||||||
|
|||||||
@ -606,7 +606,6 @@ class Transaction(object):
|
|||||||
tx_body (dict): The Transaction to be transformed.
|
tx_body (dict): The Transaction to be transformed.
|
||||||
"""
|
"""
|
||||||
# NOTE: Remove reference to avoid side effects
|
# NOTE: Remove reference to avoid side effects
|
||||||
print(f"\nbefore deepcopy {tx_body}")
|
|
||||||
tx_body = deepcopy(tx_body)
|
tx_body = deepcopy(tx_body)
|
||||||
tx_body = rapidjson.loads(rapidjson.dumps(tx_body))
|
tx_body = rapidjson.loads(rapidjson.dumps(tx_body))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user