Skip to content

Commit cd1f83c

Browse files
author
Nicolás Tallar
authored
[Fix] Propagation improvements (#784)
1 parent d6a38d6 commit cd1f83c

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

src/main/resources/application.conf

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ mantis {
119119
max-mpt-components-per-message = 200
120120

121121
# Maximum number of peers this node can connect to
122-
max-outgoing-peers = 80
122+
max-outgoing-peers = 45
123123

124124
# Maximum number of peers that can connect to this node
125-
max-incoming-peers = 5
125+
max-incoming-peers = 15
126126

127127
# Maximum number of peers that can be connecting to this node
128-
max-pending-peers = 5
128+
max-pending-peers = 20
129129

130130
# Initial delay before connecting to nodes
131131
update-nodes-initial-delay = 5.seconds
@@ -343,9 +343,7 @@ mantis {
343343

344344
# When we receive a branch that is not rooted in our chain (we don't have a parent for the first header), it means
345345
# we found a fork. To resolve it, we need to query the same peer for previous headers, to find a common ancestor.
346-
# This setting determines how many additional headers we request. The default of 12 may be regarded as confirmation
347-
# depth in ethereum (https://www.reddit.com/r/ethereum/comments/4eplsv/how_many_confirms_is_considered_safe_in_ethereum/)
348-
branch-resolution-request-size = 12
346+
branch-resolution-request-size = 30
349347

350348
# TODO investigate proper value to handle ETC reorgs correctly
351349
# threshold for storing non-main-chain blocks in queue.

src/main/resources/chains/testnet-internal-genesis.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"extraData": "0x00",
33
"nonce": "0x0000000000000042",
44
"gasLimit": "0x2fefd8",
5-
"difficulty": "0x400",
5+
"_commentAboutDifficulty": "Set to 1000000",
6+
"difficulty": "0xF4240",
67
"ommersHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
7-
"timestamp": "0x00",
8+
"_commentAboutTimestamp": "Set to 11/05/2020 @ 12:00am (UTC)",
9+
"timestamp": "0x5FA34080",
810
"coinbase": "0x0000000000000000000000000000000000000000",
911
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
1012
"alloc": {

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockFetcher.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class BlockFetcher(
184184
private def handleNewBlockMessages(state: BlockFetcherState): Receive = {
185185
case MessageFromPeer(NewBlockHashes(hashes), _) =>
186186
log.debug("Received NewBlockHashes numbers {}", hashes.map(_.number).mkString(", "))
187-
val newState = state.validatedHashes(hashes) match {
187+
val newState = state.validateNewBlockHashes(hashes) match {
188188
case Left(_) => state
189189
case Right(validHashes) => state.withPossibleNewTopAt(validHashes.lastOption.map(_.number))
190190
}

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockFetcherState.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@ case class BlockFetcherState(
9090
.ensure("Given headers should form a sequence without gaps")(HeadersSeq.areChain)
9191
}
9292

93-
def validatedHashes(hashes: Seq[BlockHash]): Either[String, Seq[BlockHash]] =
93+
def validateNewBlockHashes(hashes: Seq[BlockHash]): Either[String, Seq[BlockHash]] =
9494
hashes
9595
.asRight[String]
9696
.ensure("Hashes are empty")(_.nonEmpty)
97-
.ensure("Hashes are too new")(_.head.number == nextToLastBlock)
9897
.ensure("Hashes should form a chain")(hashes =>
9998
hashes.zip(hashes.tail).forall { case (a, b) =>
10099
a.number + 1 == b.number

0 commit comments

Comments
 (0)