arbitrator always includes dispute payout tx

sync wallet before processing
remove extraneous wallet syncs
This commit is contained in:
woodser 2023-02-20 16:37:25 -05:00
parent 8ec76aa1cd
commit 8820a87286
3 changed files with 60 additions and 68 deletions

View file

@ -734,7 +734,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
UUID.randomUUID().toString(),
getSupportType(),
trade.getSelf().getUpdatedMultisigHex(),
trade.isPayoutPublished() ? null : unsignedPayoutTxHex, // include dispute payout tx if unpublished and arbitrator has their updated multisig info
unsignedPayoutTxHex, // include dispute payout tx if arbitrator has their updated multisig info
deferPublishPayout); // instruct trader to defer publishing payout tx because peer is expected to publish imminently
// send dispute closed message
@ -835,12 +835,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
}
}
// sync and save wallet
trade.syncWallet();
trade.saveWallet();
// create unsigned dispute payout tx
if (!trade.isPayoutPublished()) {
log.info("Arbitrator creating unsigned dispute payout tx for trade {}", trade.getId());
try {
@ -897,10 +892,10 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
trade.getSelf().setUpdatedMultisigHex(trade.getWallet().exportMultisigHex());
return payoutTx;
} catch (Exception e) {
trade.syncWallet();
if (!trade.isPayoutPublished()) throw e;
}
}
}
return null; // can be null if already published or we don't have receiver's multisig hex
}

View file

@ -252,22 +252,19 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
}
dispute.setDisputeResult(disputeResult);
// sync and save wallet
trade.syncWallet();
trade.saveWallet();
// attempt to sign and publish dispute payout tx if given and not already published
if (disputeClosedMessage.getUnsignedPayoutTxHex() != null && !trade.isPayoutPublished()) {
// check wallet connection
trade.checkWalletConnection();
// import multisig hex
List<String> updatedMultisigHexes = new ArrayList<String>();
if (trade.getTradePeer().getUpdatedMultisigHex() != null) updatedMultisigHexes.add(trade.getTradePeer().getUpdatedMultisigHex());
if (trade.getArbitrator().getUpdatedMultisigHex() != null) updatedMultisigHexes.add(trade.getArbitrator().getUpdatedMultisigHex());
if (!updatedMultisigHexes.isEmpty()) trade.getWallet().importMultisigHex(updatedMultisigHexes.toArray(new String[0])); // TODO (monero-project): fails if multisig hex imported individually
// sync and save wallet
trade.syncWallet();
trade.saveWallet();
// wait to sign and publish payout tx if defer flag set
if (disputeClosedMessage.isDeferPublishPayout()) {
log.info("Deferring signing and publishing dispute payout tx for {} {}", trade.getClass().getSimpleName(), trade.getId());

View file

@ -60,7 +60,7 @@ public abstract class SendMailboxMessageTask extends TradeTask {
TradeMailboxMessage message = getTradeMailboxMessage(id);
setStateSent();
NodeAddress peersNodeAddress = getReceiverNodeAddress();
log.info("Send {} to peer {}. tradeId={}, uid={}",
log.info("Send {} to peer {} for {} {}", trade.getClass().getSimpleName(), trade.getId(),
message.getClass().getSimpleName(), peersNodeAddress, message.getTradeId(), message.getUid());
TradeTask task = this;