From 68cdd5e374b4290e5117dd3ddfde66939c667d8f Mon Sep 17 00:00:00 2001 From: Michal Kit Date: Tue, 27 Mar 2018 15:20:08 +0100 Subject: [PATCH] ENT-1683 Ensuring that the updateDeadline time is in the future (#609) * Ensuring that the updateDeadline time is in the future * Addressing review comments --- .../corda/networkmanage/doorman/NetworkParametersConfig.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/NetworkParametersConfig.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/NetworkParametersConfig.kt index f06018897e..66f349eb7e 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/NetworkParametersConfig.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/NetworkParametersConfig.kt @@ -35,7 +35,12 @@ data class NotaryConfig(private val notaryNodeInfoFile: Path, } } -data class ParametersUpdateConfig(val description: String, val updateDeadline: Instant) +data class ParametersUpdateConfig(val description: String, val updateDeadline: Instant) { + init { + val now = Instant.now() + require(updateDeadline == now || updateDeadline.isAfter(now)) { "The updateDeadline time must be in the future." } + } +} /** * Data class containing the fields from [NetworkParameters] which can be read at start-up time from doorman.