mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
reduce logging on failure to sign offer
This commit is contained in:
parent
d69dcae875
commit
8b7e95f614
2 changed files with 11 additions and 14 deletions
|
@ -473,14 +473,16 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
// .ifPresent(errorMsg -> invalidOffers.add(new Tuple2<>(openOffer, errorMsg))));
|
// .ifPresent(errorMsg -> invalidOffers.add(new Tuple2<>(openOffer, errorMsg))));
|
||||||
|
|
||||||
// process pending offers
|
// process pending offers
|
||||||
processPendingOffers(false);
|
processPendingOffers(false, (transaction) -> {}, (errorMessage) -> {
|
||||||
|
log.warn("Error processing pending offers on bootstrap: " + errorMessage);
|
||||||
|
});
|
||||||
|
|
||||||
// register to process pending offers on new block
|
// register to process pending offers on new block
|
||||||
xmrWalletService.addWalletListener(new MoneroWalletListener() {
|
xmrWalletService.addWalletListener(new MoneroWalletListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onNewBlock(long height) {
|
public void onNewBlock(long height) {
|
||||||
|
|
||||||
// process pending offers on new block a few times
|
// process each pending offer on new block a few times, then rely on period republish
|
||||||
processPendingOffers(true, (transaction) -> {}, (errorMessage) -> {
|
processPendingOffers(true, (transaction) -> {}, (errorMessage) -> {
|
||||||
log.warn("Error processing pending offers on new block {}: {}", height, errorMessage);
|
log.warn("Error processing pending offers on new block {}: {}", height, errorMessage);
|
||||||
});
|
});
|
||||||
|
@ -856,13 +858,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Place offer helpers
|
// Place offer helpers
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void processPendingOffers(boolean skipOffersWithTooManyAttempts) {
|
|
||||||
processPendingOffers(skipOffersWithTooManyAttempts, (transaction) -> {}, (errorMessage) -> {
|
|
||||||
log.warn("Error processing pending offers: " + errorMessage);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processPendingOffers(boolean skipOffersWithTooManyAttempts,
|
private void processPendingOffers(boolean skipOffersWithTooManyAttempts,
|
||||||
TransactionResultHandler resultHandler, // TODO (woodser): transaction not needed with result handler
|
TransactionResultHandler resultHandler, // TODO (woodser): transaction not needed with result handler
|
||||||
ErrorMessageHandler errorMessageHandler) {
|
ErrorMessageHandler errorMessageHandler) {
|
||||||
|
@ -878,8 +873,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}, errorMessage -> {
|
}, errorMessage -> {
|
||||||
if (!pendingOffer.isCanceled()) {
|
if (!pendingOffer.isCanceled()) {
|
||||||
log.warn("Error processing pending offer, offerId={}, attempt={}, error={}", pendingOffer.getId(), pendingOffer.getNumProcessingAttempts(), errorMessage);
|
String warnMessage = "Error processing pending offer, offerId=" + pendingOffer.getId() + ", attempt=" + pendingOffer.getNumProcessingAttempts() + ": " + errorMessage;
|
||||||
errorMessages.add(errorMessage);
|
errorMessages.add(warnMessage);
|
||||||
|
|
||||||
// cancel offer if invalid
|
// cancel offer if invalid
|
||||||
if (pendingOffer.getOffer().getState() == Offer.State.INVALID) {
|
if (pendingOffer.getOffer().getState() == Offer.State.INVALID) {
|
||||||
|
@ -892,8 +887,11 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
HavenoUtils.awaitLatch(latch);
|
HavenoUtils.awaitLatch(latch);
|
||||||
}
|
}
|
||||||
requestPersistence();
|
requestPersistence();
|
||||||
if (errorMessages.size() > 0) errorMessageHandler.handleErrorMessage(errorMessages.toString());
|
if (errorMessages.isEmpty()) {
|
||||||
else resultHandler.handleResult(null);
|
if (resultHandler != null) resultHandler.handleResult(null);
|
||||||
|
} else {
|
||||||
|
if (errorMessageHandler != null) errorMessageHandler.handleErrorMessage(errorMessages.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, THREAD_ID);
|
}, THREAD_ID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,6 @@ public class PlaceOfferProtocol {
|
||||||
if (timeoutTimer != null) {
|
if (timeoutTimer != null) {
|
||||||
taskRunner.cancel();
|
taskRunner.cancel();
|
||||||
if (!model.getOpenOffer().isCanceled()) {
|
if (!model.getOpenOffer().isCanceled()) {
|
||||||
log.error(errorMessage);
|
|
||||||
model.getOpenOffer().getOffer().setErrorMessage(errorMessage);
|
model.getOpenOffer().getOffer().setErrorMessage(errorMessage);
|
||||||
}
|
}
|
||||||
stopTimeoutTimer();
|
stopTimeoutTimer();
|
||||||
|
|
Loading…
Reference in a new issue