diff --git a/examples/configuration.nix b/examples/configuration.nix index 65a5f98..f6f293b 100644 --- a/examples/configuration.nix +++ b/examples/configuration.nix @@ -245,6 +245,6 @@ # The nix-bitcoin release version that your config is compatible with. # When upgrading to a backwards-incompatible release, nix-bitcoin will display an # an error and provide hints for migrating your config to the new release. - nix-bitcoin.configVersion = "0.0.41"; + nix-bitcoin.configVersion = "0.0.49"; } diff --git a/modules/joinmarket.nix b/modules/joinmarket.nix index 5bd7e1e..cd4bed0 100644 --- a/modules/joinmarket.nix +++ b/modules/joinmarket.nix @@ -27,7 +27,7 @@ let rpc_port = ${toString bitcoind.rpc.port} rpc_user = ${bitcoind.rpc.users.privileged.name} @@RPC_PASSWORD@@ - ${optionalString (cfg.rpcWalletFile != null) "rpc_wallet_file=${cfg.rpcWalletFile}"} + ${optionalString (cfg.rpcWalletFile != null) "rpc_wallet_file = ${cfg.rpcWalletFile}"} [MESSAGING:server1] host = darkirc6tqgpnwd3blln3yfv5ckl47eg7llfxkmtovrv7c7iwohhb6ad.onion @@ -129,7 +129,7 @@ in { }; rpcWalletFile = mkOption { type = types.nullOr types.str; - default = null; + default = "jm_wallet"; description = '' Name of the watch-only bitcoind wallet the JoinMarket addresses are imported to. ''; @@ -244,7 +244,12 @@ in { walletname=wallet.jmdat wallet=${cfg.dataDir}/wallets/$walletname if [[ ! -f $wallet ]]; then - echo "Create wallet" + ${optionalString (cfg.rpcWalletFile != null) '' + echo "Create watch-only wallet ${cfg.rpcWalletFile}" + ${bitcoind.cli}/bin/bitcoin-cli -named createwallet \ + wallet_name="${cfg.rpcWalletFile}" \ + disable_private_keys=true + ''} pw=$(cat "${secretsDir}"/jm-wallet-password) cd ${cfg.dataDir} if ! ${nbPkgs.joinmarket}/bin/jm-genwallet --datadir=${cfg.dataDir} $walletname $pw \ diff --git a/modules/versioning.nix b/modules/versioning.nix index f34eaac..445edf8 100644 --- a/modules/versioning.nix +++ b/modules/versioning.nix @@ -91,6 +91,22 @@ let rm -f "${secretsDir}"/{lnd-seed-mnemonic,jm-wallet-seed} ''; } + { + version = "0.0.49"; + condition = config.services.joinmarket.enable; + message = '' + Starting with 0.21.0, bitcoind no longer automatically creates and loads a + default wallet named `wallet.dat` [1]. + The joinmarket service now automatically creates a watch-only bitcoind wallet + (named by option `services.joinmarket.rpcWalletFile`) when creating a joinmarket wallet. + + If you've used JoinMarket before, add the following to your configuration to + continue using the default `wallet.dat` wallet: + services.joinmarket.rpcWalletFile = null; + + [1] https://github.com/bitcoin/bitcoin/pull/15454 + ''; + } ]; incompatibleChanges = optionals