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

meshdb transaction dedupe #694

Merged
merged 17 commits into from Mar 26, 2019
Merged

meshdb transaction dedupe #694

merged 17 commits into from Mar 26, 2019

Conversation

almogdepaz
Copy link
Contributor

No description provided.

@antonlerner
Copy link
Contributor

Merge my fix into your if you want, I see that the failingtest is an old one

mesh/meshdb.go Outdated
m.Error("could not write tx %v to database ")
}

//use AccountNonce Recipient Origin as key
Copy link
Contributor

Choose a reason for hiding this comment

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

account nonce and recipient is not unique since a transaction can have same nonce and recipient but with different gas cost. I'd recommend using a hash of the entire TX.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

im using account nonce recipient and origin ...

Copy link
Contributor

Choose a reason for hiding this comment

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

same problem...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct me if i'm wrong but these three are unique
you cant have 2 transactions from a to b with the same nonce

Copy link
Contributor

Choose a reason for hiding this comment

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

You can, with different gas price

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cool, i changed to sha256

mesh/meshdb.go Outdated
func (m *meshDB) getTransactionBytes(id []byte) ([]byte, error) {
b, err := m.transactions.Get(id)
if err != nil {
return nil, errors.New("could not find transaction in database")
Copy link
Contributor

Choose a reason for hiding this comment

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

probably best to add tx id in the log print

@almogdepaz almogdepaz requested a review from zalmen March 26, 2019 14:46
mesh/meshdb.go Outdated

//use AccountNonce Recipient Origin as key
id := getTransactionId(t)
m.transactions.Put(id, bytes)
Copy link
Contributor

Choose a reason for hiding this comment

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

if there is a returned error please check it

@almogdepaz almogdepaz merged commit abe7e3e into develop Mar 26, 2019
@y0sher y0sher deleted the transaction_on_disc_dedupe branch June 25, 2019 07:48
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.

None yet

2 participants