From 894e86d3ee029afb9d909d1ec675979a8f6f5bdc Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Tue, 25 Jun 2019 00:56:33 -0400 Subject: [PATCH] fix intermittent test_queries failure in torba due to non-unique TX generated --- torba/tests/client_tests/unit/test_database.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/torba/tests/client_tests/unit/test_database.py b/torba/tests/client_tests/unit/test_database.py index 268917695..bb086bc70 100644 --- a/torba/tests/client_tests/unit/test_database.py +++ b/torba/tests/client_tests/unit/test_database.py @@ -5,6 +5,7 @@ from torba.client.wallet import Wallet from torba.client.constants import COIN from torba.coin.bitcoinsegwit import MainNetLedger as ledger_class from torba.client.basedatabase import query, constraints_to_sql, AIOSQLite +from torba.client.hash import sha256 from torba.testcase import AsyncioTestCase @@ -187,7 +188,7 @@ class TestQueries(AsyncioTestCase): to_address = await my_account.receiving.get_or_create_usable_address() to_hash = ledger_class.address_to_hash160(to_address) tx = ledger_class.transaction_class(height=height, is_verified=True) \ - .add_inputs([self.txi(self.txo(1, NULL_HASH))]) \ + .add_inputs([self.txi(self.txo(1, sha256(str(height).encode())))]) \ .add_outputs([self.txo(1, to_hash)]) await self.ledger.db.insert_transaction(tx) await self.ledger.db.save_transaction_io(tx, to_address, to_hash, '')