From ab55f1f54a690af175fdb7528b3e7b83a593eebf Mon Sep 17 00:00:00 2001 From: woodser Date: Wed, 26 Apr 2023 08:57:05 -0400 Subject: [PATCH] seller creates new payout tx if error signing buyer's payout tx --- .../SellerPreparePaymentReceivedMessage.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/SellerPreparePaymentReceivedMessage.java b/core/src/main/java/haveno/core/trade/protocol/tasks/SellerPreparePaymentReceivedMessage.java index 03137084f4..3bc794e9f1 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/SellerPreparePaymentReceivedMessage.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/SellerPreparePaymentReceivedMessage.java @@ -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) { - log.info("Seller verifying, signing, and publishing payout tx for trade {}", trade.getId()); - trade.verifyPayoutTx(trade.getPayoutTxHex(), true, true); + 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()); + } }