From 82c92df162b6635708f7b281b749ae8eb25defa4 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 2 Nov 2021 13:07:39 +0100 Subject: [PATCH] tests/regtest: fix restarting bitcoind Previously, the test wallet was not loaded after restarting bitcoind and generating blocks failed. --- test/tests.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/tests.nix b/test/tests.nix index 1e13ad3..2766fd4 100644 --- a/test/tests.nix +++ b/test/tests.nix @@ -229,10 +229,11 @@ let services.bitcoind.regtest = true; systemd.services.bitcoind.postStart = mkAfter '' cli=${config.services.bitcoind.cli}/bin/bitcoin-cli - # Don't fail when wallet already exists - $cli createwallet "test" || true - address=$($cli getnewaddress) - $cli generatetoaddress 10 $address + if ! $cli listwallets | ${pkgs.jq}/bin/jq -e 'index("test")'; then + $cli -named createwallet wallet_name=test load_on_startup=true + address=$($cli -rpcwallet=test getnewaddress) + $cli generatetoaddress 10 $address + fi ''; # lightning-loop contains no builtin swap server for regtest.