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

Prevent from completing tx multiple times #330

Merged
merged 3 commits into from
Sep 18, 2017
Merged

Conversation

adambabik
Copy link
Contributor

This PR prevents from completing (i.e. sending) the same transaction multiple times.

I successfully reproduced the bug described in #263 with a unit test. The problem was a missing guard which could prevent from using the same transaction in multiple CompleteTransaction calls.

This is a quick solution but a well-though refactoring of TxQueueManager and TxQueue is required. I will follow up with a separate issue regarding that.

@adambabik adambabik self-assigned this Sep 15, 2017
Copy link
Contributor

@influx6 influx6 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

ErrQueuedTxIDNotFound = errors.New("transaction hash not found")
ErrQueuedTxTimedOut = errors.New("transaction sending timed out")
ErrQueuedTxDiscarded = errors.New("transaction has been discarded")
ErrQueuedTxInProgress = errors.New("transaction has started being processed already")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just "transaction is in progress"? "has started being processed already" seems a bit overcomplicated :)

@@ -188,6 +193,7 @@ func (m *TxQueueManager) completeLocalTransaction(queuedTx *common.QueuedTx, pas
log.Info("complete transaction using local node", "id", queuedTx.ID)

les, err := m.nodeManager.LightEthereumService()
log.Info("retrival les service", "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably unneeded already.

@adambabik
Copy link
Contributor Author

Transaction queue refactor issue #338.

@tiabc tiabc merged commit 79f7449 into develop Sep 18, 2017
@adambabik adambabik deleted the fix/issue-dup-txs-263 branch September 21, 2017 17:55
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.

4 participants