This repository was archived by the owner on Dec 5, 2024. It is now read-only.
-
Couldn't load subscription status.
- Fork 1.1k
Several fixes for FastSync #1074
Merged
Merged
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
dd4bb88
Remove headers db when fastsync is finished w/o skipHistory
zilm13 c78e673
Fixed fast sync stall on backwards to pivot block download
zilm13 39e2816
Simplify FastSyncDownloader queue limit calculation
zilm13 857aa16
Added finish block number in SyncQueueReverseImpl
zilm13 24b7d3f
Logging improved in SyncPool.prepareActive()
zilm13 165c495
Added channel reputation to logging
zilm13 15c5f82
Merge branch 'develop' into fix/remove-headers-db
zilm13 539121c
Fixing case when during sync almost all slots are occupied by other p…
zilm13 082f9eb
Drop more peers when slots are needed during fast sync
zilm13 6394131
Added more debug temp logging + more strict disconnect
zilm13 15de110
Finished polishing of "Other peers" dropping during sync
zilm13 0baf916
Comment fixed
zilm13 ea63eaf
Logging message changed to be correct
zilm13 9e9e1a0
Merge branch 'develop' into fix/remove-headers-db
zilm13 4fa0441
Improved criteria for dropping other peers
zilm13 c499928
Polished drop other peers criteria
zilm13 518cd4d
Allow up to maxPeers-10 other peers on short sync
zilm13 a8a7e95
Some improvements to discard bad peers earlier
zilm13 0dd37ab
Updated drop rules
zilm13 db9c6cf
Fixed test
zilm13 6c16acb
Merge branch 'develop' into fix/remove-headers-db
zilm13 4926e8a
Logging improved for failed message decoding
zilm13 57d1dd3
Fxied incorrect Value usage for NODEDATA
zilm13 9bb6d67
Merge branch 'develop' into fix/remove-headers-db
zilm13 58f0322
Polishing peer drop strategy + NodeDataMessage fixed
zilm13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |
|
|
||
| import io.netty.channel.*; | ||
| import io.netty.channel.socket.nio.NioSocketChannel; | ||
| import org.ethereum.net.rlpx.Node; | ||
| import org.ethereum.net.rlpx.discover.NodeManager; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
|
|
@@ -42,6 +44,9 @@ public class EthereumChannelInitializer extends ChannelInitializer<NioSocketChan | |
| @Autowired | ||
| ChannelManager channelManager; | ||
|
|
||
| @Autowired | ||
| NodeManager nodeManager; | ||
|
|
||
| private String remoteId; | ||
|
|
||
| private boolean peerDiscoveryMode = false; | ||
|
|
@@ -57,11 +62,35 @@ public void initChannel(NioSocketChannel ch) throws Exception { | |
| logger.debug("Open {} connection, channel: {}", isInbound() ? "inbound" : "outbound", ch.toString()); | ||
| } | ||
|
|
||
| if (isInbound() && channelManager.isRecentlyDisconnected(ch.remoteAddress().getAddress())) { | ||
| // avoid too frequent connection attempts | ||
| logger.debug("Drop connection - the same IP was disconnected recently, channel: {}", ch.toString()); | ||
| ch.disconnect(); | ||
| return; | ||
| // For incoming connection drop if.. | ||
| if (isInbound()) { | ||
| boolean needToDrop = false; | ||
| // Bad remote address | ||
| if (ch.remoteAddress() == null) { | ||
| logger.debug("Drop connection - bad remote address, channel: {}", ch.toString()); | ||
| needToDrop = true; | ||
| } | ||
| // Avoid too frequent connection attempts | ||
| if (!needToDrop && channelManager.isRecentlyDisconnected(ch.remoteAddress().getAddress())) { | ||
| logger.debug("Drop connection - the same IP was disconnected recently, channel: {}", ch.toString()); | ||
| needToDrop = true; | ||
| } | ||
| // Drop bad peers before creating channel | ||
| if (!needToDrop && nodeManager.getNodeStatistics(new Node(new byte[0], ch.remoteAddress().getHostString(), | ||
|
||
| ch.remoteAddress().getPort())).isReputationPenalized()) { | ||
| logger.debug("Drop connection - bad peer, channel: {}", ch.toString()); | ||
| needToDrop = true; | ||
| } | ||
| // Drop if we have long waiting queue already | ||
| if (!needToDrop && !channelManager.acceptingNewPeers()) { | ||
| logger.debug("Drop connection - many new peers are not processed, channel: {}", ch.toString()); | ||
| needToDrop = true; | ||
| } | ||
|
|
||
| if (needToDrop) { | ||
| ch.disconnect(); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| final Channel channel = ctx.getBean(Channel.class); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It results in a list with not encoded elements