Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get first unused nonce? #3

Closed
boris-savic opened this issue Feb 3, 2018 · 1 comment
Closed

Get first unused nonce? #3

boris-savic opened this issue Feb 3, 2018 · 1 comment

Comments

@boris-savic
Copy link

boris-savic commented Feb 3, 2018

Great work!

It seems to me that the current implementation does not allow querying for the last used or first unused (depends on the preference) nonce. So the client applications would need to keep track of all the nonces, and this could prove to be an issue in case the client application looses the nonce history as it would have to retry all the nonces until it finds the first unused one.

Perhaps something like this would allow the client app to query for the first unused nonce:

mapping(address => uint) nonces;

function getNonce(address spender) public view returns (uint) {
   return nonces[spender] + 1;
}

@bokkypoobah
Copy link
Owner

Thanks for your suggestion on using the nonce. I've now implemented it and it will make the provision of the BTTS service easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants