diff --git a/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt b/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt index a47a9bc1d5..353b76eb77 100644 --- a/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt +++ b/node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt @@ -11,6 +11,8 @@ import java.net.URL import java.nio.file.Path import java.util.* +data class DevModeOptions(val disableCheckpointChecker: Boolean?) + interface NodeConfiguration : NodeSSLConfiguration { // myLegalName should be only used in the initial network registration, we should use the name from the certificate instead of this. // TODO: Remove this so we don't accidentally use this identity in the code? @@ -28,7 +30,7 @@ interface NodeConfiguration : NodeSSLConfiguration { val database: Properties? val rpcUsers: List val devMode: Boolean - val devModeOptions: Properties? + val devModeOptions: DevModeOptions? val certificateSigningService: URL val certificateChainCheckPolicies: List val verifierType: VerifierType @@ -42,10 +44,6 @@ interface NodeConfiguration : NodeSSLConfiguration { } } -fun NodeConfiguration.isDevModeOptionsFlagSet(flag: String): Boolean { - return this.devModeOptions?.get(flag).toString().toLowerCase() == "true" -} - data class NotaryConfig(val validating: Boolean, val raft: RaftConfig? = null, val bftSMaRt: BFTSMaRtConfiguration? = null, @@ -102,7 +100,7 @@ data class FullNodeConfiguration( override val notary: NotaryConfig?, override val certificateChainCheckPolicies: List, override val devMode: Boolean = false, - override val devModeOptions: Properties? = null, + override val devModeOptions: DevModeOptions? = null, val useTestClock: Boolean = false, val detectPublicIp: Boolean = true, override val activeMQServer: ActiveMqServerConfiguration, diff --git a/node/src/main/kotlin/net/corda/node/services/statemachine/StateMachineManagerImpl.kt b/node/src/main/kotlin/net/corda/node/services/statemachine/StateMachineManagerImpl.kt index 3e05a45e1f..04f9390e91 100644 --- a/node/src/main/kotlin/net/corda/node/services/statemachine/StateMachineManagerImpl.kt +++ b/node/src/main/kotlin/net/corda/node/services/statemachine/StateMachineManagerImpl.kt @@ -32,7 +32,6 @@ import net.corda.node.services.api.Checkpoint import net.corda.node.services.api.CheckpointStorage import net.corda.node.services.api.ServiceHubInternal import net.corda.node.services.config.NodeConfiguration -import net.corda.node.services.config.isDevModeOptionsFlagSet import net.corda.node.services.messaging.ReceivedMessage import net.corda.node.services.messaging.TopicSession import net.corda.node.utilities.* @@ -91,7 +90,7 @@ class StateMachineManagerImpl( private val mutex = ThreadBox(InnerState()) // This thread (only enabled in dev mode) deserialises checkpoints in the background to shake out bugs in checkpoint restore. private val checkpointCheckerThread = if (serviceHub.configuration.devMode - && !serviceHub.configuration.isDevModeOptionsFlagSet(NodeConfiguration.DISABLE_CHECKPOINT_CHECKER)) + && serviceHub.configuration.devModeOptions?.disableCheckpointChecker != true) newNamedSingleThreadExecutor("CheckpointChecker") else null @Volatile private var unrestorableCheckpoints = false diff --git a/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt b/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt index db1a61b6fb..d4090e2cee 100644 --- a/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt @@ -70,10 +70,10 @@ class FullNodeConfigurationTest { activeMQServer = ActiveMqServerConfiguration(BridgeConfiguration(0, 0, 0.0)), additionalNodeInfoPollingFrequencyMsec = 5.seconds.toMillis()) - fun configDebugOptions(devMode: Boolean, debugOptions: Properties?) { + fun configDebugOptions(devMode: Boolean, debugOptions: DevModeOptions?) { testConfiguration.copy(devMode = devMode, devModeOptions = debugOptions) } - val debugOptions = Properties() + val debugOptions = DevModeOptions(null) configDebugOptions(true, debugOptions) configDebugOptions(true,null) assertThatThrownBy{configDebugOptions(false, debugOptions)}.hasMessageMatching( "Cannot use devModeOptions outside of dev mode" ) @@ -105,14 +105,13 @@ class FullNodeConfigurationTest { activeMQServer = ActiveMqServerConfiguration(BridgeConfiguration(0, 0, 0.0)), additionalNodeInfoPollingFrequencyMsec = 5.seconds.toMillis()) - fun configDebugOptions(devMode: Boolean, debugOptions: Properties?) : NodeConfiguration { - return testConfiguration.copy(devMode = devMode, devModeOptions = debugOptions) + fun configDebugOptions(devMode: Boolean, devModeOptions: DevModeOptions?) : NodeConfiguration { + return testConfiguration.copy(devMode = devMode, devModeOptions = devModeOptions) } - val debugOptions = Properties() - assertFalse { configDebugOptions(true,null).isDevModeOptionsFlagSet("foo")} - assertFalse { configDebugOptions(true,debugOptions).isDevModeOptionsFlagSet("foo")} - debugOptions.setProperty("foo", "tRuE") - assert( configDebugOptions(true, debugOptions).isDevModeOptionsFlagSet("foo")) + assertFalse { configDebugOptions(true,null).devModeOptions?.disableCheckpointChecker == true} + assertFalse { configDebugOptions(true,DevModeOptions(null)).devModeOptions?.disableCheckpointChecker == true} + assertFalse { configDebugOptions(true,DevModeOptions(false)).devModeOptions?.disableCheckpointChecker == true} + assert ( configDebugOptions(true,DevModeOptions(true)).devModeOptions?.disableCheckpointChecker == true) } }