tests/regtest: fix restarting bitcoind

Previously, the test wallet was not loaded after restarting bitcoind and
generating blocks failed.
This commit is contained in:
Erik Arvstedt 2021-11-02 13:07:39 +01:00
parent 49086abcc5
commit 82c92df162
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -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.