Skip to content

Commit

Permalink
Put behind NEAR_RETRY_NONCE env var feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Jul 30, 2020
1 parent 4963d92 commit 9ec8638
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/account.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ export class Account {
}
return result;
} catch (error) {
if (error.message.match(/Transaction nonce \d+ must be larger than nonce of the used access key \d+/)) {
// TODO: Remove env feature flag when race condition (https://github.com/nearprotocol/nearcore/issues/3054) is fixed
const retryNonce = ['true', 'yes'].includes(process.env.NEAR_RETRY_NONCE);
if (retryNonce && error.message.match(/Transaction nonce \d+ must be larger than nonce of the used access key \d+/)) {
console.warn(`Retrying transaction ${receiverId}:${base_encode(txHash)} with new nonce.`);
delete this.accessKeyByPublicKeyCache[publicKey.toString()];
return null;
Expand Down

0 comments on commit 9ec8638

Please sign in to comment.