From 4a82c695072887362995ef8877ede4cf19cb7508 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 13 Feb 2025 10:30:15 -0500 Subject: [PATCH] use default priority for trade transactions --- build.gradle | 18 +++++++++--------- .../core/xmr/wallet/XmrWalletService.java | 18 +++++++++++++----- gradle/verification-metadata.xml | 6 +++--- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index e93d74c1d4..74e776cb2b 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ configure(subprojects) { gsonVersion = '2.8.5' guavaVersion = '32.1.1-jre' guiceVersion = '7.0.0' - moneroJavaVersion = '0.8.35' + moneroJavaVersion = '0.8.36' httpclient5Version = '5.0' hamcrestVersion = '2.2' httpclientVersion = '4.5.12' @@ -457,14 +457,14 @@ configure(project(':core')) { doLast { // get monero binaries download url Map moneroBinaries = [ - 'linux-x86_64' : 'https://github.com/haveno-dex/monero/releases/download/release4/monero-bins-haveno-linux-x86_64.tar.gz', - 'linux-x86_64-sha256' : '0810808292fd5ad595a46a7fcc8ecb28d251d80f8d75c0e7a7d51afbeb413b68', - 'linux-aarch64' : 'https://github.com/haveno-dex/monero/releases/download/release4/monero-bins-haveno-linux-aarch64.tar.gz', - 'linux-aarch64-sha256' : '61222ee8e2021aaf59ab8813543afc5548f484190ee9360bc9cfa8fdf21cc1de', - 'mac' : 'https://github.com/haveno-dex/monero/releases/download/release4/monero-bins-haveno-mac.tar.gz', - 'mac-sha256' : '5debb8d8d8dd63809e8351368a11aa85c47987f1a8a8f2dcca343e60bcff3287', - 'windows' : 'https://github.com/haveno-dex/monero/releases/download/release4/monero-bins-haveno-windows.zip', - 'windows-sha256' : 'd7c14f029db37ae2a8bc6b74c35f572283257df5fbcc8cc97b704d1a97be9888' + 'linux-x86_64' : 'https://github.com/haveno-dex/monero/releases/download/release5/monero-bins-haveno-linux-x86_64.tar.gz', + 'linux-x86_64-sha256' : '92003b6d9104e8fe3c4dff292b782ed9b82b157aaff95200fda35e5c3dcb733a', + 'linux-aarch64' : 'https://github.com/haveno-dex/monero/releases/download/release5/monero-bins-haveno-linux-aarch64.tar.gz', + 'linux-aarch64-sha256' : '18b069c6c474ce18efea261c875a4d54022520e888712b2a56524d9c92f133b1', + 'mac' : 'https://github.com/haveno-dex/monero/releases/download/release5/monero-bins-haveno-mac.tar.gz', + 'mac-sha256' : 'd308352191cd5a9e5e3932ad15869e033e22e209de459f4fd6460b111377dae2', + 'windows' : 'https://github.com/haveno-dex/monero/releases/download/release5/monero-bins-haveno-windows.zip', + 'windows-sha256' : '9c9e1994d4738e2a89ca28bef343bcad460ea6c06e0dd40de8278ab3033bd6c7' ] String osKey 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 5f047ee7f6..0592fbdd59 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -112,7 +112,7 @@ public class XmrWalletService extends XmrWalletBase { public static final String MONERO_WALLET_RPC_NAME = Utilities.isWindows() ? "monero-wallet-rpc.exe" : "monero-wallet-rpc"; public static final String MONERO_WALLET_RPC_PATH = MONERO_BINS_DIR + File.separator + MONERO_WALLET_RPC_NAME; public static final double MINER_FEE_TOLERANCE = 0.25; // miner fee must be within percent of estimated fee - public static final MoneroTxPriority PROTOCOL_FEE_PRIORITY = MoneroTxPriority.ELEVATED; + public static final MoneroTxPriority PROTOCOL_FEE_PRIORITY = MoneroTxPriority.DEFAULT; public static final int MONERO_LOG_LEVEL = -1; // monero library log level, -1 to disable private static final MoneroNetworkType MONERO_NETWORK_TYPE = getMoneroNetworkType(); private static final MoneroWalletRpcManager MONERO_WALLET_RPC_MANAGER = new MoneroWalletRpcManager(); @@ -762,9 +762,9 @@ public class XmrWalletService extends XmrWalletBase { if (!BigInteger.ZERO.equals(tx.getUnlockTime())) throw new RuntimeException("Unlock height must be 0"); // verify miner fee - BigInteger minerFeeEstimate = getElevatedFeeEstimate(tx.getWeight()); + BigInteger minerFeeEstimate = getFeeEstimate(tx.getWeight()); double minerFeeDiff = tx.getFee().subtract(minerFeeEstimate).abs().doubleValue() / minerFeeEstimate.doubleValue(); - 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()); + 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() + ", diff%=" + minerFeeDiff); log.info("Trade tx fee {} is within tolerance, diff%={}", tx.getFee(), minerFeeDiff); // verify proof to fee address @@ -824,11 +824,19 @@ public class XmrWalletService extends XmrWalletBase { * @param txWeight - the tx weight * @return the tx fee estimate */ - private BigInteger getElevatedFeeEstimate(long txWeight) { + private BigInteger getFeeEstimate(long txWeight) { + + // get fee priority + MoneroTxPriority priority; + if (PROTOCOL_FEE_PRIORITY == MoneroTxPriority.DEFAULT) { + priority = wallet.getDefaultFeePriority(); + } else { + priority = PROTOCOL_FEE_PRIORITY; + } // get fee estimates per kB from daemon MoneroFeeEstimate feeEstimates = getDaemon().getFeeEstimate(); - BigInteger baseFeeEstimate = feeEstimates.getFees().get(2); // get elevated fee per kB + BigInteger baseFeeEstimate = feeEstimates.getFees().get(priority.ordinal() - 1); BigInteger qmask = feeEstimates.getQuantizationMask(); log.info("Monero base fee estimate={}, qmask={}", baseFeeEstimate, qmask); diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 97ff8bba43..069e08177b 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -815,9 +815,9 @@ - - - + + +