diff --git a/src/main/kotlin/com/r3corda/demos/TraderDemo.kt b/src/main/kotlin/com/r3corda/demos/TraderDemo.kt index 796f19f697..ec93fe7780 100644 --- a/src/main/kotlin/com/r3corda/demos/TraderDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/TraderDemo.kt @@ -72,8 +72,6 @@ fun main(args: Array) { fun runTraderDemo(args: Array): Int { val cashIssuerKey = generateKeyPair() - val cashIssuer = Party("Trusted cash issuer", cashIssuerKey.public) - val amount = 1000.DOLLARS `issued by` cashIssuer.ref(1) val parser = OptionParser() val roleArg = parser.accepts("role").withRequiredArg().ofType(Role::class.java).required() @@ -142,11 +140,17 @@ fun runTraderDemo(args: Array): Int { cashIssuer = party NodeInfo(ArtemisMessagingService.makeRecipient(theirNetAddr), party, setOf(NetworkMapService.Type)) } + // And now construct then start the node object. It takes a little while. val node = logElapsedTime("Node startup") { Node(directory, myNetAddr, config, networkMapId, advertisedServices).setup().start() } + // TODO: Replace with a separate trusted cash issuer + if (cashIssuer == null) { + cashIssuer = node.services.storageService.myLegalIdentity + } + // What happens next depends on the role. The buyer sits around waiting for a trade to start. The seller role // will contact the buyer and actually make something happen. val amount = 1000.DOLLARS `issued by` cashIssuer.ref(0) // Note: "0" has to match the reference used in the wallet filler @@ -367,7 +371,7 @@ private class TraderDemoProtocolSeller(val myAddress: HostAndPort, // Now make a dummy transaction that moves it to a new key, just to show that resolving dependencies works. val move: SignedTransaction = run { - val builder = TransactionBuilder() + val builder = TransactionType.General.Builder() CommercialPaper().generateMove(builder, issuance.tx.outRef(0), ownedBy) builder.signWith(keyPair) val notarySignature = subProtocol(NotaryProtocol.Client(builder.toSignedTransaction(false)))