override val settingsJSON: Map[String, circe.Json] = settingsFromFile(settingsFilename)
}
val forger: ActorRef = actorSystem.actorOf(Props(classOf[Forger], settings, nodeViewHolderRef))
override val localInterface: ActorRef = actorSystem.actorOf(Props(classOf[BifrostLocalInterface], nodeViewHolderRef, forger, settings))
If you want to change consensus rules or whatnot, just reference different files. Alternatively, you can always do this in memory. For reference, a simple ForgingSettings might look like this:
val InitialDifficulty = 15000000L
val MinimumDifficulty = 100L
lazy val offlineGeneration = settingsJSON.get("offlineGeneration").flatMap(_.asBoolean).getOrElse(false)
lazy val posAttachmentSize = settingsJSON.get("posAttachmentSize").flatMap(_.asNumber).flatMap(_.toInt)
.getOrElse(DefaulPtosAttachmentSize)
val DefaulPtosAttachmentSize = 1024
override def toString: String = (Map("BlockDelay" -> blockGenerationDelay.length.asJson) ++
settingsJSON.map(s => s._1 -> s._2)).asJson.spaces2
}
(This is using io.circe for json parsing) You can generally just swap between different children of Settings for different consensus modules.
Scorex also has a testkit built in if you want to do discrete runs quickly between different settings. It would essentially be handled the same way as well.
Cheers!
Thanks a ton for the detailed response, it is very useful for me. Good luck for your project.