mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
tests: fix to work with bitcoind master branch.
E ConnectionRefusedError: [Errno 111] Connection refused And in debug.log: 2018-05-17T04:06:35Z Warning: Config setting for -rpcport only applied on regtest network when in [regtest] section. Unfortunately, current versions including 0.16.1 *ignore* the contents of a '[regtest]' section, so we need it in *both* places. Also remove the misleading 'rpcport' initialization which we always override. Note that we don't fix this message though: 2018-05-17T04:06:35Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
91d62ad697
commit
ce5b4bddf2
@@ -15,7 +15,6 @@ BITCOIND_CONFIG = {
|
||||
"regtest": 1,
|
||||
"rpcuser": "rpcuser",
|
||||
"rpcpassword": "rpcpass",
|
||||
"rpcport": 18332,
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +39,14 @@ def wait_for(success, timeout=TIMEOUT, interval=0.1):
|
||||
raise ValueError("Error waiting for {}", success)
|
||||
|
||||
|
||||
def write_config(filename, opts):
|
||||
def write_config(filename, opts, regtest_opts=None):
|
||||
with open(filename, 'w') as f:
|
||||
for k, v in opts.items():
|
||||
f.write("{}={}\n".format(k, v))
|
||||
if regtest_opts:
|
||||
f.write("[regtest]\n")
|
||||
for k, v in regtest_opts.items():
|
||||
f.write("{}={}\n".format(k, v))
|
||||
|
||||
|
||||
class TailableProc(object):
|
||||
@@ -240,9 +243,13 @@ class BitcoinD(TailableProc):
|
||||
'-logtimestamps',
|
||||
'-nolisten',
|
||||
]
|
||||
# For up to and including 0.16.1, this needs to be in main section.
|
||||
BITCOIND_CONFIG['rpcport'] = rpcport
|
||||
# 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)
|
||||
write_config(btc_conf_file, BITCOIND_CONFIG, BITCOIND_REGTEST)
|
||||
self.rpc = SimpleBitcoinProxy(btc_conf_file=btc_conf_file)
|
||||
|
||||
def start(self):
|
||||
|
||||
Reference in New Issue
Block a user