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

@unclezoro unclezoro merged commit 610f6a5 into develop Oct 13, 2021
This was referenced Oct 19, 2021
@yutianwu yutianwu deleted the p2p_improve branch November 16, 2021 04:09
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.

4 participants