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

@almogdepaz almogdepaz commented Mar 20, 2019

No description provided.

@antonlerner
Copy link
Member

@antonlerner antonlerner commented Mar 20, 2019

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

mesh/block.go Show resolved Hide resolved
m.Error("could not write tx %v to database ")
}

//use AccountNonce Recipient Origin as key

This comment has been minimized.

@antonlerner

antonlerner Mar 21, 2019
Member

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.

This comment has been minimized.

@almogdepaz

almogdepaz Mar 21, 2019
Author Contributor

im using account nonce recipient and origin ...

This comment has been minimized.

@antonlerner

antonlerner Mar 21, 2019
Member

same problem...

This comment has been minimized.

@almogdepaz

almogdepaz Mar 24, 2019
Author Contributor

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

This comment has been minimized.

@antonlerner

antonlerner Mar 25, 2019
Member

You can, with different gas price

This comment has been minimized.

@almogdepaz

almogdepaz Mar 25, 2019
Author Contributor

cool, i changed to sha256

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")

This comment has been minimized.

@antonlerner

antonlerner Mar 26, 2019
Member

probably best to add tx id in the log print

@almogdepaz almogdepaz requested a review from zalmen Mar 26, 2019

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

This comment has been minimized.

@antonlerner

antonlerner Mar 26, 2019
Member

if there is a returned error please check it

@almogdepaz almogdepaz merged commit abe7e3e into develop Mar 26, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@y0sher y0sher deleted the transaction_on_disc_dedupe branch Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants