Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Add indicative nonce logs
Browse files Browse the repository at this point in the history
  • Loading branch information
LayneHaber committed Jul 2, 2021
1 parent 291c66d commit da603eb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/contracts/src.ts/services/ethService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export class EthereumChainService extends EthereumChainReader implements IVector
try {
// If a nonce is supplied, use that
if (typeof nonce !== "undefined") {
this.log.info({ nonce, chainId, gasPrice: gasPrice.toString() }, "Resubmitting tx");
const response: TransactionResponse | undefined = await txFn(gasPrice, nonce);
return Result.ok(response);
}
Expand All @@ -219,6 +220,7 @@ export class EthereumChainService extends EthereumChainReader implements IVector
const stored = this.nonces.get(chainId) ?? 0;
const pending = await signer.getTransactionCount("pending");
const nonceToUse = stored > pending ? stored : pending;
this.log.info({ nonce, chainId, gasPrice: gasPrice.toString() }, "Submitting tx");
const response: TransactionResponse | undefined = await txFn(gasPrice, nonceToUse);

// Store the incremented nonce
Expand Down

0 comments on commit da603eb

Please sign in to comment.