mirror of
https://github.com/corda/corda.git
synced 2025-04-12 21:53:17 +00:00
Add helper for checking whether to check checkpoints and unit test it.
This commit is contained in:
parent
0d4c2d3526
commit
3f43d8ad21
@ -49,6 +49,10 @@ interface NodeConfiguration : NodeSSLConfiguration {
|
||||
val detectPublicIp: Boolean get() = true
|
||||
}
|
||||
|
||||
fun NodeConfiguration.shouldCheckCheckpoints(): Boolean{
|
||||
return this.devMode && this.devModeOptions?.disableCheckpointChecker != true
|
||||
}
|
||||
|
||||
data class NotaryConfig(val validating: Boolean,
|
||||
val raft: RaftConfig? = null,
|
||||
val bftSMaRt: BFTSMaRtConfiguration? = null,
|
||||
|
@ -31,6 +31,7 @@ import net.corda.node.internal.InitiatedFlowFactory
|
||||
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.shouldCheckCheckpoints
|
||||
import net.corda.node.services.messaging.ReceivedMessage
|
||||
import net.corda.node.services.messaging.TopicSession
|
||||
import net.corda.node.utilities.*
|
||||
@ -88,7 +89,7 @@ class StateMachineManagerImpl(
|
||||
private val scheduler = FiberScheduler()
|
||||
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.devModeOptions?.disableCheckpointChecker != true) {
|
||||
private val checkpointCheckerThread = if (serviceHub.configuration.shouldCheckCheckpoints()) {
|
||||
newNamedSingleThreadExecutor("CheckpointChecker")
|
||||
} else {
|
||||
null
|
||||
|
@ -23,10 +23,10 @@ class NodeConfigurationImplTest {
|
||||
|
||||
@Test
|
||||
fun `check devModeOptions flag helper`() {
|
||||
assertFalse { configDebugOptions(true, null).devModeOptions?.disableCheckpointChecker == true }
|
||||
assertFalse { configDebugOptions(true, DevModeOptions()).devModeOptions?.disableCheckpointChecker == true }
|
||||
assertFalse { configDebugOptions(true, DevModeOptions(false)).devModeOptions?.disableCheckpointChecker == true }
|
||||
assertTrue { configDebugOptions(true, DevModeOptions(true)).devModeOptions?.disableCheckpointChecker == true }
|
||||
assertTrue { configDebugOptions(true, null).shouldCheckCheckpoints() }
|
||||
assertTrue { configDebugOptions(true, DevModeOptions()).shouldCheckCheckpoints() }
|
||||
assertTrue { configDebugOptions(true, DevModeOptions(false)).shouldCheckCheckpoints() }
|
||||
assertFalse { configDebugOptions(true, DevModeOptions(true)).shouldCheckCheckpoints() }
|
||||
}
|
||||
|
||||
private fun configDebugOptions(devMode: Boolean, devModeOptions: DevModeOptions?) : NodeConfiguration {
|
||||
|
Loading…
x
Reference in New Issue
Block a user