Skip to content

Commit dd5275c

Browse files
committed
add conf for blockChainOnlyPeers pool size
1 parent 87acf8b commit dd5275c

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/main/resources/application.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ grothendieck {
294294
# same peer for previous blocks, until we find one that we have a parent for. This setting determines the batch size
295295
# of such query (number of blocks returned in a single query).
296296
block-resolving-depth = 20
297+
298+
# size of the list that keeps track of peers that are failing to provide us with mpt node
299+
# we switch them to download only blockchain elements
300+
fastsync-block-chain-only-peers-pool = 100
297301
}
298302

299303
pruning {

src/main/scala/io/iohk/ethereum/blockchain/sync/FastSync.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import scala.concurrent.ExecutionContext.Implicits.global
55
import akka.actor._
66
import akka.util.ByteString
77
import io.iohk.ethereum.domain.BlockHeader
8-
import io.iohk.ethereum.network.{EtcPeerManagerActor, Peer, PeerActor}
8+
import io.iohk.ethereum.network.{EtcPeerManagerActor, Peer}
99
import io.iohk.ethereum.network.PeerEventBusActor.PeerEvent.MessageFromPeer
1010
import io.iohk.ethereum.network.PeerEventBusActor.{PeerSelector, Subscribe, Unsubscribe}
1111
import io.iohk.ethereum.network.PeerEventBusActor.SubscriptionClassifier.MessageClassifier
@@ -235,7 +235,7 @@ trait FastSync {
235235

236236
private def handleFailingMptPeers: Receive ={
237237
case BlockChainOnlyDownload(peer) =>
238-
blockChainOnlyPeers = blockChainOnlyPeers + peer
238+
blockChainOnlyPeers = (blockChainOnlyPeers + peer).take(blockChainOnlyPeersPoolSize)
239239
}
240240

241241
private def printStatus() = {

src/main/scala/io/iohk/ethereum/utils/Config.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ object Config {
116116

117117
val checkForNewBlockInterval: FiniteDuration = syncConfig.getDuration("check-for-new-block-interval").toMillis.millis
118118
val blockResolveDepth: Int = syncConfig.getInt("block-resolving-depth")
119+
val blockChainOnlyPeersPoolSize: Int = syncConfig.getInt("fastsync-block-chain-only-peers-pool")
119120
}
120121

121122
trait DbConfig {

0 commit comments

Comments
 (0)