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

Conversation

Projects
None yet
2 participants
@almogdepaz
Copy link
Member

almogdepaz commented Mar 20, 2019

No description provided.

almogdepaz added some commits Mar 19, 2019

create block header
create id for transaction
refactor
transaction on disk deduplication
@antonlerner

This comment has been minimized.

Copy link
Member

antonlerner commented Mar 20, 2019

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

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

//use AccountNonce Recipient Origin as key

This comment has been minimized.

Copy link
@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.

Copy link
@almogdepaz

almogdepaz Mar 21, 2019

Author Member

im using account nonce recipient and origin ...

This comment has been minimized.

Copy link
@antonlerner

antonlerner Mar 21, 2019

Member

same problem...

This comment has been minimized.

Copy link
@almogdepaz

almogdepaz Mar 24, 2019

Author Member

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.

Copy link
@antonlerner

antonlerner Mar 25, 2019

Member

You can, with different gas price

This comment has been minimized.

Copy link
@almogdepaz

almogdepaz Mar 25, 2019

Author Member

cool, i changed to sha256

almogdepaz added some commits Mar 21, 2019

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.

Copy link
@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

almogdepaz added some commits Mar 26, 2019


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

This comment has been minimized.

Copy link
@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

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.