diff --git a/.idea/runConfigurations/Raft_Notary_Demo__Run_Notarisation.xml b/.idea/runConfigurations/Raft_Notary_Demo__Run_Notarisation.xml
index 0cf5567128..23512d7425 100644
--- a/.idea/runConfigurations/Raft_Notary_Demo__Run_Notarisation.xml
+++ b/.idea/runConfigurations/Raft_Notary_Demo__Run_Notarisation.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/node/src/main/kotlin/net/corda/node/driver/Driver.kt b/node/src/main/kotlin/net/corda/node/driver/Driver.kt
index 0120e62026..de94d0ae55 100644
--- a/node/src/main/kotlin/net/corda/node/driver/Driver.kt
+++ b/node/src/main/kotlin/net/corda/node/driver/Driver.kt
@@ -452,13 +452,16 @@ open class DriverDSL(
private fun startNetworkMapService(): ListenableFuture {
val debugPort = if (isDebug) debugPortAllocation.nextPort() else null
-
+ val apiAddress = portAllocation.nextHostAndPort().toString()
val baseDirectory = driverDirectory / networkMapLegalName
val config = ConfigHelper.loadConfig(
baseDirectory = baseDirectory,
allowMissingConfig = true,
configOverrides = mapOf(
"myLegalName" to networkMapLegalName,
+ // TODO: remove the webAddress as NMS doesn't need to run a web server. This will cause all
+ // node port numbers to be shifted, so all demos and docs need to be updated accordingly.
+ "webAddress" to apiAddress,
"artemisAddress" to networkMapAddress.toString(),
"extraAdvertisedServiceIds" to "",
"useTestClock" to useTestClock
diff --git a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt
index 577b024995..8a20e054d5 100644
--- a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt
+++ b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt
@@ -42,14 +42,14 @@ fun main(args: Array) {
Role.SENDER -> {
val host = HostAndPort.fromString("localhost:10004")
println("Connecting to sender node ($host)")
- CordaRPCClient(host, sslConfigFor("nodea", options.valueOf(certsPath))).use("demo", "demo") {
+ CordaRPCClient(host, sslConfigFor("BankA", options.valueOf(certsPath))).use("demo", "demo") {
sender(this)
}
}
Role.RECIPIENT -> {
val host = HostAndPort.fromString("localhost:10006")
println("Connecting to the recipient node ($host)")
- CordaRPCClient(host, sslConfigFor("nodeb", options.valueOf(certsPath))).use("demo", "demo") {
+ CordaRPCClient(host, sslConfigFor("BankB", options.valueOf(certsPath))).use("demo", "demo") {
recipient(this)
}
}
diff --git a/samples/irs-demo/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt b/samples/irs-demo/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt
index c34dbb0ac7..4989185995 100644
--- a/samples/irs-demo/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt
+++ b/samples/irs-demo/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt
@@ -143,11 +143,12 @@ object FixingFlow {
progressTracker.nextStep()
val dealToFix = serviceHub.loadState(ref)
val fixableDeal = (dealToFix.data as FixableDealState)
- val parties = fixableDeal.parties.filter { it.owningKey != serviceHub.myInfo.legalIdentity.owningKey }
- if (parties.isNotEmpty()) {
+ val parties = fixableDeal.parties.sortedBy { it.owningKey.toBase58String() }
+ val myKey = serviceHub.myInfo.legalIdentity.owningKey
+ if (parties[0].owningKey == myKey) {
val fixing = FixingSession(ref, fixableDeal.oracleType)
// Start the Floater which will then kick-off the Fixer
- subFlow(Floater(parties.first(), fixing))
+ subFlow(Floater(parties[1], fixing))
}
}
}
diff --git a/samples/raft-notary-demo/build.gradle b/samples/raft-notary-demo/build.gradle
index 0f5e3431c9..2d775301d7 100644
--- a/samples/raft-notary-demo/build.gradle
+++ b/samples/raft-notary-demo/build.gradle
@@ -84,12 +84,32 @@ task generateNotaryIdentity(type: JavaExec) {
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build', 'generateNotaryIdentity']) {
directory deployTo
networkMap "Notary 1"
+ node {
+ name "Party"
+ nearestCity "London"
+ advertisedServices = []
+ artemisPort 10002
+ webPort 10003
+ cordapps = []
+ rpcUsers = [['user': "demo", 'password': "demo", 'permissions': [
+ 'StartFlow.net.corda.notarydemo.flows.DummyIssueAndMove',
+ 'StartFlow.net.corda.flows.NotaryFlow$Client'
+ ]]]
+ }
+ node {
+ name "Counterparty"
+ nearestCity "New York"
+ advertisedServices = []
+ artemisPort 10004
+ webPort 10005
+ cordapps = []
+ }
node {
name "Notary 1"
nearestCity "London"
advertisedServices = [advertisedNotary]
- artemisPort 10002
- webPort 10009
+ artemisPort 10007
+ webPort 10008
cordapps = []
notaryNodePort 11002
}
@@ -97,8 +117,8 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build', 'generat
name "Notary 2"
nearestCity "London"
advertisedServices = [advertisedNotary]
- artemisPort 10004
- webPort 10005
+ artemisPort 10010
+ webPort 10011
cordapps = []
notaryNodePort 11004
notaryClusterAddresses = ["localhost:11002"]
@@ -107,28 +127,12 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build', 'generat
name "Notary 3"
nearestCity "London"
advertisedServices = [advertisedNotary]
- artemisPort 10006
- webPort 10007
+ artemisPort 10013
+ webPort 10014
cordapps = []
notaryNodePort 11006
notaryClusterAddresses = ["localhost:11002"]
}
- node {
- name "Party"
- nearestCity "London"
- advertisedServices = []
- artemisPort 10008
- webPort 10003
- cordapps = []
- }
- node {
- name "Counterparty"
- nearestCity "New York"
- advertisedServices = []
- artemisPort 10010
- webPort 10011
- cordapps = []
- }
}
task notarise(type: JavaExec) {
diff --git a/samples/raft-notary-demo/src/main/kotlin/net/corda/notarydemo/NotaryDemo.kt b/samples/raft-notary-demo/src/main/kotlin/net/corda/notarydemo/NotaryDemo.kt
index c88f917d43..df8b546fa7 100644
--- a/samples/raft-notary-demo/src/main/kotlin/net/corda/notarydemo/NotaryDemo.kt
+++ b/samples/raft-notary-demo/src/main/kotlin/net/corda/notarydemo/NotaryDemo.kt
@@ -2,6 +2,7 @@ package net.corda.notarydemo
import com.google.common.net.HostAndPort
import com.google.common.util.concurrent.Futures
+import joptsimple.OptionParser
import net.corda.core.crypto.toStringShort
import net.corda.core.div
import net.corda.core.getOrThrow
@@ -14,11 +15,13 @@ import net.corda.node.services.messaging.CordaRPCClient
import net.corda.notarydemo.flows.DummyIssueAndMove
import java.nio.file.Path
import java.nio.file.Paths
+import kotlin.system.exitProcess
fun main(args: Array) {
+ val certPath = getCertPath(args)
val host = HostAndPort.fromString("localhost:10002")
println("Connecting to the recipient node ($host)")
- CordaRPCClient(host, sslConfigFor("nodeb", "build/notary-demo-nodes/Party/certificates")).use("demo", "demo") {
+ CordaRPCClient(host, sslConfigFor("Party", certPath)).use("demo", "demo") {
val api = NotaryDemoClientApi(this)
api.startNotarisation()
}
@@ -79,6 +82,18 @@ private class NotaryDemoClientApi(val rpc: CordaRPCOps) {
}
}
+private fun getCertPath(args: Array): String? {
+ val parser = OptionParser()
+ val certsPath = parser.accepts("certificates").withRequiredArg()
+ val options = try {
+ parser.parse(*args)
+ } catch (e: Exception) {
+ println(e.message)
+ exitProcess(1)
+ }
+ return options.valueOf(certsPath)
+}
+
// TODO: Take this out once we have a dedicated RPC port and allow SSL on it to be optional.
private fun sslConfigFor(nodename: String, certsPath: String?): SSLConfiguration {
return object : SSLConfiguration {