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

[R4R] add extension in eth protocol handshake to disable tx broadcast #412

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

yutianwu
Copy link
Contributor

@yutianwu yutianwu commented Sep 7, 2021

Description

Add a new protocol version 67 in eth protocol, and add another round of handshake if peer's protocol version is larger than 67. In the new handshake message, we added an extennsion to control some new features. Currently, we only add a switch to turn off tx broadcast to the connected peer. but we can add more options in the future without adding new params.

Rationale

Some nodes may do not need to receive txs broadcasted from other peers. When the network is congested, these nodes will take a lot of time to handle these txs and be unstable for queries. So we add a switch to turn off the tx broadcast for some specific nodes to make the network more stable.

Example

Changes

Notable changes:

  • Add a new protocol version 67
  • Add a new round handshake in eth protocol

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • manual transaction test passed

Already reviewed by

...

Related issues

... reference related issue #'s here ...

@yutianwu yutianwu force-pushed the p2p_improve branch 3 times, most recently from 4a9ede4 to 8705dbc Compare September 7, 2021 03:22
@yutianwu yutianwu changed the title [WIP] add option to disable tx broadcast [R4R] add option to disable tx broadcast Sep 13, 2021
@yutianwu yutianwu changed the title [R4R] add option to disable tx broadcast [R4R] add subversion in eth protocol to disable tx broadcast Sep 13, 2021
@yutianwu yutianwu changed the title [R4R] add subversion in eth protocol to disable tx broadcast [R4R] add extension in eth protocol handshake to disable tx broadcast Sep 18, 2021
@unclezoro unclezoro changed the base branch from master to develop September 27, 2021 02:07
@@ -44,7 +46,6 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
lru "github.com/hashicorp/golang-lru"
Copy link
Contributor

Choose a reason for hiding this comment

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

why do this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just fix the imports

defer timeout.Stop()
for i := 0; i < 2; i++ {
select {
case err := <-errc:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need make sure errc is clear before read from it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if the errc is not empty, the upper code should complain

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

4 participants