fixed test_core.py by converting dict transaction to Transaction Object

This commit is contained in:
andrei 2022-04-20 17:10:03 +03:00
parent 9e471bf576
commit 5356cb8ac2
2 changed files with 2 additions and 5 deletions

View File

@ -319,10 +319,8 @@ class Planetmint(object):
if len(transactions) + len(current_spent_transactions) > 1: if len(transactions) + len(current_spent_transactions) > 1:
raise DoubleSpend('tx "{}" spends inputs twice'.format(txid)) raise DoubleSpend('tx "{}" spends inputs twice'.format(txid))
elif transactions: elif transactions:
# print( f"\n\nget tx from DB : {transactions[0]['id']} {transactions[0]}") transaction = backend.query.get_transactions(self.connection, [transactions[0]['id']])
transaction=backend.query.get_transactions(self.connection, [transactions[0]['id']]) transaction = Transaction.from_dict(transaction[0])
# print( f"\n\nget tx from DB result: {transaction}")
# transaction = Transaction.from_db(self, transactions[0])
elif current_spent_transactions: elif current_spent_transactions:
transaction = current_spent_transactions[0] transaction = current_spent_transactions[0]

View File

@ -118,7 +118,6 @@ def test_get_spent_issue_1271(b, alice, bob, carol):
assert tx_5.validate(b) assert tx_5.validate(b)
b.store_bulk_transactions([tx_5]) b.store_bulk_transactions([tx_5])
assert b.get_spent(tx_2.id, 0) == tx_5 assert b.get_spent(tx_2.id, 0) == tx_5
assert not b.get_spent(tx_5.id, 0) assert not b.get_spent(tx_5.id, 0)
assert b.get_outputs_filtered(alice.public_key) assert b.get_outputs_filtered(alice.public_key)