hirosystems / multisig-cli

CLI for updated Ledger app
Apache License 2.0
0 stars 0 forks source link

Nonce's are sometimes wrong #16

Open alexlmiller opened 1 week ago

alexlmiller commented 1 week ago

When converting the csv files to JSON before signing, the CLI is sometimes generating the wrong nonce, even on a wallet that has had no other transactions to it and only has one transaction in the set

jbencin commented 6 days ago

I can't think of any reason this would fail for a single transaction, as I'm just using getNonce() from Stacks.js

I can see how this could be a problem if you are sending multiple transactions from the same multisig address, since the transactions (and therefore nonce lookups) are done in parallel, so you might get the same nonce for multiple transactions from that address. What I could do here is to add an intermediate function that caches the results of getNonce() for each address, and if we've already fetched the nonce from the network once, increment the last value instead of fetching again