reload cormorant wallet if unloaded when polling bitcoind

This commit is contained in:
Craig Raw 2023-10-31 10:21:33 +01:00
parent ee6589991d
commit dbafefb940

View file

@ -157,7 +157,16 @@ public class BitcoindClient {
}
private ListSinceBlock getListSinceBlock(String blockHash) {
try {
return getBitcoindService().listSinceBlock(blockHash, 1, true, true, true);
} catch(JsonRpcException e) {
if(e.getErrorMessage() != null && e.getErrorMessage().getMessage() != null && e.getErrorMessage().getMessage().contains("is not loaded")) {
getBitcoindService().loadWallet(CORE_WALLET_NAME, true);
return getBitcoindService().listSinceBlock(blockHash, 1, true, true, true);
}
throw e;
}
}
public void importWallets(Collection<Wallet> wallets) throws ImportFailedException {