mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Replace success/failure with booleans
This commit is contained in:
parent
e5aee1ca07
commit
bfab6ffc2e
1 changed files with 6 additions and 9 deletions
|
@ -208,23 +208,20 @@ public class XmrAutoConfirmationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleProofResult(XmrAutoConfirmResult result, Trade trade) {
|
private boolean handleProofResult(XmrAutoConfirmResult result, Trade trade) {
|
||||||
boolean success = true;
|
|
||||||
boolean failure = false;
|
|
||||||
|
|
||||||
// here we count the Trade's API results from all
|
// here we count the Trade's API results from all
|
||||||
// different serviceAddress and figure out when all have finished
|
// different serviceAddress and figure out when all have finished
|
||||||
int resultsCountdown = txProofResultsPending.getOrDefault(trade.getId(), 0);
|
int resultsCountdown = txProofResultsPending.getOrDefault(trade.getId(), 0);
|
||||||
if (resultsCountdown < 0) { // see failure scenario below
|
if (resultsCountdown < 0) { // see failure scenario below
|
||||||
log.info("Ignoring stale API result [{}], tradeId {} due to previous error",
|
log.info("Ignoring stale API result [{}], tradeId {} due to previous error",
|
||||||
result.getState(), trade.getShortId());
|
result.getState(), trade.getShortId());
|
||||||
return failure; // terminate any pending responses
|
return false; // terminate any pending responses
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trade.isPayoutPublished()) {
|
if (trade.isPayoutPublished()) {
|
||||||
log.warn("Trade payout already published, shutting down all open API requests for this trade {}",
|
log.warn("Trade payout already published, shutting down all open API requests for this trade {}",
|
||||||
trade.getShortId());
|
trade.getShortId());
|
||||||
txProofResultsPending.remove(trade.getId());
|
txProofResultsPending.remove(trade.getId());
|
||||||
return failure;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.isPendingState()) {
|
if (result.isPendingState()) {
|
||||||
|
@ -232,7 +229,7 @@ public class XmrAutoConfirmationManager {
|
||||||
result.getState(), trade.getShortId());
|
result.getState(), trade.getShortId());
|
||||||
trade.setAutoConfirmResult(result); // this updates the GUI with the status..
|
trade.setAutoConfirmResult(result); // this updates the GUI with the status..
|
||||||
// Repeating the requests is handled in XmrTransferProofRequester
|
// Repeating the requests is handled in XmrTransferProofRequester
|
||||||
return success;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.isSuccessState()) {
|
if (result.isSuccessState()) {
|
||||||
|
@ -241,7 +238,7 @@ public class XmrAutoConfirmationManager {
|
||||||
result.getState(), resultsCountdown, trade.getShortId());
|
result.getState(), resultsCountdown, trade.getShortId());
|
||||||
if (resultsCountdown > 0) {
|
if (resultsCountdown > 0) {
|
||||||
txProofResultsPending.put(trade.getId(), resultsCountdown); // track proof result count
|
txProofResultsPending.put(trade.getId(), resultsCountdown); // track proof result count
|
||||||
return success; // not all APIs have confirmed yet
|
return true; // not all APIs have confirmed yet
|
||||||
}
|
}
|
||||||
// we've received the final PROOF_OK, all good here.
|
// we've received the final PROOF_OK, all good here.
|
||||||
txProofResultsPending.remove(trade.getId());
|
txProofResultsPending.remove(trade.getId());
|
||||||
|
@ -257,7 +254,7 @@ public class XmrAutoConfirmationManager {
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
});
|
});
|
||||||
return success;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// error case. any validation error from XmrProofRequester or XmrProofInfo.check
|
// error case. any validation error from XmrProofRequester or XmrProofInfo.check
|
||||||
|
@ -269,7 +266,7 @@ public class XmrAutoConfirmationManager {
|
||||||
trade.setAutoConfirmResult(result); // this updates the GUI with the status..
|
trade.setAutoConfirmResult(result); // this updates the GUI with the status..
|
||||||
resultsCountdown = -1; // signal all API requestors to cease
|
resultsCountdown = -1; // signal all API requestors to cease
|
||||||
txProofResultsPending.put(trade.getId(), resultsCountdown); // track proof result count
|
txProofResultsPending.put(trade.getId(), resultsCountdown); // track proof result count
|
||||||
return failure;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAutoConfDisabledByFilter() {
|
private boolean isAutoConfDisabledByFilter() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue