mirror of
https://github.com/corda/corda.git
synced 2025-02-20 17:33:15 +00:00
Rename classes
Rename LegallyIdentifiableNode to NodeInfo, to represent that legally identifiable is not a single concept. Rename NetworkMapService to NetworkMapCache, as the API exposed is suited to a local cache, not a remote service.
This commit is contained in:
parent
34940c903b
commit
345738f7de
@ -103,7 +103,7 @@ class Config(val services: ServiceHub): ContextResolver<ObjectMapper> {
|
||||
}
|
||||
val mapper = parser.codec as ServiceHubObjectMapper
|
||||
// TODO this needs to use some industry identifier(s) not just these human readable names
|
||||
val nodeForPartyName = mapper.serviceHub.networkMapService.nodeForPartyName(parser.text) ?: throw JsonParseException("Could not find a Party with name: ${parser.text}", parser.currentLocation)
|
||||
val nodeForPartyName = mapper.serviceHub.networkMapCache.nodeForPartyName(parser.text) ?: throw JsonParseException("Could not find a Party with name: ${parser.text}", parser.currentLocation)
|
||||
return nodeForPartyName.identity
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import java.util.concurrent.Executors
|
||||
* A base node implementation that can be customised either for production (with real implementations that do real
|
||||
* I/O), or a mock implementation suitable for unit test environments.
|
||||
*/
|
||||
abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration, val timestamperAddress: LegallyIdentifiableNode?, val platformClock: Clock) {
|
||||
abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration, val timestamperAddress: NodeInfo?, val platformClock: Clock) {
|
||||
companion object {
|
||||
val PRIVATE_KEY_FILE_NAME = "identity-private-key"
|
||||
val PUBLIC_IDENTITY_FILE_NAME = "identity-public"
|
||||
@ -63,7 +63,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
||||
|
||||
val services = object : ServiceHub {
|
||||
override val networkService: MessagingService get() = net
|
||||
override val networkMapService: NetworkMapService = MockNetworkMapService()
|
||||
override val networkMapCache: NetworkMapCache = MockNetworkMapCache()
|
||||
override val storageService: StorageService get() = storage
|
||||
override val walletService: WalletService get() = wallet
|
||||
override val keyManagementService: KeyManagementService get() = keyManagement
|
||||
@ -72,8 +72,8 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
||||
override val clock: Clock get() = platformClock
|
||||
}
|
||||
|
||||
val legallyIdentifiableAddress: LegallyIdentifiableNode by lazy {
|
||||
LegallyIdentifiableNode(net.myAddress, storage.myLegalIdentity, findMyLocation())
|
||||
val info: NodeInfo by lazy {
|
||||
NodeInfo(net.myAddress, storage.myLegalIdentity, findMyLocation())
|
||||
}
|
||||
|
||||
protected open fun findMyLocation(): PhysicalLocation? = CityDatabase[configuration.nearestCity]
|
||||
@ -122,9 +122,9 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
||||
timestamperAddress
|
||||
} else {
|
||||
inNodeTimestampingService = NodeTimestamperService(net, storage.myLegalIdentity, storage.myLegalIdentityKey, platformClock)
|
||||
LegallyIdentifiableNode(net.myAddress, storage.myLegalIdentity)
|
||||
NodeInfo(net.myAddress, storage.myLegalIdentity)
|
||||
}
|
||||
(services.networkMapService as MockNetworkMapService).timestampingNodes.add(tsid)
|
||||
(services.networkMapCache as MockNetworkMapCache).timestampingNodes.add(tsid)
|
||||
|
||||
identity = makeIdentityService()
|
||||
|
||||
|
@ -15,7 +15,7 @@ import com.codahale.metrics.JmxReporter
|
||||
import com.google.common.net.HostAndPort
|
||||
import core.messaging.MessagingService
|
||||
import core.node.services.ArtemisMessagingService
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.servlets.AttachmentDownloadServlet
|
||||
import core.node.servlets.DataUploadServlet
|
||||
import core.utilities.loggerFor
|
||||
@ -52,7 +52,7 @@ class ConfigurationException(message: String) : Exception(message)
|
||||
* @param clock The clock used within the node and by all protocols etc
|
||||
*/
|
||||
class Node(dir: Path, val p2pAddr: HostAndPort, configuration: NodeConfiguration,
|
||||
timestamperAddress: LegallyIdentifiableNode?,
|
||||
timestamperAddress: NodeInfo?,
|
||||
clock: Clock = Clock.systemUTC()) : AbstractNode(dir, configuration, timestamperAddress, clock) {
|
||||
companion object {
|
||||
/** The port that is used by default if none is specified. As you know, 31337 is the most elite number. */
|
||||
|
@ -13,9 +13,11 @@ import core.crypto.DummyPublicKey
|
||||
import core.messaging.SingleMessageRecipient
|
||||
import java.util.*
|
||||
|
||||
/** Info about a network node that has operated by some sort of verified identity. */
|
||||
data class LegallyIdentifiableNode(val address: SingleMessageRecipient, val identity: Party,
|
||||
val physicalLocation: PhysicalLocation? = null)
|
||||
/**
|
||||
* Info about a network node that acts on behalf of some sort of verified identity.
|
||||
*/
|
||||
data class NodeInfo(val address: SingleMessageRecipient, val identity: Party,
|
||||
val physicalLocation: PhysicalLocation? = null)
|
||||
|
||||
/**
|
||||
* A network map contains lists of nodes on the network along with information about their identity keys, services
|
||||
@ -26,25 +28,25 @@ data class LegallyIdentifiableNode(val address: SingleMessageRecipient, val iden
|
||||
*
|
||||
* This interface assumes fast, synchronous access to an in-memory map.
|
||||
*/
|
||||
interface NetworkMapService {
|
||||
val timestampingNodes: List<LegallyIdentifiableNode>
|
||||
val ratesOracleNodes: List<LegallyIdentifiableNode>
|
||||
val partyNodes: List<LegallyIdentifiableNode>
|
||||
interface NetworkMapCache {
|
||||
val timestampingNodes: List<NodeInfo>
|
||||
val ratesOracleNodes: List<NodeInfo>
|
||||
val partyNodes: List<NodeInfo>
|
||||
|
||||
fun nodeForPartyName(name: String): LegallyIdentifiableNode? = partyNodes.singleOrNull { it.identity.name == name }
|
||||
fun nodeForPartyName(name: String): NodeInfo? = partyNodes.singleOrNull { it.identity.name == name }
|
||||
}
|
||||
|
||||
// TODO: Move this to the test tree once a real network map is implemented and this scaffolding is no longer needed.
|
||||
class MockNetworkMapService : NetworkMapService {
|
||||
class MockNetworkMapCache : NetworkMapCache {
|
||||
data class MockAddress(val id: String): SingleMessageRecipient
|
||||
|
||||
override val timestampingNodes = Collections.synchronizedList(ArrayList<LegallyIdentifiableNode>())
|
||||
override val ratesOracleNodes = Collections.synchronizedList(ArrayList<LegallyIdentifiableNode>())
|
||||
override val partyNodes = Collections.synchronizedList(ArrayList<LegallyIdentifiableNode>())
|
||||
override val timestampingNodes = Collections.synchronizedList(ArrayList<NodeInfo>())
|
||||
override val ratesOracleNodes = Collections.synchronizedList(ArrayList<NodeInfo>())
|
||||
override val partyNodes = Collections.synchronizedList(ArrayList<NodeInfo>())
|
||||
|
||||
init {
|
||||
partyNodes.add(LegallyIdentifiableNode(MockAddress("bankC:8080"), Party("Bank C", DummyPublicKey("Bank C"))))
|
||||
partyNodes.add(LegallyIdentifiableNode(MockAddress("bankD:8080"), Party("Bank D", DummyPublicKey("Bank D"))))
|
||||
partyNodes.add(NodeInfo(MockAddress("bankC:8080"), Party("Bank C", DummyPublicKey("Bank C"))))
|
||||
partyNodes.add(NodeInfo(MockAddress("bankD:8080"), Party("Bank D", DummyPublicKey("Bank D"))))
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ interface ServiceHub {
|
||||
val identityService: IdentityService
|
||||
val storageService: StorageService
|
||||
val networkService: MessagingService
|
||||
val networkMapService: NetworkMapService
|
||||
val networkMapCache: NetworkMapCache
|
||||
val monitoringService: MonitoringService
|
||||
val clock: Clock
|
||||
|
||||
|
@ -15,7 +15,7 @@ import core.ThreadBox
|
||||
import core.crypto.sha256
|
||||
import core.messaging.*
|
||||
import core.node.services.DummyTimestampingAuthority
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.NodeTimestamperService
|
||||
import core.utilities.loggerFor
|
||||
import rx.Observable
|
||||
@ -150,15 +150,15 @@ class InMemoryMessagingNetwork {
|
||||
override fun hashCode() = id.hashCode()
|
||||
}
|
||||
|
||||
private var timestampingAdvert: LegallyIdentifiableNode? = null
|
||||
private var timestampingAdvert: NodeInfo? = null
|
||||
|
||||
@Synchronized
|
||||
fun setupTimestampingNode(manuallyPumped: Boolean): Pair<LegallyIdentifiableNode, InMemoryMessaging> {
|
||||
fun setupTimestampingNode(manuallyPumped: Boolean): Pair<NodeInfo, InMemoryMessaging> {
|
||||
check(timestampingAdvert == null)
|
||||
val (handle, builder) = createNode(manuallyPumped)
|
||||
val node = builder.start().get()
|
||||
NodeTimestamperService(node, DummyTimestampingAuthority.identity, DummyTimestampingAuthority.key)
|
||||
timestampingAdvert = LegallyIdentifiableNode(handle, DummyTimestampingAuthority.identity)
|
||||
timestampingAdvert = NodeInfo(handle, DummyTimestampingAuthority.identity)
|
||||
return Pair(timestampingAdvert!!, node)
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ import core.messaging.SingleMessageRecipient
|
||||
import core.node.AbstractNode
|
||||
import core.node.NodeConfiguration
|
||||
import core.node.services.FixedIdentityService
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.PhysicalLocation
|
||||
import core.utilities.loggerFor
|
||||
import org.slf4j.Logger
|
||||
@ -54,18 +54,18 @@ class MockNetwork(private val threadPerNode: Boolean = false,
|
||||
/** Allows customisation of how nodes are created. */
|
||||
interface Factory {
|
||||
fun create(dir: Path, config: NodeConfiguration, network: MockNetwork,
|
||||
timestamperAddr: LegallyIdentifiableNode?): MockNode
|
||||
timestamperAddr: NodeInfo?): MockNode
|
||||
}
|
||||
|
||||
object DefaultFactory : Factory {
|
||||
override fun create(dir: Path, config: NodeConfiguration, network: MockNetwork,
|
||||
timestamperAddr: LegallyIdentifiableNode?): MockNode {
|
||||
timestamperAddr: NodeInfo?): MockNode {
|
||||
return MockNode(dir, config, network, timestamperAddr)
|
||||
}
|
||||
}
|
||||
|
||||
open class MockNode(dir: Path, config: NodeConfiguration, val mockNet: MockNetwork,
|
||||
withTimestamper: LegallyIdentifiableNode?, val forcedID: Int = -1) : AbstractNode(dir, config, withTimestamper, Clock.systemUTC()) {
|
||||
withTimestamper: NodeInfo?, val forcedID: Int = -1) : AbstractNode(dir, config, withTimestamper, Clock.systemUTC()) {
|
||||
override val log: Logger = loggerFor<MockNode>()
|
||||
override val serverThread: ExecutorService =
|
||||
if (mockNet.threadPerNode)
|
||||
@ -96,7 +96,7 @@ class MockNetwork(private val threadPerNode: Boolean = false,
|
||||
}
|
||||
|
||||
/** Returns a started node, optionally created by the passed factory method */
|
||||
fun createNode(withTimestamper: LegallyIdentifiableNode?, forcedID: Int = -1, nodeFactory: Factory = defaultFactory): MockNode {
|
||||
fun createNode(withTimestamper: NodeInfo?, forcedID: Int = -1, nodeFactory: Factory = defaultFactory): MockNode {
|
||||
val newNode = forcedID == -1
|
||||
val id = if (newNode) counter++ else forcedID
|
||||
|
||||
@ -132,7 +132,7 @@ class MockNetwork(private val threadPerNode: Boolean = false,
|
||||
*/
|
||||
fun createTwoNodes(nodeFactory: Factory = defaultFactory): Pair<MockNode, MockNode> {
|
||||
require(nodes.isEmpty())
|
||||
return Pair(createNode(null, -1, nodeFactory), createNode(nodes[0].legallyIdentifiableAddress, -1, nodeFactory))
|
||||
return Pair(createNode(null, -1, nodeFactory), createNode(nodes[0].info, -1, nodeFactory))
|
||||
}
|
||||
|
||||
fun addressToNode(address: SingleMessageRecipient): MockNode = nodes.single { it.net.myAddress == address }
|
||||
|
@ -16,8 +16,8 @@ import core.node.Node
|
||||
import core.node.NodeConfiguration
|
||||
import core.node.NodeConfigurationFromConfig
|
||||
import core.node.services.ArtemisMessagingService
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.MockNetworkMapService
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.MockNetworkMapCache
|
||||
import core.serialization.deserialize
|
||||
import core.utilities.BriefLogFormatter
|
||||
import joptsimple.OptionParser
|
||||
@ -79,7 +79,7 @@ fun main(args: Array<String>) {
|
||||
null
|
||||
} else {
|
||||
try {
|
||||
legallyIdentifiableNode(options.valueOf(timestamperNetAddr), options.valueOf(timestamperIdentityFile))
|
||||
nodeInfo(options.valueOf(timestamperNetAddr), options.valueOf(timestamperIdentityFile))
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
@ -90,7 +90,7 @@ fun main(args: Array<String>) {
|
||||
null
|
||||
} else {
|
||||
try {
|
||||
legallyIdentifiableNode(options.valueOf(rateOracleNetAddr), options.valueOf(rateOracleIdentityFile))
|
||||
nodeInfo(options.valueOf(rateOracleNetAddr), options.valueOf(rateOracleIdentityFile))
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
@ -99,10 +99,10 @@ fun main(args: Array<String>) {
|
||||
val node = logElapsedTime("Node startup") { Node(dir, myNetAddr, config, timestamperId, DemoClock()).start() }
|
||||
|
||||
// Add self to network map
|
||||
(node.services.networkMapService as MockNetworkMapService).partyNodes.add(node.legallyIdentifiableAddress)
|
||||
(node.services.networkMapCache as MockNetworkMapCache).partyNodes.add(node.info)
|
||||
|
||||
// Add rates oracle to network map
|
||||
(node.services.networkMapService as MockNetworkMapService).ratesOracleNodes.add(rateOracleId)
|
||||
(node.services.networkMapCache as MockNetworkMapCache).ratesOracleNodes.add(rateOracleId)
|
||||
|
||||
val hostAndPortStrings = options.valuesOf(fakeTradeWithAddr)
|
||||
val identityFiles = options.valuesOf(fakeTradeWithIdentityFile)
|
||||
@ -111,8 +111,8 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
for ((hostAndPortString,identityFile) in hostAndPortStrings.zip(identityFiles)) {
|
||||
try {
|
||||
val peerId = legallyIdentifiableNode(hostAndPortString, identityFile)
|
||||
(node.services.networkMapService as MockNetworkMapService).partyNodes.add(peerId)
|
||||
val peerId = nodeInfo(hostAndPortString, identityFile)
|
||||
(node.services.networkMapCache as MockNetworkMapCache).partyNodes.add(peerId)
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
@ -128,12 +128,12 @@ fun main(args: Array<String>) {
|
||||
exitProcess(0)
|
||||
}
|
||||
|
||||
fun legallyIdentifiableNode(hostAndPortString: String, identityFile: String): LegallyIdentifiableNode {
|
||||
fun nodeInfo(hostAndPortString: String, identityFile: String): NodeInfo {
|
||||
try {
|
||||
val addr = HostAndPort.fromString(hostAndPortString).withDefaultPort(Node.DEFAULT_PORT)
|
||||
val path = Paths.get(identityFile)
|
||||
val party = Files.readAllBytes(path).deserialize<Party>(includeClassName = true)
|
||||
return LegallyIdentifiableNode(ArtemisMessagingService.makeRecipient(addr), party)
|
||||
return NodeInfo(ArtemisMessagingService.makeRecipient(addr), party)
|
||||
} catch (e: Exception) {
|
||||
println("Could not find identify file $identityFile. If the file has just been created as part of starting the demo, please restart this node")
|
||||
throw e
|
||||
|
@ -13,7 +13,7 @@ import core.*
|
||||
import core.node.Node
|
||||
import core.node.NodeConfiguration
|
||||
import core.node.services.ArtemisMessagingService
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.NodeInterestRates
|
||||
import core.serialization.deserialize
|
||||
import core.utilities.ANSIProgressRenderer
|
||||
@ -60,7 +60,7 @@ fun main(args: Array<String>) {
|
||||
// Load oracle stuff (in lieu of having a network map service)
|
||||
val oracleAddr = ArtemisMessagingService.makeRecipient(options.valueOf(oracleAddrArg))
|
||||
val oracleIdentity = Files.readAllBytes(Paths.get(options.valueOf(oracleIdentityArg))).deserialize<Party>(includeClassName = true)
|
||||
val oracleNode = LegallyIdentifiableNode(oracleAddr, oracleIdentity)
|
||||
val oracleNode = NodeInfo(oracleAddr, oracleIdentity)
|
||||
|
||||
val fixOf: FixOf = NodeInterestRates.parseFixOf(options.valueOf(fixOfArg))
|
||||
val expectedRate = BigDecimal(options.valueOf(expectedRateArg))
|
||||
|
@ -20,7 +20,7 @@ import core.node.Node
|
||||
import core.node.NodeConfiguration
|
||||
import core.node.NodeConfigurationFromConfig
|
||||
import core.node.services.ArtemisMessagingService
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.NodeAttachmentService
|
||||
import core.node.services.NodeWalletService
|
||||
import core.protocols.ProtocolLogic
|
||||
@ -95,7 +95,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)
|
||||
LegallyIdentifiableNode(ArtemisMessagingService.makeRecipient(addr), party)
|
||||
NodeInfo(ArtemisMessagingService.makeRecipient(addr), party)
|
||||
} else null
|
||||
|
||||
val node = logElapsedTime("Node startup") { Node(dir, myNetAddr, config, timestamperId).start() }
|
||||
@ -163,7 +163,7 @@ class TraderDemoProtocolBuyer(private val attachmentsPath: Path) : ProtocolLogic
|
||||
progressTracker.currentStep = STARTING_BUY
|
||||
send("test.junktrade", newPartnerAddr, 0, sessionID)
|
||||
|
||||
val tsa = serviceHub.networkMapService.timestampingNodes[0]
|
||||
val tsa = serviceHub.networkMapCache.timestampingNodes[0]
|
||||
val buyer = TwoPartyTradeProtocol.Buyer(newPartnerAddr, tsa.identity, 1000.DOLLARS,
|
||||
CommercialPaper.State::class.java, sessionID)
|
||||
val tradeTX: SignedTransaction = subProtocol(buyer)
|
||||
@ -222,7 +222,7 @@ class TraderDemoProtocolSeller(val myAddress: HostAndPort,
|
||||
|
||||
progressTracker.currentStep = SELF_ISSUING
|
||||
|
||||
val tsa = serviceHub.networkMapService.timestampingNodes[0]
|
||||
val tsa = serviceHub.networkMapCache.timestampingNodes[0]
|
||||
val cpOwnerKey = serviceHub.keyManagementService.freshKey()
|
||||
val commercialPaper = selfIssueSomeCommercialPaper(cpOwnerKey.public, tsa)
|
||||
|
||||
@ -236,7 +236,7 @@ class TraderDemoProtocolSeller(val myAddress: HostAndPort,
|
||||
}
|
||||
|
||||
@Suspendable
|
||||
fun selfIssueSomeCommercialPaper(ownedBy: PublicKey, tsa: LegallyIdentifiableNode): StateAndRef<CommercialPaper.State> {
|
||||
fun selfIssueSomeCommercialPaper(ownedBy: PublicKey, tsa: NodeInfo): StateAndRef<CommercialPaper.State> {
|
||||
// Make a fake company that's issued its own paper.
|
||||
val keyPair = generateKeyPair()
|
||||
val party = Party("Bank of London", keyPair.public)
|
||||
|
@ -95,10 +95,10 @@ object AutoOfferProtocol {
|
||||
override fun call(): SignedTransaction {
|
||||
val ourSessionID = random63BitValue()
|
||||
|
||||
val timestampingAuthority = serviceHub.networkMapService.timestampingNodes[0]
|
||||
val timestampingAuthority = serviceHub.networkMapCache.timestampingNodes[0]
|
||||
// need to pick which ever party is not us
|
||||
val otherParty = notUs(*dealToBeOffered.parties).single()
|
||||
val otherSide = (serviceHub.networkMapService.nodeForPartyName(otherParty.name))!!.address
|
||||
val otherSide = (serviceHub.networkMapCache.nodeForPartyName(otherParty.name))!!.address
|
||||
progressTracker.currentStep = ANNOUNCING
|
||||
send(TOPIC, otherSide, 0, AutoOfferMessage(serviceHub.networkService.myAddress, ourSessionID, dealToBeOffered))
|
||||
progressTracker.currentStep = DEALING
|
||||
|
@ -3,8 +3,8 @@ package demos.protocols
|
||||
import co.paralleluniverse.fibers.Suspendable
|
||||
import co.paralleluniverse.strands.Strand
|
||||
import core.node.Node
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.MockNetworkMapService
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.MockNetworkMapCache
|
||||
import core.protocols.ProtocolLogic
|
||||
import core.serialization.deserialize
|
||||
import java.util.concurrent.TimeUnit
|
||||
@ -45,7 +45,7 @@ object ExitServerProtocol {
|
||||
val rc = exitCode.toInt()
|
||||
val message = ExitMessage(rc)
|
||||
|
||||
for (recipient in serviceHub.networkMapService.partyNodes) {
|
||||
for (recipient in serviceHub.networkMapCache.partyNodes) {
|
||||
doNextRecipient(recipient, message)
|
||||
}
|
||||
// Sleep a little in case any async message delivery to other nodes needs to happen
|
||||
@ -56,8 +56,8 @@ object ExitServerProtocol {
|
||||
}
|
||||
|
||||
@Suspendable
|
||||
private fun doNextRecipient(recipient: LegallyIdentifiableNode, message: ExitMessage) {
|
||||
if(recipient.address is MockNetworkMapService.MockAddress) {
|
||||
private fun doNextRecipient(recipient: NodeInfo, message: ExitMessage) {
|
||||
if(recipient.address is MockNetworkMapCache.MockAddress) {
|
||||
// Ignore
|
||||
} else {
|
||||
// TODO: messaging ourselves seems to trigger a bug for the time being and we continuously receive messages
|
||||
|
@ -6,8 +6,8 @@ import contracts.DealState
|
||||
import contracts.InterestRateSwap
|
||||
import core.StateAndRef
|
||||
import core.node.Node
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.MockNetworkMapService
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.MockNetworkMapCache
|
||||
import core.protocols.ProtocolLogic
|
||||
import core.random63BitValue
|
||||
import core.serialization.deserialize
|
||||
@ -57,14 +57,14 @@ object UpdateBusinessDayProtocol {
|
||||
}
|
||||
|
||||
// This assumes we definitely have one key or the other
|
||||
fun otherParty(deal: DealState): LegallyIdentifiableNode {
|
||||
fun otherParty(deal: DealState): NodeInfo {
|
||||
val ourKeys = serviceHub.keyManagementService.keys.keys
|
||||
return serviceHub.networkMapService.nodeForPartyName(deal.parties.single { !ourKeys.contains(it.owningKey) }.name)!!
|
||||
return serviceHub.networkMapCache.nodeForPartyName(deal.parties.single { !ourKeys.contains(it.owningKey) }.name)!!
|
||||
}
|
||||
|
||||
// TODO we should make this more object oriented when we can ask a state for it's contract
|
||||
@Suspendable
|
||||
fun processDeal(party: LegallyIdentifiableNode, deal: StateAndRef<DealState>, date: LocalDate, sessionID: Long) {
|
||||
fun processDeal(party: NodeInfo, deal: StateAndRef<DealState>, date: LocalDate, sessionID: Long) {
|
||||
when(deal.state) {
|
||||
is InterestRateSwap.State -> processInterestRateSwap(party, StateAndRef(deal.state as InterestRateSwap.State, deal.ref), date, sessionID)
|
||||
}
|
||||
@ -72,7 +72,7 @@ object UpdateBusinessDayProtocol {
|
||||
|
||||
// TODO and this would move to the InterestRateSwap and cope with permutations of Fixed/Floating and Floating/Floating etc
|
||||
@Suspendable
|
||||
fun processInterestRateSwap(party: LegallyIdentifiableNode, deal: StateAndRef<InterestRateSwap.State>, date: LocalDate, sessionID: Long) {
|
||||
fun processInterestRateSwap(party: NodeInfo, deal: StateAndRef<InterestRateSwap.State>, date: LocalDate, sessionID: Long) {
|
||||
var dealStateAndRef: StateAndRef<InterestRateSwap.State>? = deal
|
||||
var nextFixingDate = deal.state.calculation.nextFixingDate()
|
||||
while (nextFixingDate != null && !nextFixingDate.isAfter(date)) {
|
||||
@ -93,22 +93,22 @@ object UpdateBusinessDayProtocol {
|
||||
}
|
||||
|
||||
@Suspendable
|
||||
private fun nextFixingFloatingLeg(dealStateAndRef: StateAndRef<InterestRateSwap.State>, party: LegallyIdentifiableNode, sessionID: Long): StateAndRef<InterestRateSwap.State>? {
|
||||
private fun nextFixingFloatingLeg(dealStateAndRef: StateAndRef<InterestRateSwap.State>, party: NodeInfo, sessionID: Long): StateAndRef<InterestRateSwap.State>? {
|
||||
progressTracker.childrenFor[FIXING] = TwoPartyDealProtocol.Primary.tracker()
|
||||
progressTracker.currentStep = FIXING
|
||||
|
||||
val participant = TwoPartyDealProtocol.Floater(party.address, sessionID, serviceHub.networkMapService.timestampingNodes[0], dealStateAndRef, serviceHub.keyManagementService.freshKey(), sessionID, progressTracker.childrenFor[FIXING]!!)
|
||||
val participant = TwoPartyDealProtocol.Floater(party.address, sessionID, serviceHub.networkMapCache.timestampingNodes[0], dealStateAndRef, serviceHub.keyManagementService.freshKey(), sessionID, progressTracker.childrenFor[FIXING]!!)
|
||||
Strand.sleep(100)
|
||||
val result = subProtocol(participant)
|
||||
return result.tx.outRef(0)
|
||||
}
|
||||
|
||||
@Suspendable
|
||||
private fun nextFixingFixedLeg(dealStateAndRef: StateAndRef<InterestRateSwap.State>, party: LegallyIdentifiableNode, sessionID: Long): StateAndRef<InterestRateSwap.State>? {
|
||||
private fun nextFixingFixedLeg(dealStateAndRef: StateAndRef<InterestRateSwap.State>, party: NodeInfo, sessionID: Long): StateAndRef<InterestRateSwap.State>? {
|
||||
progressTracker.childrenFor[FIXING] = TwoPartyDealProtocol.Secondary.tracker()
|
||||
progressTracker.currentStep = FIXING
|
||||
|
||||
val participant = TwoPartyDealProtocol.Fixer(party.address, serviceHub.networkMapService.timestampingNodes[0].identity, dealStateAndRef, sessionID, progressTracker.childrenFor[FIXING]!!)
|
||||
val participant = TwoPartyDealProtocol.Fixer(party.address, serviceHub.networkMapCache.timestampingNodes[0].identity, dealStateAndRef, sessionID, progressTracker.childrenFor[FIXING]!!)
|
||||
val result = subProtocol(participant)
|
||||
return result.tx.outRef(0)
|
||||
}
|
||||
@ -147,7 +147,7 @@ object UpdateBusinessDayProtocol {
|
||||
override fun call(): Boolean {
|
||||
val message = UpdateBusinessDayMessage(date, random63BitValue())
|
||||
|
||||
for (recipient in serviceHub.networkMapService.partyNodes) {
|
||||
for (recipient in serviceHub.networkMapCache.partyNodes) {
|
||||
progressTracker.currentStep = NOTIFYING
|
||||
doNextRecipient(recipient, message)
|
||||
}
|
||||
@ -159,8 +159,8 @@ object UpdateBusinessDayProtocol {
|
||||
}
|
||||
|
||||
@Suspendable
|
||||
private fun doNextRecipient(recipient: LegallyIdentifiableNode, message: UpdateBusinessDayMessage) {
|
||||
if(recipient.address is MockNetworkMapService.MockAddress) {
|
||||
private fun doNextRecipient(recipient: NodeInfo, message: UpdateBusinessDayMessage) {
|
||||
if(recipient.address is MockNetworkMapCache.MockAddress) {
|
||||
// Ignore
|
||||
} else {
|
||||
// TODO: messaging ourselves seems to trigger a bug for the time being and we continuously receive messages
|
||||
|
@ -12,7 +12,7 @@ import co.paralleluniverse.fibers.Suspendable
|
||||
import core.*
|
||||
import core.crypto.DigitalSignature
|
||||
import core.messaging.SingleMessageRecipient
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.protocols.ProtocolLogic
|
||||
import core.utilities.ProgressTracker
|
||||
import java.math.BigDecimal
|
||||
@ -29,7 +29,7 @@ import java.util.*
|
||||
* @throws FixOutOfRange if the returned fix was further away from the expected rate by the given amount.
|
||||
*/
|
||||
open class RatesFixProtocol(protected val tx: TransactionBuilder,
|
||||
private val oracle: LegallyIdentifiableNode,
|
||||
private val oracle: NodeInfo,
|
||||
private val fixOf: FixOf,
|
||||
private val expectedRate: BigDecimal,
|
||||
private val rateTolerance: BigDecimal) : ProtocolLogic<Unit>() {
|
||||
|
@ -14,7 +14,7 @@ import core.WireTransaction
|
||||
import core.crypto.DigitalSignature
|
||||
import core.messaging.MessageRecipients
|
||||
import core.messaging.StateMachineManager
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.NodeTimestamperService
|
||||
import core.node.services.TimestamperService
|
||||
import core.protocols.ProtocolLogic
|
||||
@ -31,11 +31,11 @@ import core.utilities.ProgressTracker
|
||||
* the built transaction. Please be aware that this will block, meaning it should not be used on a thread that is handling
|
||||
* a network message: use it only from spare application threads that don't have to respond to anything.
|
||||
*/
|
||||
class TimestampingProtocol(private val node: LegallyIdentifiableNode,
|
||||
class TimestampingProtocol(private val node: NodeInfo,
|
||||
private val wtxBytes: SerializedBytes<WireTransaction>,
|
||||
override val progressTracker: ProgressTracker = TimestampingProtocol.tracker()) : ProtocolLogic<DigitalSignature.LegallyIdentifiable>() {
|
||||
|
||||
class Client(private val stateMachineManager: StateMachineManager, private val node: LegallyIdentifiableNode) : TimestamperService {
|
||||
class Client(private val stateMachineManager: StateMachineManager, private val node: NodeInfo) : TimestamperService {
|
||||
override val identity: Party = node.identity
|
||||
|
||||
override fun timestamp(wtxBytes: SerializedBytes<WireTransaction>): DigitalSignature.LegallyIdentifiable {
|
||||
|
@ -15,7 +15,7 @@ import core.*
|
||||
import core.crypto.DigitalSignature
|
||||
import core.crypto.signWithECDSA
|
||||
import core.messaging.SingleMessageRecipient
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.protocols.ProtocolLogic
|
||||
import core.utilities.ProgressTracker
|
||||
import core.utilities.UntrustworthyData
|
||||
@ -63,7 +63,7 @@ object TwoPartyDealProtocol {
|
||||
val otherSide: SingleMessageRecipient,
|
||||
val otherSessionID: Long,
|
||||
val myKeyPair: KeyPair,
|
||||
val timestampingAuthority: LegallyIdentifiableNode,
|
||||
val timestampingAuthority: NodeInfo,
|
||||
override val progressTracker: ProgressTracker = Primary.tracker()) : ProtocolLogic<SignedTransaction>() {
|
||||
|
||||
companion object {
|
||||
@ -263,7 +263,7 @@ object TwoPartyDealProtocol {
|
||||
* One side of the protocol for inserting a pre-agreed deal.
|
||||
*/
|
||||
open class Instigator<T : DealState>(otherSide: SingleMessageRecipient,
|
||||
timestampingAuthority: LegallyIdentifiableNode,
|
||||
timestampingAuthority: NodeInfo,
|
||||
dealBeingOffered: T,
|
||||
myKeyPair: KeyPair,
|
||||
buyerSessionID: Long,
|
||||
@ -360,7 +360,7 @@ object TwoPartyDealProtocol {
|
||||
val oldRef = dealToFix.ref
|
||||
|
||||
val ptx = TransactionBuilder()
|
||||
val addFixing = object : RatesFixProtocol(ptx, serviceHub.networkMapService.ratesOracleNodes[0], fixOf, BigDecimal.ZERO, BigDecimal.ONE) {
|
||||
val addFixing = object : RatesFixProtocol(ptx, serviceHub.networkMapCache.ratesOracleNodes[0], fixOf, BigDecimal.ZERO, BigDecimal.ONE) {
|
||||
|
||||
@Suspendable
|
||||
override fun beforeSigning(fix: Fix) {
|
||||
@ -387,7 +387,7 @@ object TwoPartyDealProtocol {
|
||||
*/
|
||||
open class Floater<T : FixableDealState>(otherSide: SingleMessageRecipient,
|
||||
otherSessionID: Long,
|
||||
timestampingAuthority: LegallyIdentifiableNode,
|
||||
timestampingAuthority: NodeInfo,
|
||||
dealToFix: StateAndRef<T>,
|
||||
myKeyPair: KeyPair,
|
||||
val sessionID: Long,
|
||||
|
@ -17,7 +17,7 @@ import core.crypto.DigitalSignature
|
||||
import core.crypto.signWithECDSA
|
||||
import core.messaging.SingleMessageRecipient
|
||||
import core.messaging.StateMachineManager
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.protocols.ProtocolLogic
|
||||
import core.utilities.ProgressTracker
|
||||
import core.utilities.trace
|
||||
@ -52,14 +52,14 @@ import java.time.Instant
|
||||
object TwoPartyTradeProtocol {
|
||||
val TRADE_TOPIC = "platform.trade"
|
||||
|
||||
fun runSeller(smm: StateMachineManager, timestampingAuthority: LegallyIdentifiableNode,
|
||||
fun runSeller(smm: StateMachineManager, timestampingAuthority: NodeInfo,
|
||||
otherSide: SingleMessageRecipient, assetToSell: StateAndRef<OwnableState>, price: Amount,
|
||||
myKeyPair: KeyPair, buyerSessionID: Long): ListenableFuture<SignedTransaction> {
|
||||
val seller = Seller(otherSide, timestampingAuthority, assetToSell, price, myKeyPair, buyerSessionID)
|
||||
return smm.add("${TRADE_TOPIC}.seller", seller)
|
||||
}
|
||||
|
||||
fun runBuyer(smm: StateMachineManager, timestampingAuthority: LegallyIdentifiableNode,
|
||||
fun runBuyer(smm: StateMachineManager, timestampingAuthority: NodeInfo,
|
||||
otherSide: SingleMessageRecipient, acceptablePrice: Amount, typeToBuy: Class<out OwnableState>,
|
||||
sessionID: Long): ListenableFuture<SignedTransaction> {
|
||||
val buyer = Buyer(otherSide, timestampingAuthority.identity, acceptablePrice, typeToBuy, sessionID)
|
||||
@ -82,7 +82,7 @@ object TwoPartyTradeProtocol {
|
||||
class SignaturesFromSeller(val timestampAuthoritySig: DigitalSignature.WithKey, val sellerSig: DigitalSignature.WithKey)
|
||||
|
||||
open class Seller(val otherSide: SingleMessageRecipient,
|
||||
val timestampingAuthority: LegallyIdentifiableNode,
|
||||
val timestampingAuthority: NodeInfo,
|
||||
val assetToSell: StateAndRef<OwnableState>,
|
||||
val price: Amount,
|
||||
val myKeyPair: KeyPair,
|
||||
|
@ -129,7 +129,7 @@ class MockServices(
|
||||
val net: MessagingService? = null,
|
||||
val identity: IdentityService? = MockIdentityService,
|
||||
val storage: StorageService? = MockStorageService(),
|
||||
val networkMap: NetworkMapService? = MockNetworkMapService(),
|
||||
val networkMap: NetworkMapCache? = MockNetworkMapCache(),
|
||||
val overrideClock: Clock? = Clock.systemUTC()
|
||||
) : ServiceHub {
|
||||
override val walletService: WalletService
|
||||
@ -140,7 +140,7 @@ class MockServices(
|
||||
get() = identity ?: throw UnsupportedOperationException()
|
||||
override val networkService: MessagingService
|
||||
get() = net ?: throw UnsupportedOperationException()
|
||||
override val networkMapService: NetworkMapService
|
||||
override val networkMapCache: NetworkMapCache
|
||||
get() = networkMap ?: throw UnsupportedOperationException()
|
||||
override val storageService: StorageService
|
||||
get() = storage ?: throw UnsupportedOperationException()
|
||||
|
@ -12,7 +12,7 @@ import core.Attachment
|
||||
import core.crypto.SecureHash
|
||||
import core.crypto.sha256
|
||||
import core.node.NodeConfiguration
|
||||
import core.node.services.LegallyIdentifiableNode
|
||||
import core.node.services.NodeInfo
|
||||
import core.node.services.NodeAttachmentService
|
||||
import core.serialization.OpaqueBytes
|
||||
import core.testing.MockNetwork
|
||||
@ -94,7 +94,7 @@ class AttachmentTests {
|
||||
fun maliciousResponse() {
|
||||
// Make a node that doesn't do sanity checking at load time.
|
||||
val n0 = network.createNode(null, nodeFactory = object : MockNetwork.Factory {
|
||||
override fun create(dir: Path, config: NodeConfiguration, network: MockNetwork, timestamperAddr: LegallyIdentifiableNode?): MockNetwork.MockNode {
|
||||
override fun create(dir: Path, config: NodeConfiguration, network: MockNetwork, timestamperAddr: NodeInfo?): MockNetwork.MockNode {
|
||||
return object : MockNetwork.MockNode(dir, config, network, timestamperAddr) {
|
||||
override fun start(): MockNetwork.MockNode {
|
||||
super.start()
|
||||
@ -104,7 +104,7 @@ class AttachmentTests {
|
||||
}
|
||||
}
|
||||
})
|
||||
val n1 = network.createNode(n0.legallyIdentifiableAddress)
|
||||
val n1 = network.createNode(n0.info)
|
||||
|
||||
// Insert an attachment into node zero's store directly.
|
||||
val id = n0.storage.attachments.importAttachment(ByteArrayInputStream(fakeAttachment()))
|
||||
|
@ -66,7 +66,7 @@ class TwoPartyTradeProtocolTests : TestWithInMemoryNetwork() {
|
||||
transactionGroupFor<ContractState> {
|
||||
val (aliceNode, bobNode) = net.createTwoNodes()
|
||||
(bobNode.wallet as NodeWalletService).fillWithSomeTestCash(2000.DOLLARS)
|
||||
val alicesFakePaper = fillUpForSeller(false, aliceNode.legallyIdentifiableAddress.identity, null).second
|
||||
val alicesFakePaper = fillUpForSeller(false, aliceNode.info.identity, null).second
|
||||
|
||||
insertFakeTransactions(alicesFakePaper, aliceNode.services, aliceNode.storage.myLegalIdentityKey)
|
||||
|
||||
@ -74,7 +74,7 @@ class TwoPartyTradeProtocolTests : TestWithInMemoryNetwork() {
|
||||
|
||||
val aliceResult = TwoPartyTradeProtocol.runSeller(
|
||||
aliceNode.smm,
|
||||
aliceNode.legallyIdentifiableAddress,
|
||||
aliceNode.info,
|
||||
bobNode.net.myAddress,
|
||||
lookup("alice's paper"),
|
||||
1000.DOLLARS,
|
||||
@ -83,7 +83,7 @@ class TwoPartyTradeProtocolTests : TestWithInMemoryNetwork() {
|
||||
)
|
||||
val bobResult = TwoPartyTradeProtocol.runBuyer(
|
||||
bobNode.smm,
|
||||
aliceNode.legallyIdentifiableAddress,
|
||||
aliceNode.info,
|
||||
aliceNode.net.myAddress,
|
||||
1000.DOLLARS,
|
||||
CommercialPaper.State::class.java,
|
||||
@ -105,7 +105,7 @@ class TwoPartyTradeProtocolTests : TestWithInMemoryNetwork() {
|
||||
var (aliceNode, bobNode) = net.createTwoNodes()
|
||||
val aliceAddr = aliceNode.net.myAddress
|
||||
val bobAddr = bobNode.net.myAddress as InMemoryMessagingNetwork.Handle
|
||||
val timestamperAddr = aliceNode.legallyIdentifiableAddress
|
||||
val timestamperAddr = aliceNode.info
|
||||
|
||||
(bobNode.wallet as NodeWalletService).fillWithSomeTestCash(2000.DOLLARS)
|
||||
val alicesFakePaper = fillUpForSeller(false, timestamperAddr.identity, null).second
|
||||
@ -165,7 +165,7 @@ class TwoPartyTradeProtocolTests : TestWithInMemoryNetwork() {
|
||||
// ... bring the node back up ... the act of constructing the SMM will re-register the message handlers
|
||||
// that Bob was waiting on before the reboot occurred.
|
||||
bobNode = net.createNode(timestamperAddr, bobAddr.id, object : MockNetwork.Factory {
|
||||
override fun create(dir: Path, config: NodeConfiguration, network: MockNetwork, timestamperAddr: LegallyIdentifiableNode?): MockNetwork.MockNode {
|
||||
override fun create(dir: Path, config: NodeConfiguration, network: MockNetwork, timestamperAddr: NodeInfo?): MockNetwork.MockNode {
|
||||
return object : MockNetwork.MockNode(dir, config, net, timestamperAddr, bobAddr.id) {
|
||||
override fun initialiseStorageService(dir: Path): StorageService {
|
||||
val ss = super.initialiseStorageService(dir)
|
||||
@ -196,7 +196,7 @@ class TwoPartyTradeProtocolTests : TestWithInMemoryNetwork() {
|
||||
private fun makeNodeWithTracking(name: String): MockNetwork.MockNode {
|
||||
// Create a node in the mock network ...
|
||||
return net.createNode(null, nodeFactory = object : MockNetwork.Factory {
|
||||
override fun create(dir: Path, config: NodeConfiguration, network: MockNetwork, timestamperAddr: LegallyIdentifiableNode?): MockNetwork.MockNode {
|
||||
override fun create(dir: Path, config: NodeConfiguration, network: MockNetwork, timestamperAddr: NodeInfo?): MockNetwork.MockNode {
|
||||
return object : MockNetwork.MockNode(dir, config, network, timestamperAddr) {
|
||||
// That constructs the storage service object in a customised way ...
|
||||
override fun constructStorageService(attachments: NodeAttachmentService, keypair: KeyPair, identity: Party,
|
||||
@ -213,7 +213,7 @@ class TwoPartyTradeProtocolTests : TestWithInMemoryNetwork() {
|
||||
fun checkDependenciesOfSaleAssetAreResolved() {
|
||||
transactionGroupFor<ContractState> {
|
||||
val aliceNode = makeNodeWithTracking("alice")
|
||||
val timestamperAddr = aliceNode.legallyIdentifiableAddress
|
||||
val timestamperAddr = aliceNode.info
|
||||
val bobNode = makeNodeWithTracking("bob")
|
||||
|
||||
// Insert a prospectus type attachment into the commercial paper transaction.
|
||||
@ -324,7 +324,7 @@ class TwoPartyTradeProtocolTests : TestWithInMemoryNetwork() {
|
||||
var (aliceNode, bobNode) = net.createTwoNodes()
|
||||
val aliceAddr = aliceNode.net.myAddress
|
||||
val bobAddr = bobNode.net.myAddress as InMemoryMessagingNetwork.Handle
|
||||
val timestamperAddr = aliceNode.legallyIdentifiableAddress
|
||||
val timestamperAddr = aliceNode.info
|
||||
|
||||
val bobKey = bobNode.keyManagement.freshKey()
|
||||
val bobsBadCash = fillUpForBuyer(bobError, bobKey.public).second
|
||||
|
@ -58,14 +58,14 @@ class TimestamperNodeServiceTest : TestWithInMemoryNetwork() {
|
||||
mockServices = MockServices(net = serviceMessaging.second, storage = MockStorageService())
|
||||
|
||||
val timestampingNodeID = network.setupTimestampingNode(true).first
|
||||
(mockServices.networkMapService as MockNetworkMapService).timestampingNodes.add(timestampingNodeID)
|
||||
(mockServices.networkMapCache as MockNetworkMapCache).timestampingNodes.add(timestampingNodeID)
|
||||
serverKey = timestampingNodeID.identity.owningKey
|
||||
|
||||
// And a separate one to be tested directly, to make the unit tests a bit faster.
|
||||
service = NodeTimestamperService(serviceMessaging.second, Party("Unit test suite", ALICE), ALICE_KEY)
|
||||
}
|
||||
|
||||
class TestPSM(val server: LegallyIdentifiableNode, val now: Instant) : ProtocolLogic<Boolean>() {
|
||||
class TestPSM(val server: NodeInfo, val now: Instant) : ProtocolLogic<Boolean>() {
|
||||
@Suspendable
|
||||
override fun call(): Boolean {
|
||||
val ptx = TransactionBuilder().apply {
|
||||
@ -86,7 +86,7 @@ class TimestamperNodeServiceTest : TestWithInMemoryNetwork() {
|
||||
val psm = runNetwork {
|
||||
val smm = StateMachineManager(MockServices(net = myMessaging.second), RunOnCallerThread)
|
||||
val logName = NodeTimestamperService.TIMESTAMPING_PROTOCOL_TOPIC
|
||||
val psm = TestPSM(mockServices.networkMapService.timestampingNodes[0], clock.instant())
|
||||
val psm = TestPSM(mockServices.networkMapCache.timestampingNodes[0], clock.instant())
|
||||
smm.add(logName, psm)
|
||||
}
|
||||
assertTrue(psm.isDone)
|
||||
|
@ -93,7 +93,7 @@ class NodeInterestRatesTest {
|
||||
|
||||
val tx = TransactionBuilder()
|
||||
val fixOf = NodeInterestRates.parseFixOf("LIBOR 2016-03-16 1M")
|
||||
val protocol = RatesFixProtocol(tx, n2.legallyIdentifiableAddress, fixOf, "0.675".bd, "0.1".bd)
|
||||
val protocol = RatesFixProtocol(tx, n2.info, fixOf, "0.675".bd, "0.1".bd)
|
||||
BriefLogFormatter.initVerbose("rates")
|
||||
val future = n1.smm.add("rates", protocol)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user