Skip to content

Commit

Permalink
bitcoind: Remove BDB wallet support
Browse files Browse the repository at this point in the history
Bitcoin Core 25.0 deprecates support for legacy BDB wallets.
  • Loading branch information
alvasw committed Sep 3, 2024
1 parent 5d06e4d commit 35da730
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,16 @@ public BitcoindDaemon(JsonRpcClient rpcClient) {
}

public void createOrLoadWallet(String walletName, Optional<String> passphrase) {
createOrLoadWallet(walletName, passphrase, true, false, false);
}

public void createOrLoadLegacyWallet(String walletName, Optional<String> passphrase) {
createOrLoadWallet(walletName, passphrase, false, false, false);
createOrLoadWallet(walletName, passphrase, false, false);
}

public void createOrLoadWatchOnlyWallet(String walletName) {
createOrLoadWallet(walletName, Optional.empty(), true, true, true);
createOrLoadWallet(walletName, Optional.empty(), true, true);
}

private void createOrLoadWallet(String walletName, Optional<String> passphrase, boolean descriptors, boolean disablePrivateKeys, boolean blank) {
private void createOrLoadWallet(String walletName, Optional<String> passphrase, boolean disablePrivateKeys, boolean blank) {
try {
createWallet(walletName, passphrase.orElse(""), descriptors, disablePrivateKeys, blank);
createWallet(walletName, passphrase.orElse(""), disablePrivateKeys, blank);
} catch (RpcCallFailureException e) {
if (doesWalletExist(e)) {
List<String> loadedWallets = listWallets();
Expand Down Expand Up @@ -151,10 +147,9 @@ private boolean doesWalletExist(RpcCallFailureException e) {
return e.getMessage().contains("Database already exists.");
}

private void createWallet(String walletName, String passphrase, boolean descriptors, boolean disablePrivateKeys, boolean blank) {
private void createWallet(String walletName, String passphrase, boolean disablePrivateKeys, boolean blank) {
var request = BitcoindCreateWalletRpcCall.Request.builder()
.walletName(walletName)
.descriptors(descriptors)
.disablePrivateKeys(disablePrivateKeys)
.blank(blank)
.passphrase(passphrase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static class Request {
private String passphrase;
@Json(name = "avoid_reuse")
private Boolean avoidReuse;
private boolean descriptors;
}

public BitcoindCreateWalletRpcCall(Request request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ElementsdDaemon(JsonRpcClient rpcClient) {
}

public void createOrLoadWallet(String walletName, Optional<String> passphrase) {
bitcoindDaemon.createOrLoadLegacyWallet(walletName, passphrase);
throw new UnsupportedOperationException("Bitcoin Core 25.0 removed legacy wallet support.");
}

public ElementsdDecodeRawTransactionResponse decodeRawTransaction(String txInHex) {
Expand Down

0 comments on commit 35da730

Please sign in to comment.