mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Add check if rpc is used
This commit is contained in:
parent
30df6f9721
commit
1d53055e2c
2 changed files with 7 additions and 3 deletions
|
@ -65,6 +65,7 @@ public class BsqBlockchainManager {
|
|||
// new snapshot is block 90. We only persist at the new snapshot, so we always re-parse from latest snapshot after
|
||||
// a restart.
|
||||
private static final int SNAPSHOT_TRIGGER = 300000;
|
||||
private final boolean connectToBtcCore;
|
||||
|
||||
public static int getSnapshotTrigger() {
|
||||
return SNAPSHOT_TRIGGER;
|
||||
|
@ -97,6 +98,7 @@ public class BsqBlockchainManager {
|
|||
BisqEnvironment bisqEnvironment,
|
||||
@Named(Storage.DIR_KEY) File storageDir,
|
||||
Storage<PlainTextWrapper> jsonStorage,
|
||||
@Named(RpcOptionKeys.RPC_USER) String rpcUser,
|
||||
@Named(RpcOptionKeys.DUMP_BLOCKCHAIN_DATA) boolean dumpBlockchainData) {
|
||||
this.blockchainService = blockchainService;
|
||||
this.storageDir = storageDir;
|
||||
|
@ -104,6 +106,7 @@ public class BsqBlockchainManager {
|
|||
this.dumpBlockchainData = dumpBlockchainData;
|
||||
this.bitcoinNetwork = bisqEnvironment.getBitcoinNetwork();
|
||||
|
||||
connectToBtcCore = rpcUser != null && !rpcUser.isEmpty();
|
||||
bsqUTXOMap = new BsqUTXOMap(storageDir);
|
||||
bsqTXOMap = new BsqTXOMap(storageDir);
|
||||
|
||||
|
@ -212,6 +215,7 @@ public class BsqBlockchainManager {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void onAllServicesInitialized(ErrorMessageHandler errorMessageHandler) {
|
||||
if (connectToBtcCore)
|
||||
blockchainService.setup(this::blockchainServiceSetupCompleted, errorMessageHandler);
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ public class BsqBlockchainRpcService extends BsqBlockchainService {
|
|||
} catch (Throwable e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
throw new BsqBlockchainException(e.getMessage(), e);
|
||||
throw new BsqBlockchainException(e.toString(), e);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class BsqBlockchainRpcService extends BsqBlockchainService {
|
|||
public void onFailure(@NotNull Throwable throwable) {
|
||||
UserThread.execute(() -> {
|
||||
log.error(throwable.toString());
|
||||
errorMessageHandler.handleErrorMessage(throwable.getMessage());
|
||||
errorMessageHandler.handleErrorMessage(throwable.toString());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue