Skip to content

Commit

Permalink
joinmarket: create bitcoind wallet
Browse files Browse the repository at this point in the history
Starting with 0.21.0, bitcoin no longer automatically creates and loads
a default wallet.
This was being ignored because of a JoinMarket issue [1] in CI builds prior
to this version. Now a watch-only Bitcoin Core wallet is created in ExecStartPost.

[1] JoinMarket-Org/joinmarket-clientserver#812
  • Loading branch information
nixbitcoin authored and erikarvstedt committed Aug 8, 2021
1 parent 4d4c248 commit 1810df2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/joinmarket.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
'';
Expand Down Expand Up @@ -244,7 +244,11 @@ in {
walletname=wallet.jmdat
wallet=${cfg.dataDir}/wallets/$walletname
if [[ ! -f $wallet ]]; then
echo "Create wallet"
${optionalString (cfg.rpcWalletFile != null) ''
echo "Create wallet"
${config.services.bitcoind.cli}/bin/bitcoin-cli \
createwallet "${cfg.rpcWalletFile}"
''}
pw=$(cat "${secretsDir}"/jm-wallet-password)
cd ${cfg.dataDir}
if ! ${nbPkgs.joinmarket}/bin/jm-genwallet --datadir=${cfg.dataDir} $walletname $pw \
Expand Down
15 changes: 15 additions & 0 deletions modules/versioning.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ let
rm -f "${secretsDir}"/{lnd-seed-mnemonic,jm-wallet-seed}
'';
}
{
version = "0.0.48";
condition = config.services.joinmarket.enable;
message = ''
Starting with 0.21.0, [bitcoind no longer automatically creates and loads a
default wallet](bitcoin/bitcoin#15454). Therefore it is necessary to manually
create a wallet with bitcoind. If you ran bitcoind & JoinMarket before Bitcoin
0.21.0, you likely already have a wallet file named `wallet.dat` that JoinMarket
is using.
If you want to continue using this wallet file like before, add the following to
your configuration:
services.joinmarket.rpcWalletFile = null;
'';
}
];

incompatibleChanges = optionals
Expand Down

0 comments on commit 1810df2

Please sign in to comment.