testing - fixes e2e test utxo management

e2e tests where reusing utxos for transactions that where not confirmed, meaning than some times we were actually sending the same appointment over and over.
This commit is contained in:
Sergi Delgado Segura
2020-06-02 19:49:55 +02:00
parent 837f7d428a
commit 37d1bd9b12
2 changed files with 28 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ from common.config_loader import ConfigLoader
getcontext().prec = 10
utxos = []
@pytest.fixture(scope="session")
@@ -37,11 +38,13 @@ def prng_seed():
def setup_node(bitcoin_cli):
# This method will create a new address a mine bitcoin so the node can be used for testing
new_addr = bitcoin_cli.getnewaddress()
bitcoin_cli.generatetoaddress(106, new_addr)
bitcoin_cli.generatetoaddress(200, new_addr)
def create_txs(bitcoin_cli, n=1):
utxos = bitcoin_cli.listunspent()
global utxos
if not utxos:
utxos = bitcoin_cli.listunspent()
if len(utxos) < n:
raise ValueError("There're no enough UTXOs.")