Skip to content

Commit

Permalink
Fixed peers.dat parser
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot committed Oct 16, 2024
1 parent ef210d8 commit a1dee81
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion grpc-server/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inConfig(Compile)(
)

enablePlugins(RunApplicationSettings, ExtensionPackaging)

Universal / maintainer := "com.wavesplatform"
Debian / debianControlFile := {
val generatedFile = (Debian / debianControlFile).value
IO.append(generatedFile, s"""Conflicts: grpc-server${network.value.packageSuffix}
Expand Down
2 changes: 2 additions & 0 deletions node/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ versionScheme := Some("pvp")

Compile / packageDoc / publishArtifact := true
Test / packageDoc / publishArtifact := false
Compile / packageDoc / mappings := Seq()

inConfig(Compile)(
Seq(
Expand Down Expand Up @@ -88,6 +89,7 @@ linuxScriptReplacements += ("network" -> network.value.toString)

inConfig(Universal)(
Seq(
maintainer := "com.wavesplatform",
packageName := s"waves-${version.value}",
mappings += (baseDirectory.value / s"waves-sample.conf" -> "doc/waves.conf.sample"),
javaOptions ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ class PeerDatabaseImpl(settings: NetworkSettings, ticker: Ticker = Ticker.system

private val IPAndPort = """(\d+)\.(\d+)\.(\d+)\.(\d+):(\d+)""".r

for (f <- settings.file if f.exists()) try {
for (f <- settings.file if f.exists && f.isFile && f.length > 0) try {
JsonFileStorage.load[PeersPersistenceType](f.getCanonicalPath).map {
case IPAndPort(a, b, c, d, port) =>
addCandidate(new InetSocketAddress(InetAddress.getByAddress(Array(a.toByte, b.toByte, c.toByte, d.toByte)), port.toInt))
addCandidate(new InetSocketAddress(InetAddress.getByAddress(Array(a, b, c, d).map(_.toInt.toByte)), port.toInt))
case _ =>
}

log.info(s"Loaded ${unverifiedPeers.size} known peer(s) from ${f.getName}")
} catch {
case NonFatal(_) => log.info("Legacy or corrupted peers.dat, ignoring, starting all over from known-peers...")
case NonFatal(e) => log.info("Legacy or corrupted peers.dat, ignoring, starting all over from known-peers...", e)
}

override def addCandidate(socketAddress: InetSocketAddress): Boolean = unverifiedPeers.synchronized {
Expand Down
10 changes: 5 additions & 5 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Dependencies {

private def akkaHttpModule(module: String) = "com.typesafe.akka" %% module % "10.2.10"

private def kamonModule(module: String) = "io.kamon" %% s"kamon-$module" % "2.7.3"
private def kamonModule(module: String) = "io.kamon" %% s"kamon-$module" % "2.7.5"

private def jacksonModule(group: String, module: String) = s"com.fasterxml.jackson.$group" % s"jackson-$module" % "2.15.3"

Expand All @@ -28,7 +28,7 @@ object Dependencies {
val googleGuava = "com.google.guava" % "guava" % "33.3.1-jre"
val kamonCore = kamonModule("core")
val machinist = "org.typelevel" %% "machinist" % "0.6.8"
val logback = "ch.qos.logback" % "logback-classic" % "1.5.8"
val logback = "ch.qos.logback" % "logback-classic" % "1.5.11"
val janino = "org.codehaus.janino" % "janino" % "3.1.12"
val asyncHttpClient = "org.asynchttpclient" % "async-http-client" % "3.0.0"
val curve25519 = "com.wavesplatform" % "curve25519-java" % "0.6.6"
Expand All @@ -41,8 +41,8 @@ object Dependencies {
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.19" % Test
val scalaJsTest = Def.setting("com.lihaoyi" %%% "utest" % "0.8.4" % Test)

val sttp3 = "com.softwaremill.sttp.client3" % "core_2.13" % "3.9.8"
val sttp3Monix = "com.softwaremill.sttp.client3" %% "monix" % "3.9.8"
val sttp3 = "com.softwaremill.sttp.client3" % "core_2.13" % "3.10.1"
val sttp3Monix = "com.softwaremill.sttp.client3" %% "monix" % "3.10.1"

val bouncyCastleProvider = "org.bouncycastle" % s"bcprov-jdk18on" % "1.78.1"

Expand Down Expand Up @@ -75,7 +75,7 @@ object Dependencies {

lazy val it = scalaTest +: Seq(
logback,
"com.github.jnr" % "jnr-unixsocket" % "0.38.22", // To support Apple ARM
"com.github.jnr" % "jnr-unixsocket" % "0.38.23", // To support Apple ARM
"com.spotify" % "docker-client" % "8.16.0",
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-properties" % "2.18.0",
asyncHttpClient
Expand Down

0 comments on commit a1dee81

Please sign in to comment.