Skip to content

Commit

Permalink
do not reprocess error on submit multisig tx with not enough signers #…
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Aug 21, 2024
1 parent d3ee734 commit cd7feab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ private MoneroTxSet signAndPublishDisputePayoutTx(Trade trade) {
break;
} catch (Exception e) {
if (trade.isPayoutPublished()) throw new IllegalStateException("Payout tx already published for " + trade.getClass().getSimpleName() + " " + trade.getShortId());
if (HavenoUtils.isNotEnoughSigners(e)) throw new IllegalArgumentException(e);
log.warn("Failed to submit dispute payout tx, tradeId={}, attempt={}/{}, error={}", trade.getShortId(), i + 1, TradeProtocol.MAX_ATTEMPTS, e.getMessage());
if (i == TradeProtocol.MAX_ATTEMPTS - 1) throw e;
if (trade.getXmrConnectionService().isConnected()) trade.requestSwitchToNextBestConnection(sourceConnection);
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/java/haveno/core/trade/HavenoUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -520,4 +520,8 @@ public static boolean isReadTimeout(Exception e) {
public static boolean isUnresponsive(Exception e) {
return isConnectionRefused(e) || isReadTimeout(e);
}

public static boolean isNotEnoughSigners(Exception e) {
return e != null && e.getMessage().contains("Not enough signers");
}
}
2 changes: 2 additions & 0 deletions core/src/main/java/haveno/core/trade/Trade.java
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,8 @@ private void doProcessPayoutTx(String payoutTxHex, boolean sign, boolean publish
wallet.submitMultisigTxHex(payoutTxHex);
setPayoutStatePublished();
} catch (Exception e) {
if (isPayoutPublished()) throw new IllegalStateException("Payout tx already published for " + getClass().getSimpleName() + " " + getShortId());
if (HavenoUtils.isNotEnoughSigners(e)) throw new IllegalArgumentException(e);
throw new RuntimeException("Failed to submit payout tx for " + getClass().getSimpleName() + " " + getId(), e);
}
}
Expand Down

0 comments on commit cd7feab

Please sign in to comment.