Fix the trader demo, the move to include services in NodeInfo objects broke it.

This commit is contained in:
Mike Hearn 2016-04-18 17:28:04 +02:00
parent ea4505b668
commit 8bac8f42e5
2 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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<String>) {
val addr = HostAndPort.fromString(options.valueOf(timestamperNetAddr)).withDefaultPort(Node.DEFAULT_PORT)
val path = Paths.get(options.valueOf(timestamperIdentityFile))
val party = Files.readAllBytes(path).deserialize<Party>(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() }