Replies: 1 comment 2 replies
-
I haven’t use workers in node.js much, but the best way is likely to keep the current nonce in the main thread, and use postMessage to communicate back and forth with the main thread, which will increment the value and return the old value each time a child worker asks for it. I’m not sure if you can share an instance of a NonceManager within workers, but if so, that would be a much simpler solution. :) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Do not know if this fully fits ethers discussion, but as I am using it all the time, maybe somebody will know.
If you are using in node.js for example 3 worker threads and and every minute you execute 3 jobs which initiate transaction all at the same time at same time to for example hardhat node (localhost). I see that I got NONCE_EXPIRED on some of transactions. Using ethers v6. Any suggestion how to handle this situation, what would be best way to ensure that nonce isn't repeated between worker threads.
Beta Was this translation helpful? Give feedback.
All reactions