mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
cormorant: set wallet to load on bitcoind startup, check if loaded first
This commit is contained in:
parent
f938506a3f
commit
9edeff9aab
2 changed files with 7 additions and 19 deletions
|
@ -128,18 +128,11 @@ public class BitcoindClient {
|
||||||
legacyWalletExists = listWalletDirResult.wallets().stream().anyMatch(walletDirResult -> walletDirResult.name().equals(Bwt.DEFAULT_CORE_WALLET));
|
legacyWalletExists = listWalletDirResult.wallets().stream().anyMatch(walletDirResult -> walletDirResult.name().equals(Bwt.DEFAULT_CORE_WALLET));
|
||||||
|
|
||||||
if(!exists) {
|
if(!exists) {
|
||||||
getBitcoindService().createWallet(CORE_WALLET_NAME, true, true, "", true, true, false, false);
|
getBitcoindService().createWallet(CORE_WALLET_NAME, true, true, "", true, true, true, false);
|
||||||
} else {
|
} else {
|
||||||
try {
|
List<String> wallets = getBitcoindService().listWallets();
|
||||||
getBitcoindService().loadWallet(CORE_WALLET_NAME, false);
|
if(!wallets.contains(CORE_WALLET_NAME)) {
|
||||||
} catch(JsonRpcException e) {
|
getBitcoindService().loadWallet(CORE_WALLET_NAME, true);
|
||||||
try {
|
|
||||||
getBitcoindService().unloadWallet(CORE_WALLET_NAME, false);
|
|
||||||
} catch(JsonRpcException ex) {
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
getBitcoindService().loadWallet(CORE_WALLET_NAME, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,14 +339,6 @@ public class BitcoindClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if(initialized) {
|
|
||||||
try {
|
|
||||||
getBitcoindService().unloadWallet(CORE_WALLET_NAME, false);
|
|
||||||
} catch(Exception e) {
|
|
||||||
log.info("Error unloading Core wallet " + CORE_WALLET_NAME, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
stopped = true;
|
stopped = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,9 @@ public interface BitcoindClientService {
|
||||||
@JsonRpcMethod("listwalletdir")
|
@JsonRpcMethod("listwalletdir")
|
||||||
ListWalletDirResult listWalletDir();
|
ListWalletDirResult listWalletDir();
|
||||||
|
|
||||||
|
@JsonRpcMethod("listwallets")
|
||||||
|
List<String> listWallets();
|
||||||
|
|
||||||
@JsonRpcMethod("createwallet")
|
@JsonRpcMethod("createwallet")
|
||||||
CreateLoadWalletResult createWallet(@JsonRpcParam("wallet_name") String name, @JsonRpcParam("disable_private_keys") boolean disablePrivateKeys, @JsonRpcParam("blank") boolean blank,
|
CreateLoadWalletResult createWallet(@JsonRpcParam("wallet_name") String name, @JsonRpcParam("disable_private_keys") boolean disablePrivateKeys, @JsonRpcParam("blank") boolean blank,
|
||||||
@JsonRpcParam("passphrase") String passphrase, @JsonRpcParam("avoid_reuse") boolean avoidReuse, @JsonRpcParam("descriptors") boolean descriptors,
|
@JsonRpcParam("passphrase") String passphrase, @JsonRpcParam("avoid_reuse") boolean avoidReuse, @JsonRpcParam("descriptors") boolean descriptors,
|
||||||
|
|
Loading…
Reference in a new issue