mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
cormorant: handle checking imports and stopping before started
This commit is contained in:
parent
74c3370277
commit
ef3e2ed695
1 changed files with 13 additions and 1 deletions
|
@ -62,6 +62,11 @@ public class Cormorant {
|
|||
}
|
||||
|
||||
public boolean checkWalletImport(Wallet wallet) {
|
||||
if(bitcoindClient == null) {
|
||||
log.warn("Attempting to check if " + wallet.getMasterName() + " is imported, but Cormorant is not started");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Will block until all wallet descriptors have been added
|
||||
try {
|
||||
bitcoindClient.importWallet(wallet);
|
||||
|
@ -73,6 +78,11 @@ public class Cormorant {
|
|||
}
|
||||
|
||||
public void checkAddressImport(Address address, Date since) throws ServerException {
|
||||
if(bitcoindClient == null) {
|
||||
log.warn("Attempting to check if an address is imported, but Cormorant is not started");
|
||||
throw new ServerException("Server is not connected");
|
||||
}
|
||||
|
||||
//Will block until address descriptor has been added
|
||||
try {
|
||||
bitcoindClient.importAddress(address, since);
|
||||
|
@ -86,7 +96,9 @@ public class Cormorant {
|
|||
}
|
||||
|
||||
public void stop() {
|
||||
bitcoindClient.stop();
|
||||
if(bitcoindClient != null) {
|
||||
bitcoindClient.stop();
|
||||
}
|
||||
if(electrumServer != null) {
|
||||
electrumServer.stop();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue