Skip to content

Commit

Permalink
Log at debug the first error when adding a tx for the sender fails (h…
Browse files Browse the repository at this point in the history
…yperledger#6846)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
  • Loading branch information
fab-10 authored and jflo committed Jun 7, 2024
1 parent 3b7ab33 commit 68ade17
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,25 @@ private TransactionAddedResult reconcileAndRetryAdd(
final Throwable throwable) {
// in case something unexpected happened, log this sender txs, force a reconcile and retry
// another time
// ToDo: demote to debug when Layered TxPool is out of preview
LOG.warn(
"Unexpected error {} when adding transaction {}, current sender status {}",
throwable,
pendingTransaction.toTraceLog(),
prioritizedTransactions.logSender(pendingTransaction.getSender()));
LOG.warn("Stack trace", throwable);
LOG.atDebug()
.setMessage(
"Unexpected error when adding transaction {}, current sender status {}, force a reconcile and retry")
.setCause(throwable)
.addArgument(pendingTransaction::toTraceLog)
.addArgument(() -> prioritizedTransactions.logSender(pendingTransaction.getSender()))
.log();
reconcileSender(pendingTransaction.getSender(), stateSenderNonce);
try {
return prioritizedTransactions.add(pendingTransaction, nonceDistance);
} catch (final Throwable throwable2) {
LOG.warn(
"Unexpected error {} when adding transaction {}, current sender status {}",
throwable,
pendingTransaction.toTraceLog(),
prioritizedTransactions.logSender(pendingTransaction.getSender()));
LOG.warn("Stack trace", throwable);
// the error should have been solved by the reconcile, logging at higher level now
LOG.atWarn()
.setCause(throwable2)
.setMessage(
"Unexpected error when adding transaction {} after reconciliation, current sender status {}")
.addArgument(pendingTransaction.toTraceLog())
.addArgument(prioritizedTransactions.logSender(pendingTransaction.getSender()))
.log();
return INTERNAL_ERROR;
}
}
Expand Down

0 comments on commit 68ade17

Please sign in to comment.