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

Update txs synchronization and tx pool #20

Merged
merged 4 commits into from
Jul 30, 2020
Merged

Conversation

lewtran
Copy link
Collaborator

@lewtran lewtran commented Jul 29, 2020

This PR maybe resolve #15
First it will mark the txs pool and pop txs if they're oversize the pool
https://github.com/kardiachain/go-kardiamain/blob/update/tx_pool/kai/service/peer.go#L321
The txs will sync in a channel and disconnect from p2p if there is no more pending txs
https://github.com/kardiachain/go-kardiamain/blob/update/tx_pool/kai/service/protocol_manager.go#L87

It's also break the txs to chunks and send async them over the network #13
https://github.com/kardiachain/go-kardiamain/blob/update/tx_pool/kai/service/peer.go#L401

sender, err := types.Sender(tx)
// TODO: @lew
// Double check to ensure the signer
sender, err := types.Sender(types.HomesteadSigner{}, tx)
Copy link
Contributor

Choose a reason for hiding this comment

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

why HomesteadSigner? If it's that old, we should just use our own Signer

}
n := rand.Intn(len(pending)) + 1
for _, s := range pending {
if n--; n == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

shoud it just be "if n-- ==0" ?


// If we're reorging an old state, reinject all dropped transactions
// var reinject types.Transactions

Copy link
Contributor

Choose a reason for hiding this comment

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

should add comment why you comment this out

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