diff --git a/core/src/main/java/haveno/core/trade/HavenoUtils.java b/core/src/main/java/haveno/core/trade/HavenoUtils.java index 634d97a923..22e29d8ad2 100644 --- a/core/src/main/java/haveno/core/trade/HavenoUtils.java +++ b/core/src/main/java/haveno/core/trade/HavenoUtils.java @@ -72,6 +72,7 @@ public class HavenoUtils { public static final int ARBITRATOR_ACK_TIMEOUT_SECONDS = 30; // configure fees + public static final boolean ARBITRATOR_ASSIGNS_TRADE_FEE_ADDRESS = true; public static final double MAKER_FEE_PCT = 0.0015; // 0.15% public static final double TAKER_FEE_PCT = 0.0075; // 0.75% public static final double PENALTY_FEE_PCT = 0.02; // 2% @@ -432,8 +433,17 @@ public class HavenoUtils { // ----------------------------- OTHER UTILS ------------------------------ - public static String getTradeFeeAddress() { - return xmrWalletService.getBaseAddressEntry().getAddressString(); + public static String getGlobalTradeFeeAddress() { + switch (Config.baseCurrencyNetwork()) { + case XMR_LOCAL: + return "Bd37nTGHjL3RvPxc9dypzpWiXQrPzxxG4RsWAasD9CV2iZ1xfFZ7mzTKNDxWBfsqQSUimctAsGtTZ8c8bZJy35BYL9jYj88"; + case XMR_STAGENET: + return "5B11hTJdG2XDNwjdKGLRxwSLwDhkbGg7C7UEAZBxjE6FbCeRMjudrpNACmDNtWPiSnNfjDQf39QRjdtdgoL69txv81qc2Mc"; + case XMR_MAINNET: + throw new RuntimeException("Mainnet fee address not implemented"); + default: + throw new RuntimeException("Unhandled base currency network: " + Config.baseCurrencyNetwork()); + } } public static String getBurnAddress() { diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/ArbitratorSendInitTradeOrMultisigRequests.java b/core/src/main/java/haveno/core/trade/protocol/tasks/ArbitratorSendInitTradeOrMultisigRequests.java index d6d0685ff1..53b331ae97 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/ArbitratorSendInitTradeOrMultisigRequests.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/ArbitratorSendInitTradeOrMultisigRequests.java @@ -126,8 +126,9 @@ public class ArbitratorSendInitTradeOrMultisigRequests extends TradeTask { trade.getSelf().setPreparedMultisigHex(preparedHex); // set trade fee address + String address = HavenoUtils.ARBITRATOR_ASSIGNS_TRADE_FEE_ADDRESS ? trade.getXmrWalletService().getBaseAddressEntry().getAddressString() : HavenoUtils.getGlobalTradeFeeAddress(); if (trade.getProcessModel().getTradeFeeAddress() == null) { - trade.getProcessModel().setTradeFeeAddress(HavenoUtils.getTradeFeeAddress()); + trade.getProcessModel().setTradeFeeAddress(address); } // create message to initialize multisig diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessInitMultisigRequest.java b/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessInitMultisigRequest.java index 18761926b3..78fafed62b 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessInitMultisigRequest.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessInitMultisigRequest.java @@ -21,6 +21,7 @@ import haveno.common.app.Version; import haveno.common.crypto.PubKeyRing; import haveno.common.taskrunner.TaskRunner; import haveno.core.trade.ArbitratorTrade; +import haveno.core.trade.HavenoUtils; import haveno.core.trade.MakerTrade; import haveno.core.trade.TakerTrade; import haveno.core.trade.Trade; @@ -65,9 +66,13 @@ public class ProcessInitMultisigRequest extends TradeTask { // get sender TradePeer sender = trade.getTradePeer(processModel.getTempTradePeerNodeAddress()); - // set trade fee address from arbitrator - if (request.getTradeFeeAddress() != null && sender == trade.getArbitrator()) { - trade.getProcessModel().setTradeFeeAddress(request.getTradeFeeAddress()); + // set trade fee address + if (HavenoUtils.ARBITRATOR_ASSIGNS_TRADE_FEE_ADDRESS) { + if (request.getTradeFeeAddress() != null && sender == trade.getArbitrator()) { + trade.getProcessModel().setTradeFeeAddress(request.getTradeFeeAddress()); + } + } else { + trade.getProcessModel().setTradeFeeAddress(HavenoUtils.getGlobalTradeFeeAddress()); } // reconcile peer's established multisig hex with message