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

Feat/restart nonce better #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SiddharthMalhotra
Copy link

If there are transactions in the queue and they have a nonce assigned and it does not match to the network nonce, then we need to discard these transactions

if txs.count() > 0:
raise HistoryDeleteNeeded("Cannot reset nonce as the database contains txs for {}. Delete database to restart.".format(service.address))
if txs.count() > 0 and reset_pending_tx = True:
service.delete_pending_broadcasts()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't just blindly delete pending transactions. Transactions are created and broadcasted in a particular order.
It is quite possible that the earlier txs might succeed and the later ones will fail. In such case deleting txs and running the same command will force the creation of old ones that succeeded already. This is redundant and we should avoid it.

We should rather find a way to update nonce of all pending transactions in the order they were created.

@voith voith self-requested a review March 1, 2019 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants