diff --git a/build.gradle b/build.gradle index c8a80a9075..e93d74c1d4 100644 --- a/build.gradle +++ b/build.gradle @@ -506,16 +506,16 @@ configure(project(':core')) { } else { ext.extractArchiveTarGz(moneroArchiveFile, localnetDir) } + } - // add the current platform's monero dependencies into the resources folder for installation - copy { - from "${monerodFile}" - into "${project(':core').projectDir}/src/main/resources/bin" - } - copy { - from "${moneroRpcFile}" - into "${project(':core').projectDir}/src/main/resources/bin" - } + // add the current platform's monero dependencies into the resources folder for installation + copy { + from "${monerodFile}" + into "${project(':core').projectDir}/src/main/resources/bin" + } + copy { + from "${moneroRpcFile}" + into "${project(':core').projectDir}/src/main/resources/bin" } } diff --git a/common/src/main/java/haveno/common/crypto/KeyRing.java b/common/src/main/java/haveno/common/crypto/KeyRing.java index 89552c7c74..580b3b285a 100644 --- a/common/src/main/java/haveno/common/crypto/KeyRing.java +++ b/common/src/main/java/haveno/common/crypto/KeyRing.java @@ -110,7 +110,7 @@ public final class KeyRing { * @param password The password to unlock the keys or to generate new keys, nullable. */ public void generateKeys(String password) { - if (isUnlocked()) throw new Error("Current keyring must be closed to generate new keys"); + if (isUnlocked()) throw new IllegalStateException("Current keyring must be closed to generate new keys"); symmetricKey = Encryption.generateSecretKey(256); signatureKeyPair = Sig.generateKeyPair(); encryptionKeyPair = Encryption.generateKeyPair(); diff --git a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java index 8432da2aed..5f047ee7f6 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -415,7 +415,7 @@ public class XmrWalletService extends XmrWalletBase { public void deleteWallet(String walletName) { assertNotPath(walletName); log.info("{}.deleteWallet({})", getClass().getSimpleName(), walletName); - if (!walletExists(walletName)) throw new Error("Wallet does not exist at path: " + walletName); + if (!walletExists(walletName)) throw new RuntimeException("Wallet does not exist at path: " + walletName); String path = walletDir.toString() + File.separator + walletName; if (!new File(path).delete()) throw new RuntimeException("Failed to delete wallet cache file: " + path); if (!new File(path + KEYS_FILE_POSTFIX).delete()) throw new RuntimeException("Failed to delete wallet keys file: " + path + KEYS_FILE_POSTFIX); @@ -755,7 +755,7 @@ public class XmrWalletService extends XmrWalletBase { if (keyImages != null) { Set txKeyImages = new HashSet(); for (MoneroOutput input : tx.getInputs()) txKeyImages.add(input.getKeyImage().getHex()); - if (!txKeyImages.equals(new HashSet(keyImages))) throw new Error("Tx inputs do not match claimed key images"); + if (!txKeyImages.equals(new HashSet(keyImages))) throw new RuntimeException("Tx inputs do not match claimed key images"); } // verify unlock height @@ -764,7 +764,7 @@ public class XmrWalletService extends XmrWalletBase { // verify miner fee BigInteger minerFeeEstimate = getElevatedFeeEstimate(tx.getWeight()); double minerFeeDiff = tx.getFee().subtract(minerFeeEstimate).abs().doubleValue() / minerFeeEstimate.doubleValue(); - if (minerFeeDiff > MINER_FEE_TOLERANCE) throw new Error("Miner fee is not within " + (MINER_FEE_TOLERANCE * 100) + "% of estimated fee, expected " + minerFeeEstimate + " but was " + tx.getFee()); + if (minerFeeDiff > MINER_FEE_TOLERANCE) throw new RuntimeException("Miner fee is not within " + (MINER_FEE_TOLERANCE * 100) + "% of estimated fee, expected " + minerFeeEstimate + " but was " + tx.getFee()); log.info("Trade tx fee {} is within tolerance, diff%={}", tx.getFee(), minerFeeDiff); // verify proof to fee address @@ -1739,7 +1739,7 @@ public class XmrWalletService extends XmrWalletBase { private MoneroWalletRpc startWalletRpcInstance(Integer port, boolean applyProxyUri) { // check if monero-wallet-rpc exists - if (!new File(MONERO_WALLET_RPC_PATH).exists()) throw new Error("monero-wallet-rpc executable doesn't exist at path " + MONERO_WALLET_RPC_PATH + if (!new File(MONERO_WALLET_RPC_PATH).exists()) throw new RuntimeException("monero-wallet-rpc executable doesn't exist at path " + MONERO_WALLET_RPC_PATH + "; copy monero-wallet-rpc to the project root or set WalletConfig.java MONERO_WALLET_RPC_PATH for your system"); // build command to start monero-wallet-rpc