-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/phase/beta1' into feature/eip155…
…conf
- Loading branch information
Showing
20 changed files
with
585 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
31 changes: 31 additions & 0 deletions
31
src/main/scala/io/iohk/ethereum/network/discovery/DiscoveryConfig.scala
This file contains 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.iohk.ethereum.network.discovery | ||
|
||
import scala.concurrent.duration.FiniteDuration | ||
import scala.concurrent.duration._ | ||
|
||
case class DiscoveryConfig( | ||
interface: String, | ||
port: Int, | ||
bootstrapNodes: Set[String], | ||
nodesLimit: Int /* TODO: remove once proper discovery protocol is in place */, | ||
scanMaxNodes: Int /* TODO: remove once proper discovery protocol is in place */, | ||
scanInitialDelay: FiniteDuration, | ||
scanInterval: FiniteDuration, | ||
messageExpiration: FiniteDuration) | ||
|
||
object DiscoveryConfig { | ||
def apply(etcClientConfig: com.typesafe.config.Config): DiscoveryConfig = { | ||
import scala.collection.JavaConverters._ | ||
val discoveryConfig = etcClientConfig.getConfig("network.discovery") | ||
val bootstrapNodes = discoveryConfig.getStringList("bootstrap-nodes").asScala.toSet | ||
DiscoveryConfig( | ||
interface = discoveryConfig.getString("interface"), | ||
port = discoveryConfig.getInt("port"), | ||
bootstrapNodes = bootstrapNodes, | ||
nodesLimit = discoveryConfig.getInt("nodes-limit"), | ||
scanMaxNodes = discoveryConfig.getInt("scan-max-nodes"), | ||
scanInitialDelay = discoveryConfig.getDuration("scan-initial-delay").toMillis.millis, | ||
scanInterval = discoveryConfig.getDuration("scan-interval").toMillis.millis, | ||
messageExpiration = discoveryConfig.getDuration("message-expiration").toMillis.millis) | ||
} | ||
} |
Oops, something went wrong.