-
Notifications
You must be signed in to change notification settings - Fork 211
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
Conversation
create id for transaction refactor transaction on disk deduplication
…meshos/go-spacemesh into transaction_on_disc_dedupe
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same problem...
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
# Conflicts: # mesh/reward_test.go
…meshos/go-spacemesh into transaction_on_disc_dedupe
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") |
There was a problem hiding this comment.
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
mesh/meshdb.go
Outdated
|
||
//use AccountNonce Recipient Origin as key | ||
id := getTransactionId(t) | ||
m.transactions.Put(id, bytes) |
There was a problem hiding this comment.
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
No description provided.