Skip to content

Commit

Permalink
retry creating withdraw tx 5 attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jul 5, 2024
1 parent ec9f91e commit 4d5b3bf
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
private ChangeListener<String> amountListener;
private ChangeListener<Boolean> amountFocusListener;
private int rowIndex = 0;
private final static int MAX_ATTEMPTS = 3;
boolean sendMax = false;

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -256,7 +255,7 @@ private void onWithdraw() {

// create tx
MoneroTxWallet tx = null;
for (int i = 0; i < MAX_ATTEMPTS; i++) {
for (int i = 0; i < TradeProtocol.MAX_ATTEMPTS; i++) {
try {
log.info("Creating withdraw tx");
long startTime = System.currentTimeMillis();
Expand All @@ -269,8 +268,8 @@ private void onWithdraw() {
break;
} catch (Exception e) {
if (isNotEnoughMoney(e.getMessage())) throw e;
log.warn("Error creating creating withdraw tx, attempt={}/{}, error={}", i + 1, MAX_ATTEMPTS, e.getMessage());
if (i == MAX_ATTEMPTS - 1) throw e;
log.warn("Error creating creating withdraw tx, attempt={}/{}, error={}", i + 1, TradeProtocol.MAX_ATTEMPTS, e.getMessage());
if (i == TradeProtocol.MAX_ATTEMPTS - 1) throw e;
HavenoUtils.waitFor(TradeProtocol.REPROCESS_DELAY_MS); // wait before retrying
}
}
Expand Down

0 comments on commit 4d5b3bf

Please sign in to comment.