Changed FlowLogic.ourIdentity to return Party and added FlowLogic.ourIdentityAndCert which returns PartyAndCertificate. (#1537)

Updated code base to make use of these instead of chooseIdentity(). Also improved the serialisation of fiber checkpoints so that it doesn't store the entire cert parth of this identity.
This commit is contained in:
Shams Asari
2017-09-18 15:28:23 +01:00
committed by josecoll
parent 8f86068807
commit 8e0b8477af
35 changed files with 178 additions and 165 deletions

View File

@ -22,10 +22,10 @@ import java.util.*
* Flow for the Bank of Corda node to issue some commercial paper to the seller's node, to sell to the buyer.
*/
@StartableByRPC
class CommercialPaperIssueFlow(val amount: Amount<Currency>,
val issueRef: OpaqueBytes,
val recipient: Party,
val notary: Party,
class CommercialPaperIssueFlow(private val amount: Amount<Currency>,
private val issueRef: OpaqueBytes,
private val recipient: Party,
private val notary: Party,
override val progressTracker: ProgressTracker) : FlowLogic<SignedTransaction>() {
constructor(amount: Amount<Currency>, issueRef: OpaqueBytes, recipient: Party, notary: Party) : this(amount, issueRef, recipient, notary, tracker())
@ -40,7 +40,7 @@ class CommercialPaperIssueFlow(val amount: Amount<Currency>,
progressTracker.currentStep = ISSUING
val issuance: SignedTransaction = run {
val tx = CommercialPaper().generateIssue(ourIdentity.party.ref(issueRef), amount `issued by` ourIdentity.party.ref(issueRef),
val tx = CommercialPaper().generateIssue(ourIdentity.ref(issueRef), amount `issued by` ourIdentity.ref(issueRef),
Instant.now() + 10.days, notary)
// TODO: Consider moving these two steps below into generateIssue.

View File

@ -16,8 +16,8 @@ import java.util.*
@InitiatingFlow
@StartableByRPC
class SellerFlow(val otherParty: Party,
val amount: Amount<Currency>,
class SellerFlow(private val otherParty: Party,
private val amount: Amount<Currency>,
override val progressTracker: ProgressTracker) : FlowLogic<SignedTransaction>() {
constructor(otherParty: Party, amount: Amount<Currency>) : this(otherParty, amount, tracker())
@ -41,7 +41,7 @@ class SellerFlow(val otherParty: Party,
progressTracker.currentStep = SELF_ISSUING
val notary: NodeInfo = serviceHub.networkMapCache.notaryNodes[0]
val cpOwner = serviceHub.keyManagementService.freshKeyAndCert(ourIdentity, false)
val cpOwner = serviceHub.keyManagementService.freshKeyAndCert(ourIdentityAndCert, false)
val commercialPaper = serviceHub.vaultQueryService.queryBy(CommercialPaper.State::class.java).states.first()
progressTracker.currentStep = TRADING