|
|
|
|
@ -120,11 +120,16 @@ def setup(request):
|
|
|
|
|
root_cmd = [bitcoin_path + "bitcoin-cli", "-regtest", |
|
|
|
|
"-rpcuser=" + bitcoin_rpcusername, |
|
|
|
|
"-rpcpassword=" + bitcoin_rpcpassword] |
|
|
|
|
# Bitcoin Core v0.21+ does not create default wallet |
|
|
|
|
local_command(root_cmd + ["createwallet", "jm-test-wallet"]) |
|
|
|
|
local_command(root_cmd + ["loadwallet", "jm-test-wallet"]) |
|
|
|
|
for i in range(2): |
|
|
|
|
cpe = local_command(root_cmd + ["getnewaddress"]) |
|
|
|
|
cpe = local_command(root_cmd + ["-rpcwallet=jm-test-wallet"] + |
|
|
|
|
["getnewaddress"]) |
|
|
|
|
if cpe.returncode == 0: |
|
|
|
|
destn_addr = cpe.stdout[:-1].decode('utf-8') |
|
|
|
|
local_command(root_cmd + ["generatetoaddress", "301", destn_addr]) |
|
|
|
|
local_command(root_cmd + ["-rpcwallet=jm-test-wallet"] + |
|
|
|
|
["generatetoaddress", "301", destn_addr]) |
|
|
|
|
else: |
|
|
|
|
pytest.exit("Cannot setup tests, bitcoin-cli failing.\n" + |
|
|
|
|
str(cpe.stdout)) |
|
|
|
|
|