mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-06 14:27:34 +00:00
use default priority for trade transactions
This commit is contained in:
parent
b72159fcf8
commit
4a82c69507
3 changed files with 25 additions and 17 deletions
18
build.gradle
18
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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -815,9 +815,9 @@
|
|||
<sha256 value="c92e2ca40a3f2474d61e56831aeb379cf8ae3dddeea61b4a828cee2d99f71f38" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="io.github.woodser" name="monero-java" version="0.8.35">
|
||||
<artifact name="monero-java-0.8.35.jar">
|
||||
<sha256 value="bd6e7ae8cba64928f16279cb9d21f84484ca7e7377ee7da68bd6686762bb1016" origin="Generated by Gradle"/>
|
||||
<component group="io.github.woodser" name="monero-java" version="0.8.36">
|
||||
<artifact name="monero-java-0.8.36.jar">
|
||||
<sha256 value="56a3a3b9ad6b9a094e774c337c268e60825ed07f19c0f0368cd90f12c83f7946" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="io.grpc" name="grpc-api" version="1.42.1">
|
||||
|
|
Loading…
Reference in a new issue