Change CashIssueFlow to use anonymous identity

* Add functions for:
    * Retrieving nodes via their legal identity
    * Filtering a set of public keys down to those the node has corresponding private keys for
* Modify contract upgrade flows to handle identifying participants after an anomymisation step
* Correct terminology: "party who" -> "party which"
* Modify CashIssueFlow and CashPaymentFlow to optionally use an anonymous identity for the recipient.
This commit is contained in:
Ross Nicoll
2017-06-28 13:47:50 +01:00
committed by GitHub
parent e5395fe1b7
commit 1a4965c294
57 changed files with 464 additions and 205 deletions

View File

@ -51,7 +51,8 @@ class TraderDemoTest : NodeBasedTest() {
val expectedBCash = clientB.cashCount + 1
val expectedPaper = listOf(clientA.commercialPaperCount + 1, clientB.commercialPaperCount)
clientA.runBuyer(amount = 100.DOLLARS)
// TODO: Enable anonymisation
clientA.runBuyer(amount = 100.DOLLARS, anonymous = false)
clientB.runSeller(counterparty = nodeA.info.legalIdentity.name, amount = 5.DOLLARS)
assertThat(clientA.cashCount).isGreaterThan(originalACash)

View File

@ -43,14 +43,14 @@ class TraderDemoClientApi(val rpc: CordaRPCOps) {
return vault.filterStatesOfType<CommercialPaper.State>().size
}
fun runBuyer(amount: Amount<Currency> = 30000.DOLLARS) {
fun runBuyer(amount: Amount<Currency> = 30000.DOLLARS, anonymous: Boolean = true) {
val bankOfCordaParty = rpc.partyFromX500Name(BOC.name)
?: throw Exception("Unable to locate ${BOC.name} in Network Map Service")
val me = rpc.nodeIdentity()
val amounts = calculateRandomlySizedAmounts(amount, 3, 10, Random())
// issuer random amounts of currency totaling 30000.DOLLARS in parallel
val resultFutures = amounts.map { pennies ->
rpc.startFlow(::IssuanceRequester, Amount(pennies, amount.token), me.legalIdentity, OpaqueBytes.of(1), bankOfCordaParty).returnValue
rpc.startFlow(::IssuanceRequester, Amount(pennies, amount.token), me.legalIdentity, OpaqueBytes.of(1), bankOfCordaParty, anonymous).returnValue
}
Futures.allAsList(resultFutures).getOrThrow()