mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-28 16:47:25 -04:00
bump offer protocol version, do not verify miner fee for outdated trades
This commit is contained in:
parent
181fc4d620
commit
0896e10d97
2 changed files with 16 additions and 11 deletions
|
@ -110,8 +110,9 @@ public class Version {
|
||||||
// For the switch to version 2, offers created with the old version will become invalid and have to be canceled.
|
// For the switch to version 2, offers created with the old version will become invalid and have to be canceled.
|
||||||
// For the switch to version 3, offers created with the old version can be migrated to version 3 just by opening
|
// For the switch to version 3, offers created with the old version can be migrated to version 3 just by opening
|
||||||
// the Haveno app.
|
// the Haveno app.
|
||||||
// VERSION = 0.0.1 -> TRADE_PROTOCOL_VERSION = 1
|
// Version = 0.0.1 -> TRADE_PROTOCOL_VERSION = 1
|
||||||
public static final int TRADE_PROTOCOL_VERSION = 1;
|
// Version = 1.0.19 -> TRADE_PROTOCOL_VERSION = 2
|
||||||
|
public static final int TRADE_PROTOCOL_VERSION = 2;
|
||||||
private static String p2pMessageVersion;
|
private static String p2pMessageVersion;
|
||||||
|
|
||||||
public static String getP2PMessageVersion() {
|
public static String getP2PMessageVersion() {
|
||||||
|
|
|
@ -1430,6 +1430,9 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// verify miner fee is within tolerance unless outdated offer version
|
||||||
|
if (getOffer().getOfferPayload().getProtocolVersion() >= 2) {
|
||||||
|
|
||||||
// verify fee is within tolerance by recreating payout tx
|
// verify fee is within tolerance by recreating payout tx
|
||||||
// TODO (monero-project): creating tx will require exchanging updated multisig hex if message needs reprocessed. provide weight with describe_transfer so fee can be estimated?
|
// TODO (monero-project): creating tx will require exchanging updated multisig hex if message needs reprocessed. provide weight with describe_transfer so fee can be estimated?
|
||||||
log.info("Creating fee estimate tx for {} {}", getClass().getSimpleName(), getId());
|
log.info("Creating fee estimate tx for {} {}", getClass().getSimpleName(), getId());
|
||||||
|
@ -1439,6 +1442,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
||||||
double feeDiff = payoutTx.getFee().subtract(feeEstimate).abs().doubleValue() / feeEstimate.doubleValue(); // TODO: use BigDecimal?
|
double feeDiff = payoutTx.getFee().subtract(feeEstimate).abs().doubleValue() / feeEstimate.doubleValue(); // TODO: use BigDecimal?
|
||||||
if (feeDiff > XmrWalletService.MINER_FEE_TOLERANCE) throw new IllegalArgumentException("Miner fee is not within " + (XmrWalletService.MINER_FEE_TOLERANCE * 100) + "% of estimated fee, expected " + feeEstimate + " but was " + payoutTx.getFee());
|
if (feeDiff > XmrWalletService.MINER_FEE_TOLERANCE) throw new IllegalArgumentException("Miner fee is not within " + (XmrWalletService.MINER_FEE_TOLERANCE * 100) + "% of estimated fee, expected " + feeEstimate + " but was " + payoutTx.getFee());
|
||||||
log.info("Payout tx fee {} is within tolerance, diff %={}", payoutTx.getFee(), feeDiff);
|
log.info("Payout tx fee {} is within tolerance, diff %={}", payoutTx.getFee(), feeDiff);
|
||||||
|
}
|
||||||
|
|
||||||
// set signed payout tx hex
|
// set signed payout tx hex
|
||||||
setPayoutTxHex(signedPayoutTxHex);
|
setPayoutTxHex(signedPayoutTxHex);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue