seller creates new payout tx if error signing buyer's payout tx

This commit is contained in:
woodser 2023-04-26 08:57:05 -04:00
parent 6d2819bde7
commit ab55f1f54a

View File

@ -46,15 +46,15 @@ public class SellerPreparePaymentReceivedMessage extends TradeTask {
// verify, sign, and publish payout tx if given. otherwise create payout tx
if (trade.getPayoutTxHex() != null) {
try {
log.info("Seller verifying, signing, and publishing payout tx for trade {}", trade.getId());
trade.verifyPayoutTx(trade.getPayoutTxHex(), true, true);
} catch (Exception e) {
log.warn("Error verifying, signing, and publishing payout tx for trade {}: {}. Creating unsigned payout tx", trade.getId(), e.getMessage());
createUnsignedPayoutTx();
}
} else {
// create unsigned payout tx
log.info("Seller creating unsigned payout tx for trade {}", trade.getId());
MoneroTxWallet payoutTx = trade.createPayoutTx();
trade.setPayoutTx(payoutTx);
trade.setPayoutTxHex(payoutTx.getTxSet().getMultisigTxHex());
createUnsignedPayoutTx();
}
} else if (processModel.getPaymentReceivedMessage().getSignedPayoutTxHex() != null && !trade.isPayoutPublished()) {
@ -69,4 +69,11 @@ public class SellerPreparePaymentReceivedMessage extends TradeTask {
failed(t);
}
}
private void createUnsignedPayoutTx() {
log.info("Seller creating unsigned payout tx for trade {}", trade.getId());
MoneroTxWallet payoutTx = trade.createPayoutTx();
trade.setPayoutTx(payoutTx);
trade.setPayoutTxHex(payoutTx.getTxSet().getMultisigTxHex());
}
}