Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from typing import Dict

from authproxy import AuthServiceProxy, JSONRPCException
from authproxy import AuthServiceProxy, JSONRPCException, HTTP_TIMEOUT
from hwilib import _bech32 as bech32
from hwilib._base58 import xpub_to_pub_hex, to_address, decode
from hwilib._cli import process_commands
Expand Down Expand Up @@ -76,7 +76,6 @@ def get_free_port():
s.close()
return port

self.p2p_port = get_free_port()
self.rpc_port = get_free_port()

self.bitcoind_proc = subprocess.Popen(
Expand All @@ -87,7 +86,7 @@ def get_free_port():
"-noprinttoconsole",
"-fallbackfee=0.0002",
"-keypool=1",
f"-port={self.p2p_port}",
"-listen=0",
f"-rpcport={self.rpc_port}"
]
)
Expand Down Expand Up @@ -121,11 +120,12 @@ def get_free_port():
# Make sure there are blocks and coins available
self.rpc.createwallet(wallet_name="supply")
self.wrpc = self.get_wallet_rpc("supply")
self.wrpc.generatetoaddress(101, self.wrpc.getnewaddress())
mining_rpc = self.get_wallet_rpc("supply", timeout=120)
mining_rpc.generatetoaddress(101, self.wrpc.getnewaddress())

def get_wallet_rpc(self, wallet):
def get_wallet_rpc(self, wallet, timeout=HTTP_TIMEOUT):
url = self.rpc_url + f"/wallet/{wallet}"
return AuthServiceProxy(url)
return AuthServiceProxy(url, timeout=timeout)

def cleanup(self):
if self.bitcoind_proc is not None and self.bitcoind_proc.poll() is None:
Expand Down
Loading