Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

NC-2206 Remove-- max-trailing-peers option #680

20 changes: 11 additions & 9 deletions docs/Configuring-Pantheon/Networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ Pantheon uses the network to find and connect to peers.

The default logging configuration does not list node connection and disconnection messages.

To enable listing of node connection and disconnection messages, specify the [`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) command line option `--logging=DEBUG`. For more verbosity, specify `--logging=TRACE`.
To enable listing of node connection and disconnection messages, specify the
[`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) command line option `--logging=DEBUG`.
For more verbosity, specify `--logging=TRACE`.

The console logs connection and disconnection events when the log level is `DEBUG` or higher. If `Successfully accepted connection from ...` is displayed, connections are getting through the firewalls. For example:
The console logs connection and disconnection events when the log level is `DEBUG` or higher.
If `Successfully accepted connection from ...` is displayed, connections are getting through the firewalls.

!!! example "Example log output"
`2018-10-16 12:37:35.479-04:00 | nioEventLoopGroup-3-1 | INFO | NettyP2PNetwork | Successfully accepted connection from 0xa979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c`
Expand All @@ -26,13 +29,11 @@ for host and ==30303== for port.

## Limiting Peers

Limiting peers reduces the bandwidth used by Pantheon. It also reduces the CPU time and disk access used to manage and respond to peers.
Limiting peers reduces the bandwidth used by Pantheon. It also reduces the CPU time and disk access
used to manage and respond to peers.

Use the [`--max-peers`](../Reference/Pantheon-CLI-Syntax.md#max-peers) command line option to reduce the maximum number of peers. The default is 25.

Use the [`--max-trailing-peers`](../Reference/Pantheon-CLI-Syntax.md#max-trailing-peers) option to reduce the maximum P2P peer connections for peers that are trailing behind the local chain head. The default is unlimited but the number of trailing peers cannot exceed the value specified by [`--max-peers`](../Reference/Pantheon-CLI-Syntax.md#max-peers).

Trailing peers cannot be used to get new blocks and are more likely to be requesting blocks from you. Limiting trailing peers may reduce the time taken to catch up to the chain head when synchronizing.
Use the [`--max-peers`](../Reference/Pantheon-CLI-Syntax.md#max-peers) command line option to reduce
the maximum number of peers. The default is 25.

## No Discovery

Expand All @@ -42,4 +43,5 @@ Only set this option to `false` if you are running a test node or a test network

## Monitoring Peer Connections

Use the [`debug_metrics`](../Reference/JSON-RPC-API-Methods.md#debug_metrics) JSON-RPC API method to obtain information about peer connections.
Use the [`debug_metrics`](../Reference/JSON-RPC-API-Methods.md#debug_metrics) JSON-RPC API method
to obtain information about peer connections.
21 changes: 0 additions & 21 deletions docs/Reference/Pantheon-CLI-Syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,27 +200,6 @@ max-peers=42
Specifies the maximum P2P peer connections that can be established.
The default is 25.

### max-trailing-peers

!!!important
This option is deprecated in favor of a intelligent default setting and will be removed in 0.9
release.

```bash tab="Syntax"
--max-trailing-peers=<INTEGER>
```

```bash tab="Example Command Line"
--max-trailing-peers=2
```

```bash tab="Example Configuration File"
max-trailing-peers=2
```

Specifies the maximum P2P peer connections for peers that are trailing behind the local chain head.
The default is unlimited but the number of trailing peers cannot exceed the value specified by [`--max-peers`](#max-peers).

### metrics-enabled

```bash tab="Syntax"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ interface DefaultCommandValues {
// but we use FULL for the moment as Fast is still in progress
SyncMode DEFAULT_SYNC_MODE = SyncMode.FULL;
int DEFAULT_MAX_PEERS = 25;
int MAX_TRAILING_PEERS = Integer.MAX_VALUE;

static Path getDefaultPantheonDataPath(final Object command) {
// this property is retrieved from Gradle tasks or Pantheon running shell script.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,6 @@ public static class RpcApisConversionException extends Exception {
)
private final Integer maxPeers = DEFAULT_MAX_PEERS;

/**
* @deprecated This option is not exposed anymore even if still available as it's bounded by
* max-peers value. It's not useful enough to figure in the help. Will probably completely
* removed in next version.
*/
@Deprecated
@Option(
names = {"--max-trailing-peers"},
paramLabel = MANDATORY_INTEGER_FORMAT_HELP,
description =
"Maximum p2p peer connections for peers that are trailing behind our chain head (default: unlimited)"
)
private final Integer maxTrailingPeers = Integer.MAX_VALUE;

@Option(
names = {"--banned-node-ids", "--banned-node-id"},
paramLabel = MANDATORY_NODE_ID_FORMAT_HELP,
Expand Down Expand Up @@ -703,7 +689,7 @@ private PrivacyParameters orionConfiguration() {

private SynchronizerConfiguration buildSyncConfig() {
synchronizerConfigurationBuilder.syncMode(syncMode);
synchronizerConfigurationBuilder.maxTrailingPeers(maxTrailingPeers);
synchronizerConfigurationBuilder.maxTrailingPeers(MAX_TRAILING_PEERS);
return synchronizerConfigurationBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,15 +768,6 @@ public void syncModeOptionMustBeUsed() {
assertThat(commandErrorOutput.toString()).isEmpty();
}

@Test
public void maxTrailingPeersMustBeUsed() {
parseCommand("--max-trailing-peers", "3");
verify(mockSyncConfBuilder).maxTrailingPeers(3);

assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
}

@Test
public void jsonRpcEnabledPropertyDefaultIsFalse() {
parseCommand();
Expand Down
1 change: 0 additions & 1 deletion pantheon/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ banned-node-id=["0x6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec
p2p-host="1.2.3.4"
p2p-port=1234
max-peers=42
max-trailing-peers=5
host-whitelist=["all"]

# chain
Expand Down