Postpone notary configuration in driver DSL (matching original behaviour) to get around the service name check in registration.

This commit is contained in:
Christian Sailer 2020-07-24 10:18:45 +01:00
parent 19e11619b4
commit c4748e0588

View File

@ -542,8 +542,7 @@ class DriverDSLImpl(
rootCert: X509Certificate,
compatibilityZone: CompatibilityZoneParams
): CordaFuture<Pair<NodeConfig,NotaryInfo>> {
val notaryConfig = mapOf("notary" to mapOf("validating" to spec.validating))
val parameters = NodeParameters(rpcUsers = spec.rpcUsers, verifierType = spec.verifierType, customOverrides = notaryConfig + notaryCustomOverrides, maximumHeapSize = spec.maximumHeapSize)
val parameters = NodeParameters(rpcUsers = spec.rpcUsers, verifierType = spec.verifierType, customOverrides = notaryCustomOverrides, maximumHeapSize = spec.maximumHeapSize)
return createSchema(createConfig(spec.name, parameters), false).flatMap { config ->
startNodeRegistration(config, rootCert, compatibilityZone.config())}.flatMap { config ->
// Node registration only gives us the node CA cert, not the identity cert. That is only created on first
@ -551,7 +550,7 @@ class DriverDSLImpl(
if (startNodesInProcess) {
executorService.fork {
val nodeInfo = Node(config.corda, MOCK_VERSION_INFO, initialiseSerialization = false).generateAndSaveNodeInfo()
Pair(config, NotaryInfo(nodeInfo.legalIdentities[0], spec.validating))
Pair(config.withNotaryDefinition(spec.validating), NotaryInfo(nodeInfo.legalIdentities[0], spec.validating))
}
} else {
// TODO The config we use here is uses a hardocded p2p port which changes when the node is run proper
@ -563,7 +562,7 @@ class DriverDSLImpl(
.get()
}
val nodeInfo = nodeInfoFile.readObject<SignedNodeInfo>().verified()
Pair(config,NotaryInfo(nodeInfo.legalIdentities[0], spec.validating))
Pair(config.withNotaryDefinition(spec.validating), NotaryInfo(nodeInfo.legalIdentities[0], spec.validating))
}
}
}
@ -819,6 +818,10 @@ class DriverDSLImpl(
val corda: NodeConfiguration = typesafe.parseAsNodeConfiguration().value()
}
private fun NodeConfig.withNotaryDefinition(validating: Boolean): NodeConfig {
return NodeConfig(this.typesafe.plus(mapOf("notary" to mapOf("validating" to validating))))
}
companion object {
private val RPC_CONNECT_POLL_INTERVAL: Duration = 100.millis
internal val log = contextLogger()