[BWS] Set latest nonce on publish for EVM proposals#3971
[BWS] Set latest nonce on publish for EVM proposals#3971leolambo wants to merge 9 commits intobitpay:v10from
Conversation
…freshOnPublish
There was a problem hiding this comment.
This doesn't work for me. If I publish a txp with a nonce of 8 and then it gets "refreshed" to something else, it'll fail the server verification when trying to sign it.
This approach makes me a little nervous since it'll apply to all EVM txps and can cause confusion if we compromise the integrity of txp.nonce (i.e. it's set to X initially, but later gets updated to Y). I would recommend we take a different approach that's BWC-driven. Say, let's allow nonce to be null or -1 to indicate that it should be assigned later (e.g. on signature). IIRC, null falls back to 0 when creating signatures, so that would probably require the least change with intermediate signing/verifying. We'll just need to ensure txp.nonce doesn't get set to 0 if nonce == null until it's time to actually assign the nonce.
| return cb(null, txp); | ||
| refreshTxData(server: WalletService, txp, opts, cb) { | ||
| // set latest nonce | ||
| server._getTransactionCount(opts.wallet, txp.from, (err, nonce) => { |
There was a problem hiding this comment.
lint: extra space before txp.from
No description provided.