From 7b752e00d54c2a4d1daec916e0a206fab993c92f Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 28 Apr 2020 19:21:39 +0200 Subject: [PATCH] pyln: Set the bitcoin datadir when running tests Telling `lightningd` to pass a `-datadir` to `bitcoin-cli` so it doesn't go snooping where it doesn't belong (i.e., the user's home directory and config). Changelog-None Suggested-by: Simon Vrouwe <@SimonVrouwe> Signed-off-by: Christian Decker <@cdecker> --- contrib/pyln-testing/pyln/testing/utils.py | 3 +++ tests/plugins/bitcoin/part1.py | 1 + 2 files changed, 4 insertions(+) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index a5350ce4c..fb62c1ecd 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -489,6 +489,9 @@ class LightningD(TailableProc): 'ignore-fee-limits': 'false', 'bitcoin-rpcuser': BITCOIND_CONFIG['rpcuser'], 'bitcoin-rpcpassword': BITCOIND_CONFIG['rpcpassword'], + + # Make sure we don't touch any existing config files in the user's $HOME + 'bitcoin-datadir': lightning_dir, } for k, v in opts.items(): diff --git a/tests/plugins/bitcoin/part1.py b/tests/plugins/bitcoin/part1.py index 24cd61fb2..fdd759cb5 100755 --- a/tests/plugins/bitcoin/part1.py +++ b/tests/plugins/bitcoin/part1.py @@ -33,5 +33,6 @@ def getchaininfo(plugin, **kwargs): plugin.add_option("bitcoin-rpcuser", "", "") plugin.add_option("bitcoin-rpcpassword", "", "") plugin.add_option("bitcoin-rpcport", "", "") +plugin.add_option("bitcoin-datadir", "", "") plugin.run()