mirror of
https://github.com/corda/corda.git
synced 2025-02-18 16:40:55 +00:00
Merge branch 'master' into colljos-vault-code-clean-up-refactor
This commit is contained in:
commit
012dc9ec10
1
.idea/runConfigurations/Clean___Install.xml
generated
1
.idea/runConfigurations/Clean___Install.xml
generated
@ -11,6 +11,7 @@
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="clean" />
|
||||
<option value="build" />
|
||||
<option value="installDist" />
|
||||
<option value="buildCordaJAR" />
|
||||
</list>
|
||||
|
43
build.gradle
43
build.gradle
@ -30,7 +30,6 @@ plugins {
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'application'
|
||||
apply plugin: 'project-report'
|
||||
apply plugin: QuasarPlugin
|
||||
apply plugin: 'com.github.ben-manes.versions'
|
||||
@ -93,14 +92,8 @@ configurations {
|
||||
integrationTestRuntime.extendsFrom testRuntime
|
||||
}
|
||||
|
||||
// This is required for quasar. I think.
|
||||
applicationDefaultJvmArgs = ["-javaagent:${configurations.quasar.singleFile}"]
|
||||
// Needed by the :startScripts task
|
||||
mainClassName = 'com.r3corda.demos.TraderDemoKt'
|
||||
|
||||
// To find potential version conflicts, run "gradle htmlDependencyReport" and then look in
|
||||
// build/reports/project/dependencies/index.html for green highlighted parts of the tree.
|
||||
|
||||
dependencies {
|
||||
compile project(':node')
|
||||
// TODO: Demos should not depend on test code, but only use production APIs
|
||||
@ -121,41 +114,11 @@ dependencies {
|
||||
integrationTestCompile project(':test-utils')
|
||||
}
|
||||
|
||||
// Package up the demo programs.
|
||||
|
||||
task getAttachmentDemo(type: CreateStartScripts) {
|
||||
mainClassName = "com.r3corda.demos.attachment.AttachmentDemoKt"
|
||||
applicationName = "attachment-demo"
|
||||
defaultJvmOpts = ["-javaagent:${configurations.quasar.singleFile}"]
|
||||
outputDir = new File(project.buildDir, 'scripts')
|
||||
classpath = jar.outputs.files + project.configurations.runtime
|
||||
}
|
||||
|
||||
task getTraderDemo(type: CreateStartScripts) {
|
||||
mainClassName = "com.r3corda.demos.TraderDemoKt"
|
||||
applicationName = "trader-demo"
|
||||
defaultJvmOpts = ["-javaagent:${configurations.quasar.singleFile}"]
|
||||
outputDir = new File(project.buildDir, 'scripts')
|
||||
classpath = jar.outputs.files + project.configurations.runtime
|
||||
}
|
||||
|
||||
// Force windows script classpath to wildcard path to avoid the 'Command Line Is Too Long' issues
|
||||
// with generated scripts. Include Jolokia .war explicitly as this isn't picked up by wildcard
|
||||
tasks.withType(CreateStartScripts) {
|
||||
doLast {
|
||||
windowsScript.text = windowsScript
|
||||
.readLines()
|
||||
.collect { line -> line.replaceAll(~/^set CLASSPATH=.*$/, 'set CLASSPATH=%APP_HOME%/lib/*;%APP_HOME%/lib/jolokia-agent-war-'+project.ext.jolokia_version+'.war') }
|
||||
.join('\r\n')
|
||||
}
|
||||
}
|
||||
|
||||
task integrationTest(type: Test, dependsOn: [':node:integrationTest',':client:integrationTest']) {
|
||||
testClassesDir = sourceSets.integrationTest.output.classesDir
|
||||
classpath = sourceSets.integrationTest.runtimeClasspath
|
||||
}
|
||||
|
||||
|
||||
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
|
||||
dependsOn = subprojects.test
|
||||
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
|
||||
@ -183,12 +146,6 @@ tasks.withType(Test) {
|
||||
|
||||
quasarScan.dependsOn('classes', 'core:classes', 'contracts:classes', 'node:classes')
|
||||
|
||||
applicationDistribution.into("bin") {
|
||||
from(getAttachmentDemo)
|
||||
from(getTraderDemo)
|
||||
fileMode = 0755
|
||||
}
|
||||
|
||||
task buildCordaJAR(type: FatCapsule, dependsOn: ['quasarScan', 'buildCertSigningRequestUtilityJAR']) {
|
||||
applicationClass 'com.r3corda.node.MainKt'
|
||||
archiveName 'corda.jar'
|
||||
|
@ -30,8 +30,8 @@ abstract class CordaPluginRegistry {
|
||||
|
||||
/**
|
||||
* List of additional long lived services to be hosted within the node.
|
||||
* They are expected to have a single parameter constructor that takes a ServiceHubInternal as input.
|
||||
* The ServiceHubInternal will be fully constructed before the plugin service is created and will
|
||||
* They are expected to have a single parameter constructor that takes a [PluginServiceHub] as input.
|
||||
* The [PluginServiceHub] will be fully constructed before the plugin service is created and will
|
||||
* allow access to the protocol factory and protocol initiation entry points there.
|
||||
*/
|
||||
open val servicePlugins: List<Class<*>> = emptyList()
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.r3corda.core.node
|
||||
|
||||
import com.r3corda.core.crypto.Party
|
||||
import com.r3corda.core.protocols.ProtocolLogic
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* A service hub to be used by the [CordaPluginRegistry]
|
||||
*/
|
||||
interface PluginServiceHub : ServiceHub {
|
||||
/**
|
||||
* Register the protocol factory we wish to use when a initiating party attempts to communicate with us. The
|
||||
* registration is done against a marker [KClass] which is sent in the session handshake by the other party. If this
|
||||
* marker class has been registered then the corresponding factory will be used to create the protocol which will
|
||||
* communicate with the other side. If there is no mapping then the session attempt is rejected.
|
||||
* @param markerClass The marker [KClass] present in a session initiation attempt, which is a 1:1 mapping to a [Class]
|
||||
* using the <pre>::class</pre> construct. Conventionally this is a [ProtocolLogic] subclass, however any class can
|
||||
* be used, with the default being the class of the initiating protocol. This enables the registration to be of the
|
||||
* form: registerProtocolInitiator(InitiatorProtocol::class, ::InitiatedProtocol)
|
||||
* @param protocolFactory The protocol factory generating the initiated protocol.
|
||||
*/
|
||||
|
||||
// TODO: remove dependency on Kotlin relfection (Kotlin KClass -> Java Class).
|
||||
fun registerProtocolInitiator(markerClass: KClass<*>, protocolFactory: (Party) -> ProtocolLogic<*>)
|
||||
|
||||
/**
|
||||
* Return the protocol factory that has been registered with [markerClass], or null if no factory is found.
|
||||
*/
|
||||
fun getProtocolFactory(markerClass: Class<*>): ((Party) -> ProtocolLogic<*>)?
|
||||
}
|
@ -24,6 +24,10 @@ class JDBCHashMapTestSuite {
|
||||
lateinit var dataSource: Closeable
|
||||
lateinit var transaction: Transaction
|
||||
lateinit var database: Database
|
||||
lateinit var loadOnInitFalseMap: JDBCHashMap<String, String>
|
||||
lateinit var loadOnInitTrueMap: JDBCHashMap<String, String>
|
||||
lateinit var loadOnInitFalseSet: JDBCHashSet<String>
|
||||
lateinit var loadOnInitTrueSet: JDBCHashSet<String>
|
||||
|
||||
@JvmStatic
|
||||
@BeforeClass
|
||||
@ -32,6 +36,10 @@ class JDBCHashMapTestSuite {
|
||||
dataSource = dataSourceAndDatabase.first
|
||||
database = dataSourceAndDatabase.second
|
||||
setUpDatabaseTx()
|
||||
loadOnInitFalseMap = JDBCHashMap<String, String>("test_map_false", loadOnInit = false)
|
||||
loadOnInitTrueMap = JDBCHashMap<String, String>("test_map_true", loadOnInit = true)
|
||||
loadOnInitFalseSet = JDBCHashSet<String>("test_set_false", loadOnInit = false)
|
||||
loadOnInitTrueSet = JDBCHashSet<String>("test_set_true", loadOnInit = true)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ -112,7 +120,8 @@ class JDBCHashMapTestSuite {
|
||||
*/
|
||||
class JDBCHashMapTestGenerator(val loadOnInit: Boolean) : com.google.common.collect.testing.TestStringMapGenerator() {
|
||||
override fun create(elements: Array<Map.Entry<String, String>>): Map<String, String> {
|
||||
val map = JDBCHashMap<String, String>("test_map_${System.nanoTime()}", loadOnInit = loadOnInit)
|
||||
val map = if (loadOnInit) loadOnInitTrueMap else loadOnInitFalseMap
|
||||
map.clear()
|
||||
map.putAll(elements.associate { Pair(it.key, it.value) })
|
||||
return map
|
||||
}
|
||||
@ -143,7 +152,8 @@ class JDBCHashMapTestSuite {
|
||||
*/
|
||||
class JDBCHashSetTestGenerator(val loadOnInit: Boolean) : com.google.common.collect.testing.TestStringSetGenerator() {
|
||||
override fun create(elements: Array<String>): Set<String> {
|
||||
val set = JDBCHashSet<String>("test_set_${System.nanoTime()}", loadOnInit = loadOnInit)
|
||||
val set = if (loadOnInit) loadOnInitTrueSet else loadOnInitFalseSet
|
||||
set.clear()
|
||||
set.addAll(elements)
|
||||
return set
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ abstract class AbstractNode(open val configuration: NodeConfiguration, val netwo
|
||||
val pluginServices = pluginRegistries.flatMap { x -> x.servicePlugins }
|
||||
val serviceList = mutableListOf<Any>()
|
||||
for (serviceClass in pluginServices) {
|
||||
val service = serviceClass.getConstructor(ServiceHubInternal::class.java).newInstance(services)
|
||||
val service = serviceClass.getConstructor(PluginServiceHub::class.java).newInstance(services)
|
||||
serviceList.add(service)
|
||||
tokenizableServices.add(service)
|
||||
if (service is AcceptsFileUpload) {
|
||||
|
@ -33,6 +33,7 @@ import org.glassfish.jersey.servlet.ServletContainer
|
||||
import org.jetbrains.exposed.sql.Database
|
||||
import java.io.RandomAccessFile
|
||||
import java.lang.management.ManagementFactory
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
import java.nio.channels.FileLock
|
||||
import java.time.Clock
|
||||
import java.util.*
|
||||
@ -143,13 +144,18 @@ class Node(override val configuration: FullNodeConfiguration, networkMapAddress:
|
||||
|
||||
// Export JMX monitoring statistics and data over REST/JSON.
|
||||
if (configuration.exportJMXto.split(',').contains("http")) {
|
||||
handlerCollection.addHandler(WebAppContext().apply {
|
||||
// Find the jolokia WAR file on the classpath.
|
||||
contextPath = "/monitoring/json"
|
||||
setInitParameter("mimeType", "application/json")
|
||||
val classpath = System.getProperty("java.class.path").split(System.getProperty("path.separator"))
|
||||
war = classpath.first { it.contains("jolokia-agent-war-2") && it.endsWith(".war") }
|
||||
})
|
||||
val classpath = System.getProperty("java.class.path").split(System.getProperty("path.separator"))
|
||||
val warpath = classpath.firstOrNull() { it.contains("jolokia-agent-war-2") && it.endsWith(".war") }
|
||||
if (warpath != null) {
|
||||
handlerCollection.addHandler(WebAppContext().apply {
|
||||
// Find the jolokia WAR file on the classpath.
|
||||
contextPath = "/monitoring/json"
|
||||
setInitParameter("mimeType", "application/json")
|
||||
war = warpath
|
||||
})
|
||||
} else {
|
||||
log.warn("Unable to locate Jolokia WAR on classpath")
|
||||
}
|
||||
}
|
||||
|
||||
// API, data upload and download to services (attachments, rates oracles etc)
|
||||
@ -157,7 +163,7 @@ class Node(override val configuration: FullNodeConfiguration, networkMapAddress:
|
||||
|
||||
val server = Server()
|
||||
|
||||
if (configuration.useHTTPS) {
|
||||
val connector = if (configuration.useHTTPS) {
|
||||
val httpsConfiguration = HttpConfiguration()
|
||||
httpsConfiguration.outputBufferSize = 32768
|
||||
httpsConfiguration.addCustomizer(SecureRequestCustomizer())
|
||||
@ -173,14 +179,16 @@ class Node(override val configuration: FullNodeConfiguration, networkMapAddress:
|
||||
sslContextFactory.setIncludeCipherSuites(".*AES.*GCM.*")
|
||||
val sslConnector = ServerConnector(server, SslConnectionFactory(sslContextFactory, "http/1.1"), HttpConnectionFactory(httpsConfiguration))
|
||||
sslConnector.port = configuration.webAddress.port
|
||||
server.connectors = arrayOf<Connector>(sslConnector)
|
||||
sslConnector
|
||||
} else {
|
||||
val httpConfiguration = HttpConfiguration()
|
||||
httpConfiguration.outputBufferSize = 32768
|
||||
val httpConnector = ServerConnector(server, HttpConnectionFactory(httpConfiguration))
|
||||
httpConnector.port = configuration.webAddress.port
|
||||
server.connectors = arrayOf<Connector>(httpConnector)
|
||||
httpConnector
|
||||
}
|
||||
server.connectors = arrayOf<Connector>(connector)
|
||||
log.info("Starting web API server on port ${connector.port}")
|
||||
|
||||
server.handler = handlerCollection
|
||||
runOnStop += Runnable { server.stop() }
|
||||
@ -203,8 +211,19 @@ class Node(override val configuration: FullNodeConfiguration, networkMapAddress:
|
||||
|
||||
val webAPIsOnClasspath = pluginRegistries.flatMap { x -> x.webApis }
|
||||
for (webapi in webAPIsOnClasspath) {
|
||||
log.info("Add Plugin web API from attachment ${webapi.name}")
|
||||
val customAPI = webapi.getConstructor(ServiceHub::class.java).newInstance(services)
|
||||
log.info("Add plugin web API from attachment ${webapi.name}")
|
||||
val constructor = try {
|
||||
webapi.getConstructor(ServiceHub::class.java)
|
||||
} catch (ex: NoSuchMethodException) {
|
||||
log.error("Missing constructor ${webapi.name}(ServiceHub)")
|
||||
continue
|
||||
}
|
||||
val customAPI = try {
|
||||
constructor.newInstance(services)
|
||||
} catch (ex: InvocationTargetException) {
|
||||
log.error("Constructor ${webapi.name}(ServiceHub) threw an error: ", ex.targetException)
|
||||
continue
|
||||
}
|
||||
resourceConfig.register(customAPI)
|
||||
}
|
||||
|
||||
@ -270,7 +289,13 @@ class Node(override val configuration: FullNodeConfiguration, networkMapAddress:
|
||||
super.start()
|
||||
// Only start the service API requests once the network map registration is complete
|
||||
networkMapRegistrationFuture.then {
|
||||
webServer = initWebServer()
|
||||
try {
|
||||
webServer = initWebServer()
|
||||
} catch(ex: Exception) {
|
||||
// TODO: We need to decide if this is a fatal error, given the API is unavailable, or whether the API
|
||||
// is not critical and we continue anyway.
|
||||
log.error("Web server startup failed", ex)
|
||||
}
|
||||
// Begin exporting our own metrics via JMX.
|
||||
JmxReporter.
|
||||
forRegistry(services.monitoringService.metrics).
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.r3corda.node.services
|
||||
|
||||
import com.r3corda.core.node.CordaPluginRegistry
|
||||
import com.r3corda.core.node.PluginServiceHub
|
||||
import com.r3corda.core.serialization.SingletonSerializeAsToken
|
||||
import com.r3corda.node.services.api.ServiceHubInternal
|
||||
import com.r3corda.protocols.NotaryChangeProtocol
|
||||
@ -14,7 +15,7 @@ object NotaryChange {
|
||||
* A service that monitors the network for requests for changing the notary of a state,
|
||||
* and immediately runs the [NotaryChangeProtocol] if the auto-accept criteria are met.
|
||||
*/
|
||||
class Service(services: ServiceHubInternal) : SingletonSerializeAsToken() {
|
||||
class Service(services: PluginServiceHub) : SingletonSerializeAsToken() {
|
||||
init {
|
||||
services.registerProtocolInitiator(NotaryChangeProtocol.Instigator::class) { NotaryChangeProtocol.Acceptor(it) }
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.r3corda.node.services.api
|
||||
import com.google.common.util.concurrent.ListenableFuture
|
||||
import com.r3corda.core.crypto.Party
|
||||
import com.r3corda.core.messaging.MessagingService
|
||||
import com.r3corda.core.node.PluginServiceHub
|
||||
import com.r3corda.core.node.ServiceHub
|
||||
import com.r3corda.core.node.services.TxWritableStorageService
|
||||
import com.r3corda.core.protocols.ProtocolLogic
|
||||
@ -37,7 +38,7 @@ interface MessagingServiceBuilder<out T : MessagingServiceInternal> {
|
||||
|
||||
private val log = LoggerFactory.getLogger(ServiceHubInternal::class.java)
|
||||
|
||||
abstract class ServiceHubInternal : ServiceHub {
|
||||
abstract class ServiceHubInternal : PluginServiceHub {
|
||||
abstract val monitoringService: MonitoringService
|
||||
abstract val protocolLogicRefFactory: ProtocolLogicRefFactory
|
||||
abstract val schemaService: SchemaService
|
||||
@ -71,24 +72,6 @@ abstract class ServiceHubInternal : ServiceHub {
|
||||
*/
|
||||
abstract fun <T> startProtocol(logic: ProtocolLogic<T>): ListenableFuture<T>
|
||||
|
||||
/**
|
||||
* Register the protocol factory we wish to use when a initiating party attempts to communicate with us. The
|
||||
* registration is done against a marker [KClass] which is sent in the session handshake by the other party. If this
|
||||
* marker class has been registered then the corresponding factory will be used to create the protocol which will
|
||||
* communicate with the other side. If there is no mapping then the session attempt is rejected.
|
||||
* @param markerClass The marker [KClass] present in a session initiation attempt, which is a 1:1 mapping to a [Class]
|
||||
* using the <pre>::class</pre> construct. Conventionally this is a [ProtocolLogic] subclass, however any class can
|
||||
* be used, with the default being the class of the initiating protocol. This enables the registration to be of the
|
||||
* form: registerProtocolInitiator(InitiatorProtocol::class, ::InitiatedProtocol)
|
||||
* @param protocolFactory The protocol factory generating the initiated protocol.
|
||||
*/
|
||||
abstract fun registerProtocolInitiator(markerClass: KClass<*>, protocolFactory: (Party) -> ProtocolLogic<*>)
|
||||
|
||||
/**
|
||||
* Return the protocol factory that has been registered with [markerClass], or null if no factory is found.
|
||||
*/
|
||||
abstract fun getProtocolFactory(markerClass: Class<*>): ((Party) -> ProtocolLogic<*>)?
|
||||
|
||||
override fun <T : Any> invokeProtocolAsync(logicType: Class<out ProtocolLogic<T>>, vararg args: Any?): ListenableFuture<T> {
|
||||
val logicRef = protocolLogicRefFactory.create(logicType, *args)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
@ -6,6 +6,7 @@ import com.google.common.util.concurrent.SettableFuture
|
||||
import com.r3corda.core.bufferUntilSubscribed
|
||||
import com.r3corda.core.contracts.Contract
|
||||
import com.r3corda.core.crypto.Party
|
||||
import com.r3corda.core.crypto.toStringShort
|
||||
import com.r3corda.core.map
|
||||
import com.r3corda.core.messaging.MessagingService
|
||||
import com.r3corda.core.messaging.SingleMessageRecipient
|
||||
@ -72,9 +73,16 @@ open class InMemoryNetworkMapCache : SingletonSerializeAsToken(), NetworkMapCach
|
||||
override fun get(serviceType: ServiceType) = registeredNodes.filterValues { it.advertisedServices.any { it.info.type.isSubTypeOf(serviceType) } }.map { it.value }
|
||||
override fun getRecommended(type: ServiceType, contract: Contract, vararg party: Party): NodeInfo? = get(type).firstOrNull()
|
||||
override fun getNodeByLegalName(name: String) = get().singleOrNull { it.legalIdentity.name == name }
|
||||
override fun getNodeByPublicKey(publicKey: PublicKey) = get().singleOrNull {
|
||||
(it.legalIdentity.owningKey == publicKey)
|
||||
|| it.advertisedServices.any { it.identity.owningKey == publicKey }
|
||||
override fun getNodeByPublicKey(publicKey: PublicKey): NodeInfo? {
|
||||
// Although we should never have more than one match, it is theoretically possible. Report an error if it happens.
|
||||
val candidates = get().filter {
|
||||
(it.legalIdentity.owningKey == publicKey)
|
||||
|| it.advertisedServices.any { it.identity.owningKey == publicKey }
|
||||
}
|
||||
if (candidates.size > 1) {
|
||||
throw IllegalStateException("Found more than one match for key ${publicKey.toStringShort()}")
|
||||
}
|
||||
return candidates.singleOrNull()
|
||||
}
|
||||
|
||||
override fun addMapService(net: MessagingService, networkMapAddress: SingleMessageRecipient, subscribe: Boolean,
|
||||
|
@ -3,6 +3,7 @@ package com.r3corda.node.services.persistence
|
||||
import co.paralleluniverse.fibers.Suspendable
|
||||
import com.r3corda.core.crypto.Party
|
||||
import com.r3corda.core.node.CordaPluginRegistry
|
||||
import com.r3corda.core.node.PluginServiceHub
|
||||
import com.r3corda.core.node.recordTransactions
|
||||
import com.r3corda.core.protocols.ProtocolLogic
|
||||
import com.r3corda.core.serialization.SingletonSerializeAsToken
|
||||
@ -31,10 +32,7 @@ object DataVending {
|
||||
* Additionally, because nodes do not store invalid transactions, requesting such a transaction will always yield null.
|
||||
*/
|
||||
@ThreadSafe
|
||||
// TODO: I don't like that this needs ServiceHubInternal, but passing in a state machine breaks MockServices because
|
||||
// the state machine isn't set when this is constructed. [NodeSchedulerService] has the same problem, and both
|
||||
// should be fixed at the same time.
|
||||
class Service(services: ServiceHubInternal) : SingletonSerializeAsToken() {
|
||||
class Service(services: PluginServiceHub) : SingletonSerializeAsToken() {
|
||||
|
||||
companion object {
|
||||
val logger = loggerFor<DataVending.Service>()
|
||||
|
@ -1,8 +1,14 @@
|
||||
package com.r3corda.node.services
|
||||
|
||||
import com.r3corda.core.crypto.generateKeyPair
|
||||
import com.r3corda.core.node.services.ServiceInfo
|
||||
import com.r3corda.node.services.network.NetworkMapService
|
||||
import com.r3corda.node.services.transactions.SimpleNotaryService
|
||||
import com.r3corda.testing.expect
|
||||
import com.r3corda.testing.node.MockNetwork
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class InMemoryNetworkMapCacheTest {
|
||||
lateinit var network: MockNetwork
|
||||
@ -20,4 +26,20 @@ class InMemoryNetworkMapCacheTest {
|
||||
network.runNetwork()
|
||||
future.get()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `key collision`() {
|
||||
val keyPair = generateKeyPair()
|
||||
val nodeA = network.createNode(null, -1, MockNetwork.DefaultFactory, true, "Node A", keyPair, ServiceInfo(NetworkMapService.type))
|
||||
val nodeB = network.createNode(null, -1, MockNetwork.DefaultFactory, true, "Node B", keyPair, ServiceInfo(NetworkMapService.type))
|
||||
|
||||
// Node A currently knows only about itself, so this returns node A
|
||||
assertEquals(nodeA.netMapCache.getNodeByPublicKey(keyPair.public), nodeA.info)
|
||||
|
||||
nodeA.netMapCache.addNode(nodeB.info)
|
||||
// Now both nodes match, so it throws an error
|
||||
expect<IllegalStateException> {
|
||||
nodeA.netMapCache.getNodeByPublicKey(keyPair.public)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,227 +0,0 @@
|
||||
# Some pretend noddy rate fixes, for the interest rate oracles.
|
||||
|
||||
ICE LIBOR 2016-03-16 1M = 0.678
|
||||
ICE LIBOR 2016-03-16 2M = 0.655
|
||||
EURIBOR 2016-03-15 1M = 0.123
|
||||
EURIBOR 2016-03-15 2M = 0.111
|
||||
|
||||
ICE LIBOR 2016-03-06 3M = 0.0063515
|
||||
ICE LIBOR 2016-03-07 3M = 0.0063516
|
||||
ICE LIBOR 2016-03-08 3M = 0.0063517
|
||||
ICE LIBOR 2016-03-09 3M = 0.0063518
|
||||
ICE LIBOR 2016-03-10 3M = 0.0063519
|
||||
ICE LIBOR 2016-06-06 3M = 0.0063520
|
||||
ICE LIBOR 2016-06-07 3M = 0.0063521
|
||||
ICE LIBOR 2016-06-08 3M = 0.0063522
|
||||
ICE LIBOR 2016-06-09 3M = 0.0063523
|
||||
ICE LIBOR 2016-06-10 3M = 0.0063524
|
||||
ICE LIBOR 2016-09-06 3M = 0.0063525
|
||||
ICE LIBOR 2016-09-07 3M = 0.0063526
|
||||
ICE LIBOR 2016-09-08 3M = 0.0063527
|
||||
ICE LIBOR 2016-09-09 3M = 0.0063528
|
||||
ICE LIBOR 2016-09-10 3M = 0.0063529
|
||||
ICE LIBOR 2016-12-06 3M = 0.0063530
|
||||
ICE LIBOR 2016-12-07 3M = 0.0063531
|
||||
ICE LIBOR 2016-12-08 3M = 0.0063532
|
||||
ICE LIBOR 2016-12-09 3M = 0.0063533
|
||||
ICE LIBOR 2016-12-10 3M = 0.0063534
|
||||
ICE LIBOR 2017-03-06 3M = 0.0063535
|
||||
ICE LIBOR 2017-03-07 3M = 0.0063536
|
||||
ICE LIBOR 2017-03-08 3M = 0.0063537
|
||||
ICE LIBOR 2017-03-09 3M = 0.0063538
|
||||
ICE LIBOR 2017-03-10 3M = 0.0063539
|
||||
ICE LIBOR 2017-06-06 3M = 0.0063540
|
||||
ICE LIBOR 2017-06-07 3M = 0.0063541
|
||||
ICE LIBOR 2017-06-08 3M = 0.0063542
|
||||
ICE LIBOR 2017-06-09 3M = 0.0063543
|
||||
ICE LIBOR 2017-06-10 3M = 0.0063544
|
||||
ICE LIBOR 2017-09-06 3M = 0.0063545
|
||||
ICE LIBOR 2017-09-07 3M = 0.0063546
|
||||
ICE LIBOR 2017-09-08 3M = 0.0063547
|
||||
ICE LIBOR 2017-09-09 3M = 0.0063548
|
||||
ICE LIBOR 2017-09-10 3M = 0.0063549
|
||||
ICE LIBOR 2017-12-06 3M = 0.0063550
|
||||
ICE LIBOR 2017-12-07 3M = 0.0063551
|
||||
ICE LIBOR 2017-12-08 3M = 0.0063552
|
||||
ICE LIBOR 2017-12-09 3M = 0.0063553
|
||||
ICE LIBOR 2017-12-10 3M = 0.0063554
|
||||
ICE LIBOR 2018-03-06 3M = 0.0063555
|
||||
ICE LIBOR 2018-03-07 3M = 0.0063556
|
||||
ICE LIBOR 2018-03-08 3M = 0.0063557
|
||||
ICE LIBOR 2018-03-09 3M = 0.0063558
|
||||
ICE LIBOR 2018-03-10 3M = 0.0063559
|
||||
ICE LIBOR 2018-06-06 3M = 0.0063560
|
||||
ICE LIBOR 2018-06-07 3M = 0.0063561
|
||||
ICE LIBOR 2018-06-08 3M = 0.0063562
|
||||
ICE LIBOR 2018-06-09 3M = 0.0063563
|
||||
ICE LIBOR 2018-06-10 3M = 0.0063564
|
||||
ICE LIBOR 2018-09-06 3M = 0.0063565
|
||||
ICE LIBOR 2018-09-07 3M = 0.0063566
|
||||
ICE LIBOR 2018-09-08 3M = 0.0063567
|
||||
ICE LIBOR 2018-09-09 3M = 0.0063568
|
||||
ICE LIBOR 2018-09-10 3M = 0.0063569
|
||||
ICE LIBOR 2018-12-06 3M = 0.0063570
|
||||
ICE LIBOR 2018-12-07 3M = 0.0063571
|
||||
ICE LIBOR 2018-12-08 3M = 0.0063572
|
||||
ICE LIBOR 2018-12-09 3M = 0.0063573
|
||||
ICE LIBOR 2018-12-10 3M = 0.0063574
|
||||
ICE LIBOR 2019-03-06 3M = 0.0063575
|
||||
ICE LIBOR 2019-03-07 3M = 0.0063576
|
||||
ICE LIBOR 2019-03-08 3M = 0.0063577
|
||||
ICE LIBOR 2019-03-09 3M = 0.0063578
|
||||
ICE LIBOR 2019-03-10 3M = 0.0063579
|
||||
ICE LIBOR 2019-06-06 3M = 0.0063580
|
||||
ICE LIBOR 2019-06-07 3M = 0.0063581
|
||||
ICE LIBOR 2019-06-08 3M = 0.0063582
|
||||
ICE LIBOR 2019-06-09 3M = 0.0063583
|
||||
ICE LIBOR 2019-06-10 3M = 0.0063584
|
||||
ICE LIBOR 2019-09-06 3M = 0.0063585
|
||||
ICE LIBOR 2019-09-07 3M = 0.0063586
|
||||
ICE LIBOR 2019-09-08 3M = 0.0063587
|
||||
ICE LIBOR 2019-09-09 3M = 0.0063588
|
||||
ICE LIBOR 2019-09-10 3M = 0.0063589
|
||||
ICE LIBOR 2019-12-06 3M = 0.0063590
|
||||
ICE LIBOR 2019-12-07 3M = 0.0063591
|
||||
ICE LIBOR 2019-12-08 3M = 0.0063592
|
||||
ICE LIBOR 2019-12-09 3M = 0.0063593
|
||||
ICE LIBOR 2019-12-10 3M = 0.0063594
|
||||
ICE LIBOR 2020-03-06 3M = 0.0063595
|
||||
ICE LIBOR 2020-03-07 3M = 0.0063596
|
||||
ICE LIBOR 2020-03-08 3M = 0.0063597
|
||||
ICE LIBOR 2020-03-09 3M = 0.0063598
|
||||
ICE LIBOR 2020-03-10 3M = 0.0063599
|
||||
ICE LIBOR 2020-06-06 3M = 0.0063600
|
||||
ICE LIBOR 2020-06-07 3M = 0.0063601
|
||||
ICE LIBOR 2020-06-08 3M = 0.0063602
|
||||
ICE LIBOR 2020-06-09 3M = 0.0063603
|
||||
ICE LIBOR 2020-06-10 3M = 0.0063604
|
||||
ICE LIBOR 2020-09-06 3M = 0.0063605
|
||||
ICE LIBOR 2020-09-07 3M = 0.0063606
|
||||
ICE LIBOR 2020-09-08 3M = 0.0063607
|
||||
ICE LIBOR 2020-09-09 3M = 0.0063608
|
||||
ICE LIBOR 2020-09-10 3M = 0.0063609
|
||||
ICE LIBOR 2020-12-06 3M = 0.0063610
|
||||
ICE LIBOR 2020-12-07 3M = 0.0063611
|
||||
ICE LIBOR 2020-12-08 3M = 0.0063612
|
||||
ICE LIBOR 2020-12-09 3M = 0.0063613
|
||||
ICE LIBOR 2020-12-10 3M = 0.0063614
|
||||
ICE LIBOR 2021-03-06 3M = 0.0063615
|
||||
ICE LIBOR 2021-03-07 3M = 0.0063616
|
||||
ICE LIBOR 2021-03-08 3M = 0.0063617
|
||||
ICE LIBOR 2021-03-09 3M = 0.0063618
|
||||
ICE LIBOR 2021-03-10 3M = 0.0063619
|
||||
ICE LIBOR 2021-06-06 3M = 0.0063620
|
||||
ICE LIBOR 2021-06-07 3M = 0.0063621
|
||||
ICE LIBOR 2021-06-08 3M = 0.0063622
|
||||
ICE LIBOR 2021-06-09 3M = 0.0063623
|
||||
ICE LIBOR 2021-06-10 3M = 0.0063624
|
||||
ICE LIBOR 2021-09-06 3M = 0.0063625
|
||||
ICE LIBOR 2021-09-07 3M = 0.0063626
|
||||
ICE LIBOR 2021-09-08 3M = 0.0063627
|
||||
ICE LIBOR 2021-09-09 3M = 0.0063628
|
||||
ICE LIBOR 2021-09-10 3M = 0.0063629
|
||||
ICE LIBOR 2021-12-06 3M = 0.0063630
|
||||
ICE LIBOR 2021-12-07 3M = 0.0063631
|
||||
ICE LIBOR 2021-12-08 3M = 0.0063632
|
||||
ICE LIBOR 2021-12-09 3M = 0.0063633
|
||||
ICE LIBOR 2021-12-10 3M = 0.0063634
|
||||
ICE LIBOR 2022-03-06 3M = 0.0063635
|
||||
ICE LIBOR 2022-03-07 3M = 0.0063636
|
||||
ICE LIBOR 2022-03-08 3M = 0.0063637
|
||||
ICE LIBOR 2022-03-09 3M = 0.0063638
|
||||
ICE LIBOR 2022-03-10 3M = 0.0063639
|
||||
ICE LIBOR 2022-06-06 3M = 0.0063640
|
||||
ICE LIBOR 2022-06-07 3M = 0.0063641
|
||||
ICE LIBOR 2022-06-08 3M = 0.0063642
|
||||
ICE LIBOR 2022-06-09 3M = 0.0063643
|
||||
ICE LIBOR 2022-06-10 3M = 0.0063644
|
||||
ICE LIBOR 2022-09-06 3M = 0.0063645
|
||||
ICE LIBOR 2022-09-07 3M = 0.0063646
|
||||
ICE LIBOR 2022-09-08 3M = 0.0063647
|
||||
ICE LIBOR 2022-09-09 3M = 0.0063648
|
||||
ICE LIBOR 2022-09-10 3M = 0.0063649
|
||||
ICE LIBOR 2022-12-06 3M = 0.0063650
|
||||
ICE LIBOR 2022-12-07 3M = 0.0063651
|
||||
ICE LIBOR 2022-12-08 3M = 0.0063652
|
||||
ICE LIBOR 2022-12-09 3M = 0.0063653
|
||||
ICE LIBOR 2022-12-10 3M = 0.0063654
|
||||
ICE LIBOR 2023-03-06 3M = 0.0063655
|
||||
ICE LIBOR 2023-03-07 3M = 0.0063656
|
||||
ICE LIBOR 2023-03-08 3M = 0.0063657
|
||||
ICE LIBOR 2023-03-09 3M = 0.0063658
|
||||
ICE LIBOR 2023-03-10 3M = 0.0063659
|
||||
ICE LIBOR 2023-06-06 3M = 0.0063660
|
||||
ICE LIBOR 2023-06-07 3M = 0.0063661
|
||||
ICE LIBOR 2023-06-08 3M = 0.0063662
|
||||
ICE LIBOR 2023-06-09 3M = 0.0063663
|
||||
ICE LIBOR 2023-06-10 3M = 0.0063664
|
||||
ICE LIBOR 2023-09-06 3M = 0.0063665
|
||||
ICE LIBOR 2023-09-07 3M = 0.0063666
|
||||
ICE LIBOR 2023-09-08 3M = 0.0063667
|
||||
ICE LIBOR 2023-09-09 3M = 0.0063668
|
||||
ICE LIBOR 2023-09-10 3M = 0.0063669
|
||||
ICE LIBOR 2023-12-06 3M = 0.0063670
|
||||
ICE LIBOR 2023-12-07 3M = 0.0063671
|
||||
ICE LIBOR 2023-12-08 3M = 0.0063672
|
||||
ICE LIBOR 2023-12-09 3M = 0.0063673
|
||||
ICE LIBOR 2023-12-10 3M = 0.0063674
|
||||
ICE LIBOR 2024-03-06 3M = 0.0063675
|
||||
ICE LIBOR 2024-03-07 3M = 0.0063676
|
||||
ICE LIBOR 2024-03-08 3M = 0.0063677
|
||||
ICE LIBOR 2024-03-09 3M = 0.0063678
|
||||
ICE LIBOR 2024-03-10 3M = 0.0063679
|
||||
ICE LIBOR 2024-06-06 3M = 0.0063680
|
||||
ICE LIBOR 2024-06-07 3M = 0.0063681
|
||||
ICE LIBOR 2024-06-08 3M = 0.0063682
|
||||
ICE LIBOR 2024-06-09 3M = 0.0063683
|
||||
ICE LIBOR 2024-06-10 3M = 0.0063684
|
||||
ICE LIBOR 2024-09-06 3M = 0.0063685
|
||||
ICE LIBOR 2024-09-07 3M = 0.0063686
|
||||
ICE LIBOR 2024-09-08 3M = 0.0063687
|
||||
ICE LIBOR 2024-09-09 3M = 0.0063688
|
||||
ICE LIBOR 2024-09-10 3M = 0.0063689
|
||||
ICE LIBOR 2024-12-06 3M = 0.0063690
|
||||
ICE LIBOR 2024-12-07 3M = 0.0063691
|
||||
ICE LIBOR 2024-12-08 3M = 0.0063692
|
||||
ICE LIBOR 2024-12-09 3M = 0.0063693
|
||||
ICE LIBOR 2024-12-10 3M = 0.0063694
|
||||
ICE LIBOR 2025-03-06 3M = 0.0063695
|
||||
ICE LIBOR 2025-03-07 3M = 0.0063696
|
||||
ICE LIBOR 2025-03-08 3M = 0.0063697
|
||||
ICE LIBOR 2025-03-09 3M = 0.0063698
|
||||
ICE LIBOR 2025-03-10 3M = 0.0063699
|
||||
ICE LIBOR 2025-06-06 3M = 0.0063700
|
||||
ICE LIBOR 2025-06-07 3M = 0.0063701
|
||||
ICE LIBOR 2025-06-08 3M = 0.0063702
|
||||
ICE LIBOR 2025-06-09 3M = 0.0063703
|
||||
ICE LIBOR 2025-06-10 3M = 0.0063704
|
||||
ICE LIBOR 2025-09-06 3M = 0.0063705
|
||||
ICE LIBOR 2025-09-07 3M = 0.0063706
|
||||
ICE LIBOR 2025-09-08 3M = 0.0063707
|
||||
ICE LIBOR 2025-09-09 3M = 0.0063708
|
||||
ICE LIBOR 2025-09-10 3M = 0.0063709
|
||||
ICE LIBOR 2025-12-06 3M = 0.0063710
|
||||
ICE LIBOR 2025-12-07 3M = 0.0063711
|
||||
ICE LIBOR 2025-12-08 3M = 0.0063712
|
||||
ICE LIBOR 2025-12-09 3M = 0.0063713
|
||||
ICE LIBOR 2025-12-10 3M = 0.0063714
|
||||
ICE LIBOR 2026-03-06 3M = 0.0063715
|
||||
ICE LIBOR 2026-03-07 3M = 0.0063716
|
||||
ICE LIBOR 2026-03-08 3M = 0.0063717
|
||||
ICE LIBOR 2026-03-09 3M = 0.0063718
|
||||
ICE LIBOR 2026-03-10 3M = 0.0063719
|
||||
ICE LIBOR 2026-06-06 3M = 0.0063720
|
||||
ICE LIBOR 2026-06-07 3M = 0.0063721
|
||||
ICE LIBOR 2026-06-08 3M = 0.0063722
|
||||
ICE LIBOR 2026-06-09 3M = 0.0063723
|
||||
ICE LIBOR 2026-06-10 3M = 0.0063724
|
||||
ICE LIBOR 2026-09-06 3M = 0.0063725
|
||||
ICE LIBOR 2026-09-07 3M = 0.0063726
|
||||
ICE LIBOR 2026-09-08 3M = 0.0063727
|
||||
ICE LIBOR 2026-09-09 3M = 0.0063728
|
||||
ICE LIBOR 2026-09-10 3M = 0.0063729
|
||||
ICE LIBOR 2026-12-06 3M = 0.0063730
|
||||
ICE LIBOR 2026-12-07 3M = 0.0063731
|
||||
ICE LIBOR 2026-12-08 3M = 0.0063732
|
||||
ICE LIBOR 2026-12-09 3M = 0.0063733
|
||||
ICE LIBOR 2026-12-10 3M = 0.0063734
|
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This needs the buyer node to be running first.
|
||||
|
||||
if [ ! -e ./gradlew ]; then
|
||||
echo "Run from the root directory please"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bin="build/install/r3prototyping/bin/get-rate-fix"
|
||||
|
||||
if [ ! -e $bin ]; then
|
||||
./gradlew installDist
|
||||
fi
|
||||
|
||||
if [ ! -e build/trader-demo/buyer/identity-public ]; then
|
||||
echo "You must run scripts/trade-demo.sh buyer before running this script (and keep it running)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Upload the rates to the buyer node
|
||||
curl -F rates=@scripts/example.rates.txt http://localhost:31338/upload/interest-rates
|
||||
|
||||
$bin --network-address=localhost:31300 --directory=build/trader-demo/rates-fix --network-map=localhost:31337 --network-map-identity-file=build/trader-demo/buyer/identity-public
|
Loading…
x
Reference in New Issue
Block a user