test: make joinmarket work with regtest

This commit is contained in:
nixbitcoin 2021-10-25 13:30:53 +00:00 committed by Erik Arvstedt
parent a10aa21c69
commit d5ce1c43a8
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
3 changed files with 12 additions and 11 deletions

View File

@ -169,8 +169,8 @@ let
use_ssl = false
[BLOCKCHAIN]
blockchain_source = bitcoin-rpc
network = ${bitcoind.network}
blockchain_source = ${bitcoind.makeNetworkName "bitcoin-rpc" "regtest"}
network = ${bitcoind.makeNetworkName "mainnet" "testnet"}
rpc_host = ${nbLib.address bitcoind.rpc.address}
rpc_port = ${toString bitcoind.rpc.port}
rpc_user = ${bitcoind.rpc.users.privileged.name}
@ -282,15 +282,16 @@ in {
echo "rpc_password = $(cat ${secretsDir}/bitcoin-rpcpassword-privileged)"
} > '${cfg.dataDir}/joinmarket.cfg'
'';
# Generating wallets (jmclient/wallet.py) is only supported for mainnet or testnet
postStart = mkIf (bitcoind.network == "mainnet") ''
postStart = ''
walletname=wallet.jmdat
wallet=${cfg.dataDir}/wallets/$walletname
if [[ ! -f $wallet ]]; then
${optionalString (cfg.rpcWalletFile != null) ''
echo "Create watch-only wallet ${cfg.rpcWalletFile}"
if ! output=$(${bitcoind.cli}/bin/bitcoin-cli -named createwallet \
wallet_name="${cfg.rpcWalletFile}" disable_private_keys=true 2>&1); then
wallet_name="${cfg.rpcWalletFile}" \
${optionalString (!bitcoind.regtest) "disable_private_keys=true"} 2>&1
); then
# Ignore error if bitcoind wallet already exists
if [[ $output != *"already exists"* ]]; then
echo "$output"

View File

@ -248,9 +248,6 @@ let
services.lightning-pool.extraConfig = ''
auctionserver=localhost
'';
# Needs wallet support which is unavailable for regtest
services.joinmarket.yieldgenerator.enable = mkForce false;
};
## Examples / debug helper

View File

@ -218,9 +218,12 @@ def _():
@test("joinmarket-yieldgenerator")
def _():
machine.wait_until_succeeds(
log_has_string("joinmarket-yieldgenerator", "Critical error updating blockheight.")
)
if "regtest" in enabled_tests:
expected_log_msg = "You do not have the minimum required amount of coins to be a maker"
else:
expected_log_msg = "Critical error updating blockheight."
machine.wait_until_succeeds(log_has_string("joinmarket-yieldgenerator", expected_log_msg))
@test("joinmarket-ob-watcher")
def _():