pytest: Have bitcoind remember its config file

There were a few places we were rebuilding the config path by appending
`bitcoin.conf` to the bitcoin directory. So now we just remember it and
reference it instead.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2019-04-10 22:12:02 +02:00 committed by Rusty Russell
parent b9d7731100
commit 25c830a533
2 changed files with 4 additions and 5 deletions

View File

@ -34,8 +34,7 @@ class BitcoinRpcProxy(object):
self.request_count = 0
def _handle_request(self, r):
conf_file = os.path.join(self.bitcoind.bitcoin_dir, 'bitcoin.conf')
brpc = BitcoinProxy(btc_conf_file=conf_file)
brpc = BitcoinProxy(btc_conf_file=self.bitcoind.conf_file)
method = r['method']
# If we have set a mock for this method reply with that instead of

View File

@ -305,9 +305,9 @@ class BitcoinD(TailableProc):
# For after 0.16.1 (eg. 3f398d7a17f136cd4a67998406ca41a124ae2966), this
# needs its own [regtest] section.
BITCOIND_REGTEST = {'rpcport': rpcport}
btc_conf_file = os.path.join(bitcoin_dir, 'bitcoin.conf')
write_config(btc_conf_file, BITCOIND_CONFIG, BITCOIND_REGTEST)
self.rpc = SimpleBitcoinProxy(btc_conf_file=btc_conf_file)
self.conf_file = os.path.join(bitcoin_dir, 'bitcoin.conf')
write_config(self.conf_file, BITCOIND_CONFIG, BITCOIND_REGTEST)
self.rpc = SimpleBitcoinProxy(btc_conf_file=self.conf_file)
self.proxies = []
def start(self):