Introducing InitiatingFlow annotation which has to be annotated by initiating flows.

This removes the need for the shareParentSessions parameter of FlowLogic.subFlow. It also has the flow's version number so FlowVersion is now no longer needed.
This commit is contained in:
Shams Asari
2017-05-08 10:38:18 +01:00
parent 1f4535bc2e
commit 221bb81f84
42 changed files with 429 additions and 264 deletions

View File

@ -49,7 +49,7 @@ class BuyerFlow(val otherParty: Party,
CommercialPaper.State::class.java)
// This invokes the trading flow and out pops our finished transaction.
val tradeTX: SignedTransaction = subFlow(buyer, shareParentSessions = true)
val tradeTX: SignedTransaction = subFlow(buyer)
// TODO: This should be moved into the flow itself.
serviceHub.recordTransactions(listOf(tradeTX))

View File

@ -9,10 +9,10 @@ import net.corda.core.crypto.SecureHash
import net.corda.core.crypto.generateKeyPair
import net.corda.core.days
import net.corda.core.flows.FlowLogic
import net.corda.core.flows.InitiatingFlow
import net.corda.core.node.NodeInfo
import net.corda.core.seconds
import net.corda.core.transactions.SignedTransaction
import net.corda.core.utilities.DUMMY_BANK_C
import net.corda.core.utilities.ProgressTracker
import net.corda.flows.NotaryFlow
import net.corda.flows.TwoPartyTradeFlow
@ -21,6 +21,7 @@ import java.security.PublicKey
import java.time.Instant
import java.util.*
@InitiatingFlow
class SellerFlow(val otherParty: Party,
val amount: Amount<Currency>,
override val progressTracker: ProgressTracker) : FlowLogic<SignedTransaction>() {
@ -60,7 +61,7 @@ class SellerFlow(val otherParty: Party,
amount,
cpOwnerKey,
progressTracker.getChildProgressTracker(TRADING)!!)
return subFlow(seller, shareParentSessions = true)
return subFlow(seller)
}
@Suspendable