hash problem fixed

This commit is contained in:
andrei 2022-04-27 15:00:18 +03:00
parent 72157f1607
commit b1501ef51e
4 changed files with 2 additions and 6 deletions

View File

@ -163,7 +163,7 @@ class TransactionCompose:
def _get_inputs(self): def _get_inputs(self):
_inputs = [] _inputs = []
for _input in self.db_results["inputs"]: for _input in self.db_results["inputs"]:
_in = copy.deepcopy(self._map["inputs"]) _in = copy.deepcopy(self._map["inputs"][_input[-1]])
_in["fulfillment"] = _input[1] _in["fulfillment"] = _input[1]
if _in["fulfills"] is not None: if _in["fulfills"] is not None:
_in["fulfills"]["transaction_id"] = _input[3] _in["fulfills"]["transaction_id"] = _input[3]
@ -176,7 +176,7 @@ class TransactionCompose:
_outputs = [] _outputs = []
for _output in self.db_results["outputs"]: for _output in self.db_results["outputs"]:
# print (f"\noutput : {_output}") # print (f"\noutput : {_output}")
_out = copy.deepcopy(self._map["outputs"]) _out = copy.deepcopy(self._map["outputs"][_output[-1]])
_out["amount"] = _output[1] _out["amount"] = _output[1]
_tmp_keys = [(_key[3], _key[4]) for _key in self.db_results["keys"] if _key[2] == _output[5]] _tmp_keys = [(_key[3], _key[4]) for _key in self.db_results["keys"] if _key[2] == _output[5]]
_sorted_keys = sorted(_tmp_keys, key=lambda tup: (tup[1])) _sorted_keys = sorted(_tmp_keys, key=lambda tup: (tup[1]))

View File

@ -1308,7 +1308,6 @@ class Transaction(object):
for input_ in self.inputs: for input_ in self.inputs:
input_txid = input_.fulfills.txid input_txid = input_.fulfills.txid
input_tx = planet.get_transaction(input_txid) input_tx = planet.get_transaction(input_txid)
print(f"\ninput_tx ------ {input_tx.to_dict()} -------")
if input_tx is None: if input_tx is None:
for ctxn in current_transactions: for ctxn in current_transactions:
if ctxn.id == input_txid: if ctxn.id == input_txid:

View File

@ -245,7 +245,6 @@ class Planetmint(object):
def get_transaction(self, transaction_id): def get_transaction(self, transaction_id):
transaction = backend.query.get_transaction(self.connection, transaction_id) transaction = backend.query.get_transaction(self.connection, transaction_id)
print(f"transaction_from_db ::::::: {transaction} :::::::::")
# if transaction: # if transaction:
# asset = backend.query.get_asset(self.connection, transaction_id) # asset = backend.query.get_asset(self.connection, transaction_id)
# metadata = backend.query.get_metadata(self.connection, [transaction_id]) # metadata = backend.query.get_metadata(self.connection, [transaction_id])

View File

@ -402,14 +402,12 @@ def test_muiltiple_in_mix_own_multiple_out_mix_own_transfer(alice, b, user_pk,
tx_create = Transaction.create([alice.public_key], [([user_pk], 50), ([user_pk, alice.public_key], 50)], tx_create = Transaction.create([alice.public_key], [([user_pk], 50), ([user_pk, alice.public_key], 50)],
asset={'name': random.random()}) asset={'name': random.random()})
tx_create_signed = tx_create.sign([alice.private_key]) tx_create_signed = tx_create.sign([alice.private_key])
print(f"\ninit_tx_create ======= {tx_create_signed.to_dict()} ========")
# TRANSFER # TRANSFER
tx_transfer = Transaction.transfer(tx_create.to_inputs(), tx_transfer = Transaction.transfer(tx_create.to_inputs(),
[([alice.public_key], 50), ([alice.public_key, user_pk], 50)], [([alice.public_key], 50), ([alice.public_key, user_pk], 50)],
asset_id=tx_create.id) asset_id=tx_create.id)
tx_transfer_signed = tx_transfer.sign([alice.private_key, user_sk]) tx_transfer_signed = tx_transfer.sign([alice.private_key, user_sk])
b.store_bulk_transactions([tx_create_signed]) b.store_bulk_transactions([tx_create_signed])
print(f"\ntx_transfer====== {tx_transfer_signed.to_dict()} ======")
assert tx_transfer_signed.validate(b) == tx_transfer_signed assert tx_transfer_signed.validate(b) == tx_transfer_signed
assert len(tx_transfer_signed.outputs) == 2 assert len(tx_transfer_signed.outputs) == 2