mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
instruct to stop monero-wallet-rpc on error opening or creating wallet
This commit is contained in:
parent
ea10093dad
commit
1b37a0ab9b
@ -663,13 +663,14 @@ public class XmrWalletService {
|
|||||||
MoneroRpcConnection connection = connectionsService.getConnection();
|
MoneroRpcConnection connection = connectionsService.getConnection();
|
||||||
if (connection == null || !Boolean.TRUE.equals(connection.isConnected())) throw new RuntimeException("Must be connected to daemon before creating wallet");
|
if (connection == null || !Boolean.TRUE.equals(connection.isConnected())) throw new RuntimeException("Must be connected to daemon before creating wallet");
|
||||||
|
|
||||||
// start monero-wallet-rpc instance
|
|
||||||
MoneroWalletRpc walletRpc = startWalletRpcInstance(port);
|
|
||||||
walletRpc.getRpcConnection().setPrintStackTrace(PRINT_STACK_TRACE);
|
|
||||||
|
|
||||||
// create wallet
|
// create wallet
|
||||||
|
MoneroWalletRpc walletRpc = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
// start monero-wallet-rpc instance
|
||||||
|
walletRpc = startWalletRpcInstance(port);
|
||||||
|
walletRpc.getRpcConnection().setPrintStackTrace(PRINT_STACK_TRACE);
|
||||||
|
|
||||||
// prevent wallet rpc from syncing
|
// prevent wallet rpc from syncing
|
||||||
walletRpc.stopSyncing();
|
walletRpc.stopSyncing();
|
||||||
|
|
||||||
@ -682,20 +683,19 @@ public class XmrWalletService {
|
|||||||
return walletRpc;
|
return walletRpc;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
stopWallet(walletRpc, config.getPath());
|
if (walletRpc != null) stopWallet(walletRpc, config.getPath());
|
||||||
throw e;
|
throw new IllegalStateException("Could not create wallet '" + config.getPath() + "'. Please close Haveno, stop all monero-wallet-rpc processes, and restart Haveno.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MoneroWalletRpc openWalletRpc(MoneroWalletConfig config, Integer port) {
|
private MoneroWalletRpc openWalletRpc(MoneroWalletConfig config, Integer port) {
|
||||||
|
MoneroWalletRpc walletRpc = null;
|
||||||
|
try {
|
||||||
|
|
||||||
// start monero-wallet-rpc instance
|
// start monero-wallet-rpc instance
|
||||||
MoneroWalletRpc walletRpc = startWalletRpcInstance(port);
|
walletRpc = startWalletRpcInstance(port);
|
||||||
walletRpc.getRpcConnection().setPrintStackTrace(PRINT_STACK_TRACE);
|
walletRpc.getRpcConnection().setPrintStackTrace(PRINT_STACK_TRACE);
|
||||||
|
|
||||||
// open wallet
|
|
||||||
try {
|
|
||||||
|
|
||||||
// prevent wallet rpc from syncing
|
// prevent wallet rpc from syncing
|
||||||
walletRpc.stopSyncing();
|
walletRpc.stopSyncing();
|
||||||
|
|
||||||
@ -707,7 +707,7 @@ public class XmrWalletService {
|
|||||||
return walletRpc;
|
return walletRpc;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
stopWallet(walletRpc, config.getPath());
|
if (walletRpc != null) stopWallet(walletRpc, config.getPath());
|
||||||
throw new IllegalStateException("Could not open wallet '" + config.getPath() + "'. Please close Haveno, stop all monero-wallet-rpc processes, and restart Haveno.");
|
throw new IllegalStateException("Could not open wallet '" + config.getPath() + "'. Please close Haveno, stop all monero-wallet-rpc processes, and restart Haveno.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user