Browse Source

Merge #352: Upgrade testing framework to use generatetoaddress.

31eabde Upgrade testing framework to use generatetoaddress. (AdamISZ)
master
AdamISZ 7 years ago
parent
commit
f6bcf0dc2b
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 8
      conftest.py
  2. 3
      jmclient/jmclient/blockchaininterface.py

8
conftest.py

@ -101,9 +101,11 @@ def setup(request):
"-daemon", "-conf=" + bitcoin_conf])
time.sleep(3)
#generate blocks; segwit activates around block 500-600
for i in range(2):
local_command([bitcoin_path + "bitcoin-cli", "-regtest",
root_cmd = [bitcoin_path + "bitcoin-cli", "-regtest",
"-rpcuser=" + bitcoin_rpcusername,
"-rpcpassword=" + bitcoin_rpcpassword, "generate", "301"])
"-rpcpassword=" + bitcoin_rpcpassword]
for i in range(2):
destn_addr = local_command(root_cmd + ["getnewaddress"])
local_command(root_cmd + ["generatetoaddress", "301", destn_addr])
time.sleep(1)

3
jmclient/jmclient/blockchaininterface.py

@ -916,6 +916,7 @@ class RegtestBitcoinCoreInterface(BitcoinCoreInterface): #pragma: no cover
self.absurd_fees = False
self.simulating = False
self.shutdown_signal = False
self.destn_addr = self.rpc("getnewaddress", [])
def estimate_fee_per_kb(self, N):
if not self.absurd_fees:
@ -960,7 +961,7 @@ class RegtestBitcoinCoreInterface(BitcoinCoreInterface): #pragma: no cover
instruct to mine n blocks.
"""
try:
self.rpc('generate', [n])
self.rpc('generatetoaddress', [n, self.destn_addr])
except JsonRpcConnectionError:
#can happen if the blockchain is shut down
#automatically at the end of tests; this shouldn't

Loading…
Cancel
Save