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; services.bitcoind.regtest = true;
systemd.services.bitcoind.postStart = mkAfter '' systemd.services.bitcoind.postStart = mkAfter ''
cli=${config.services.bitcoind.cli}/bin/bitcoin-cli cli=${config.services.bitcoind.cli}/bin/bitcoin-cli
# Don't fail when wallet already exists if ! $cli listwallets | ${pkgs.jq}/bin/jq -e 'index("test")'; then
$cli createwallet "test" || true $cli -named createwallet wallet_name=test load_on_startup=true
address=$($cli getnewaddress) address=$($cli -rpcwallet=test getnewaddress)
$cli generatetoaddress 10 $address $cli generatetoaddress 10 $address
fi
''; '';
# lightning-loop contains no builtin swap server for regtest. # lightning-loop contains no builtin swap server for regtest.