diff --git a/src/main/java/com/sparrowwallet/sparrow/net/cormorant/bitcoind/BitcoindClient.java b/src/main/java/com/sparrowwallet/sparrow/net/cormorant/bitcoind/BitcoindClient.java index 7a88c2f5..1fe883fe 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/cormorant/bitcoind/BitcoindClient.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/cormorant/bitcoind/BitcoindClient.java @@ -157,7 +157,16 @@ public class BitcoindClient { } private ListSinceBlock getListSinceBlock(String blockHash) { - return getBitcoindService().listSinceBlock(blockHash, 1, true, true, true); + 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 wallets) throws ImportFailedException {