mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 22:45:44 +00:00
* made returned outputs unique (get_owned_ids)
* added delete_output method to init.lua * fixd output deletion issue by relaying the deletion to lua instead of the python code Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
c90e4fcc27
commit
3187adb350
@ -307,4 +307,8 @@ function indexed_pattern_search(space_name, field_no, pattern)
|
|||||||
require('fiber').yield()
|
require('fiber').yield()
|
||||||
end
|
end
|
||||||
return result_set
|
return result_set
|
||||||
|
end
|
||||||
|
|
||||||
|
function delete_output( id )
|
||||||
|
box.space.outputs:delete(id)
|
||||||
end
|
end
|
||||||
@ -311,7 +311,8 @@ def get_owned_ids(connection, owner: str):
|
|||||||
if len(outputs) == 0:
|
if len(outputs) == 0:
|
||||||
return []
|
return []
|
||||||
txids = [output[5] for output in outputs]
|
txids = [output[5] for output in outputs]
|
||||||
return get_complete_transactions_by_ids(connection, txids)
|
unique_set_txids = set(txids)
|
||||||
|
return get_complete_transactions_by_ids(connection, unique_set_txids)
|
||||||
|
|
||||||
|
|
||||||
@register_query(TarantoolDBConnection)
|
@register_query(TarantoolDBConnection)
|
||||||
@ -346,16 +347,16 @@ def get_block_with_transaction(connection, txid: str):
|
|||||||
|
|
||||||
@register_query(TarantoolDBConnection)
|
@register_query(TarantoolDBConnection)
|
||||||
def delete_transactions(connection, txn_ids: list):
|
def delete_transactions(connection, txn_ids: list):
|
||||||
for _id in txn_ids:
|
try:
|
||||||
connection.run(connection.space(TARANT_TABLE_TRANSACTION).delete(_id), only_data=False)
|
for _id in txn_ids:
|
||||||
for _id in txn_ids:
|
_outputs = get_outputs_by_tx_id( connection, _id)
|
||||||
_outputs = connection.run(
|
for x in range(len(_outputs)):
|
||||||
connection.space(TARANT_TABLE_OUTPUT).select(_id, index=TARANT_ID_SEARCH), only_data=False
|
connection.connect().call("delete_output", (_outputs[x].id))
|
||||||
)
|
for _id in txn_ids:
|
||||||
for _outpID in _outputs:
|
connection.run(connection.space(TARANT_TABLE_TRANSACTION).delete(_id), only_data=False)
|
||||||
connection.run(
|
except Exception as e:
|
||||||
connection.space(TARANT_TABLE_OUTPUT).delete(_outpID[5], index="unique_search"), only_data=False
|
logger.info(f"Could not insert unspent output: {e}")
|
||||||
)
|
raise OperationDataInsertionError()
|
||||||
|
|
||||||
|
|
||||||
@register_query(TarantoolDBConnection)
|
@register_query(TarantoolDBConnection)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user