mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-26 05:26: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) {
|
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
|
//Will block until all wallet descriptors have been added
|
||||||
try {
|
try {
|
||||||
bitcoindClient.importWallet(wallet);
|
bitcoindClient.importWallet(wallet);
|
||||||
|
@ -73,6 +78,11 @@ public class Cormorant {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAddressImport(Address address, Date since) throws ServerException {
|
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
|
//Will block until address descriptor has been added
|
||||||
try {
|
try {
|
||||||
bitcoindClient.importAddress(address, since);
|
bitcoindClient.importAddress(address, since);
|
||||||
|
@ -86,7 +96,9 @@ public class Cormorant {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
bitcoindClient.stop();
|
if(bitcoindClient != null) {
|
||||||
|
bitcoindClient.stop();
|
||||||
|
}
|
||||||
if(electrumServer != null) {
|
if(electrumServer != null) {
|
||||||
electrumServer.stop();
|
electrumServer.stop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue