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

Implement transaction pool sync #872

Merged
merged 1 commit into from
Jan 7, 2023
Merged

Conversation

billfort
Copy link
Contributor

@billfort billfort commented Nov 9, 2022

Proposed changes in this pull request

this new feature is related to issue: #832

  • define new message types of SYNC_TXN_... in nodemessage.proto
  • create a new file synctxnpool.go in lnode package, to process sync txn pool functions.
  • add message handler and start go ruotine of syncing txn pool in localNode.initSyncing method.
  • sync txn pool do as following:
    • each node sycing txn at a rand duration about 10 seconds
    • node send to some neighbors ask for their txn pool's hash
    • node compare its own txn pool hash with recevied hash, and compare their txn count too.
    • if hash is different, node choose a neighbor has biggest txn count to request sync txns.
    • after get txns, the node update its txn pool

Type (put an x where ever applicable)

  • [] Bug fix: Link to the issue
  • Feature (Non-breaking change)
  • Feature (Breaking change)
  • Documentation Improvement

Checklist

Please put an x against the checkboxes. Write a small comment explaining if its N/A (not applicable)

  • Read the CONTRIBUTION guidelines.
  • All the tests are passing after the introduction of new changes.
  • Added tests respective to the part of code I have written.
  • Added proper documentation where ever applicable (in code and README.md).
  • Code has been written according to NKN-Golang-Style-Guide

Extra information

Any extra information related to this pull request.

pb/nodemessage.proto Outdated Show resolved Hide resolved
@billfort billfort force-pushed the sync-txn branch 3 times, most recently from 8db7e02 to ee829c5 Compare November 11, 2022 16:06
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
pb/nodemessage.proto Outdated Show resolved Hide resolved
pb/nodemessage.proto Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
@billfort billfort changed the title Sync txn Implement transaction pool sync Dec 8, 2022
@billfort billfort force-pushed the sync-txn branch 4 times, most recently from 02ae58c to cff9d22 Compare December 13, 2022 17:01
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
lnode/synctxnpool.go Outdated Show resolved Hide resolved
@billfort billfort force-pushed the sync-txn branch 3 times, most recently from 2d5434a to a807356 Compare December 19, 2022 23:22
chain/pool/txpool.go Outdated Show resolved Hide resolved
chain/pool/txwithtime.go Outdated Show resolved Hide resolved
chain/pool/txwithtime.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
chain/pool/txwithtime.go Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
chain/pool/txwithtime.go Outdated Show resolved Hide resolved
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/synctxnpool.go Outdated Show resolved Hide resolved
chain/pool/txwithtime.go Outdated Show resolved Hide resolved
chain/pool/txwithtime.go Outdated Show resolved Hide resolved
chain/pool/txpool.go Outdated Show resolved Hide resolved
@billfort billfort force-pushed the sync-txn branch 2 times, most recently from 9a890d1 to 7b4ee62 Compare December 24, 2022 16:43
lnode/syncrandaddr.go Outdated Show resolved Hide resolved
lnode/synctxnpool.go Outdated Show resolved Hide resolved
lnode/synctxnpool.go Outdated Show resolved Hide resolved
lnode/synctxnpool.go Outdated Show resolved Hide resolved
chain/pool/txwithtime.go Outdated Show resolved Hide resolved
@yilunzhang yilunzhang merged commit 591349b into nknorg:master Jan 7, 2023
@billfort billfort deleted the sync-txn branch April 18, 2024 00:25
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.

2 participants