Skip to content

Feat/restart nonce better#9

Open
SiddharthMalhotra wants to merge 2 commits intoTokenMarketNet:masterfrom
SiddharthMalhotra:feat/restart-nonce-better
Open

Feat/restart nonce better#9
SiddharthMalhotra wants to merge 2 commits intoTokenMarketNet:masterfrom
SiddharthMalhotra:feat/restart-nonce-better

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