mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-01-05 10:29:36 +00:00
arbitrator submits deposit txs and checks result before relaying
This commit is contained in:
parent
9aa6bbeff6
commit
79db2bc0af
1 changed files with 9 additions and 2 deletions
|
@ -31,11 +31,15 @@ import bisq.core.trade.protocol.TradingPeer;
|
||||||
import bisq.core.util.ParsingUtils;
|
import bisq.core.util.ParsingUtils;
|
||||||
import bisq.network.p2p.NodeAddress;
|
import bisq.network.p2p.NodeAddress;
|
||||||
import bisq.network.p2p.SendDirectMessageListener;
|
import bisq.network.p2p.SendDirectMessageListener;
|
||||||
|
import common.utils.JsonUtils;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import monero.daemon.MoneroDaemon;
|
import monero.daemon.MoneroDaemon;
|
||||||
|
import monero.daemon.model.MoneroSubmitTxResult;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ArbitratorProcessDepositRequest extends TradeTask {
|
public class ArbitratorProcessDepositRequest extends TradeTask {
|
||||||
|
@ -103,8 +107,11 @@ public class ArbitratorProcessDepositRequest extends TradeTask {
|
||||||
|
|
||||||
// relay txs
|
// relay txs
|
||||||
MoneroDaemon daemon = trade.getXmrWalletService().getDaemon();
|
MoneroDaemon daemon = trade.getXmrWalletService().getDaemon();
|
||||||
daemon.submitTxHex(processModel.getMaker().getDepositTxHex()); // TODO (woodser): check that result is good. will need to release funds if one is submitted
|
MoneroSubmitTxResult makerResult = daemon.submitTxHex(processModel.getMaker().getDepositTxHex(), true);
|
||||||
daemon.submitTxHex(processModel.getTaker().getDepositTxHex());
|
MoneroSubmitTxResult takerResult = daemon.submitTxHex(processModel.getTaker().getDepositTxHex(), true);
|
||||||
|
if (!makerResult.isGood()) throw new RuntimeException("Error submitting maker deposit tx: " + JsonUtils.serialize(makerResult));
|
||||||
|
if (!takerResult.isGood()) throw new RuntimeException("Error submitting taker deposit tx: " + JsonUtils.serialize(takerResult));
|
||||||
|
daemon.relayTxsByHash(Arrays.asList(processModel.getMaker().getDepositTxHash(), processModel.getTaker().getDepositTxHash()));
|
||||||
|
|
||||||
// update trade state
|
// update trade state
|
||||||
log.info("Arbitrator submitted deposit txs for trade " + trade.getId());
|
log.info("Arbitrator submitted deposit txs for trade " + trade.getId());
|
||||||
|
|
Loading…
Reference in a new issue