mirror of
https://github.com/corda/corda.git
synced 2025-02-21 17:56:54 +00:00
Fixed a bug where if NotaryService.Type is used as an advertised service no notary is created and no obvious error occurs.
This commit is contained in:
parent
9d9164980e
commit
a74c491745
@ -27,7 +27,6 @@ class NodeRunner {
|
|||||||
companion object {
|
companion object {
|
||||||
@JvmStatic fun main(arguments: Array<String>) {
|
@JvmStatic fun main(arguments: Array<String>) {
|
||||||
val cliParams = CliParams.parse(CliParams.parser.parse(*arguments))
|
val cliParams = CliParams.parse(CliParams.parser.parse(*arguments))
|
||||||
|
|
||||||
val nodeDirectory = Paths.get(cliParams.baseDirectory)
|
val nodeDirectory = Paths.get(cliParams.baseDirectory)
|
||||||
createNodeRunDirectory(nodeDirectory)
|
createNodeRunDirectory(nodeDirectory)
|
||||||
|
|
||||||
|
@ -256,7 +256,9 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
|||||||
if (NetworkMapService.Type in serviceTypes) makeNetworkMapService()
|
if (NetworkMapService.Type in serviceTypes) makeNetworkMapService()
|
||||||
|
|
||||||
val notaryServiceType = serviceTypes.singleOrNull { it.isSubTypeOf(NotaryService.Type) }
|
val notaryServiceType = serviceTypes.singleOrNull { it.isSubTypeOf(NotaryService.Type) }
|
||||||
if (notaryServiceType != null) makeNotaryService(notaryServiceType)
|
if (notaryServiceType != null) {
|
||||||
|
makeNotaryService(notaryServiceType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -316,10 +318,14 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
|||||||
val timestampChecker = TimestampChecker(platformClock, 30.seconds)
|
val timestampChecker = TimestampChecker(platformClock, 30.seconds)
|
||||||
|
|
||||||
inNodeNotaryService = when (type) {
|
inNodeNotaryService = when (type) {
|
||||||
is SimpleNotaryService.Type -> SimpleNotaryService(smm, net, timestampChecker, uniquenessProvider, services.networkMapCache)
|
SimpleNotaryService.Type -> SimpleNotaryService(smm, net, timestampChecker, uniquenessProvider, services.networkMapCache)
|
||||||
is ValidatingNotaryService.Type -> ValidatingNotaryService(smm, net, timestampChecker, uniquenessProvider, services.networkMapCache)
|
ValidatingNotaryService.Type -> ValidatingNotaryService(smm, net, timestampChecker, uniquenessProvider, services.networkMapCache)
|
||||||
else -> null
|
else -> {
|
||||||
|
throw IllegalArgumentException("Notary type ${type.id} is not handled by makeNotaryService.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require(inNodeNotaryService != null)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun makeIdentityService(): IdentityService {
|
protected open fun makeIdentityService(): IdentityService {
|
||||||
|
@ -24,6 +24,7 @@ abstract class NotaryService(val smm: StateMachineManager,
|
|||||||
val timestampChecker: TimestampChecker,
|
val timestampChecker: TimestampChecker,
|
||||||
val uniquenessProvider: UniquenessProvider,
|
val uniquenessProvider: UniquenessProvider,
|
||||||
networkMapCache: NetworkMapCache) : AbstractNodeService(net, networkMapCache) {
|
networkMapCache: NetworkMapCache) : AbstractNodeService(net, networkMapCache) {
|
||||||
|
// Do not specify this as an advertised service. Use a concrete implementation.
|
||||||
object Type : ServiceType("corda.notary")
|
object Type : ServiceType("corda.notary")
|
||||||
|
|
||||||
abstract val logger: org.slf4j.Logger
|
abstract val logger: org.slf4j.Logger
|
||||||
|
Loading…
x
Reference in New Issue
Block a user