diff --git a/src/main/kotlin/core/node/AbstractNode.kt b/src/main/kotlin/core/node/AbstractNode.kt index 816ae493b5..e9d7c1e767 100644 --- a/src/main/kotlin/core/node/AbstractNode.kt +++ b/src/main/kotlin/core/node/AbstractNode.kt @@ -91,8 +91,6 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration, lateinit var api: APIServer open fun start(): AbstractNode { - require(timestamperAddress == null || timestamperAddress.advertisedServices.contains(TimestamperService.Type)) - {"Timestamper address must indicate a node that provides timestamping services"} log.info("Node starting up ...") storage = initialiseStorageService(dir) @@ -117,6 +115,10 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration, // given the details, the timestamping node is somewhere else. Otherwise, we do our own timestamping. val tsid = if (timestamperAddress != null) { inNodeTimestampingService = null + require(TimestamperService.Type in timestamperAddress.advertisedServices) { + "Timestamper address must indicate a node that provides timestamping services, actually " + + "has ${timestamperAddress.advertisedServices}" + } timestamperAddress } else { inNodeTimestampingService = NodeTimestamperService(net, storage.myLegalIdentity, storage.myLegalIdentityKey, platformClock) diff --git a/src/main/kotlin/demos/TraderDemo.kt b/src/main/kotlin/demos/TraderDemo.kt index 7e06d7e871..4ba5c54a88 100644 --- a/src/main/kotlin/demos/TraderDemo.kt +++ b/src/main/kotlin/demos/TraderDemo.kt @@ -11,10 +11,11 @@ import core.messaging.SingleMessageRecipient import core.node.Node import core.node.NodeConfiguration import core.node.NodeConfigurationFromConfig -import core.node.services.ArtemisMessagingService import core.node.NodeInfo +import core.node.services.ArtemisMessagingService import core.node.services.NodeAttachmentService import core.node.services.NodeWalletService +import core.node.services.TimestamperService import core.protocols.ProtocolLogic import core.serialization.deserialize import core.utilities.ANSIProgressRenderer @@ -87,7 +88,7 @@ fun main(args: Array) { val addr = HostAndPort.fromString(options.valueOf(timestamperNetAddr)).withDefaultPort(Node.DEFAULT_PORT) val path = Paths.get(options.valueOf(timestamperIdentityFile)) val party = Files.readAllBytes(path).deserialize(includeClassName = true) - NodeInfo(ArtemisMessagingService.makeRecipient(addr), party) + NodeInfo(ArtemisMessagingService.makeRecipient(addr), party, advertisedServices = setOf(TimestamperService.Type)) } else null val node = logElapsedTime("Node startup") { Node(dir, myNetAddr, config, timestamperId).start() }