Skip to content

Commit

Permalink
Merge pull request corda#4529 from corda/FinalityFlowMigrationDocUpdate
Browse files Browse the repository at this point in the history
Finality flow migration doc update
  • Loading branch information
rogersanick authored Jan 9, 2019
2 parents fa025de + 285c93e commit d97fac0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/source/app-upgrade-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ away to the new API, as otherwise things like business network membership checks

This is a three step process:

1. Change the flow that calls ``FinalityFlow``
1. Change the flow that calls ``FinalityFlow``.
2. Change or create the flow that will receive the finalised transaction.
3. Make sure your application's minimum and target version numbers are both set to 4 (see step 2).

Expand All @@ -140,7 +140,7 @@ As an example, let's take a very simple flow that finalises a transaction withou
:end-before: DOCEND SimpleFlowUsingOldApi
:dedent: 4

To use the new API, this flow needs to be annotated with ``InitiatingFlow`` and a ``FlowSession`` to the participant of the transaction must be
To use the new API, this flow needs to be annotated with ``InitiatingFlow`` and a ``FlowSession`` to the participant(s) of the transaction must be
passed to ``FinalityFlow`` :

.. container:: codeset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,21 @@ public ExistingResponderFlow(FlowSession otherSide) {
@Suspendable
@Override
public Void call() throws FlowException {

// DOCSTART ExistingResponderFlow
// First we have to run the SignTransactionFlow, which will return a SignedTransaction.
SignedTransaction txWeJustSigned = subFlow(new SignTransactionFlow(otherSide) {
@Suspendable
@Override
protected void checkTransaction(@NotNull SignedTransaction stx) throws FlowException {
// Do checks here
// Implement responder flow transaction checks here
}
});
// DOCSTART ExistingResponderFlow

if (otherSide.getCounterpartyFlowInfo().getFlowVersion() >= 2) {
// The other side is not using the old CorDapp so call ReceiveFinalityFlow to record the finalised transaction.
// If SignTransactionFlow is used then we can verify the tranaction we receive for recording is the same one
// that was just signed.
// that was just signed by passing the transaction id to ReceiveFinalityFlow.
subFlow(new ReceiveFinalityFlow(otherSide, txWeJustSigned.getId()));
} else {
// Otherwise the other side is running the old CorDapp and so we don't need to do anything further. The node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ class ExistingInitiatingFlow(private val counterparty: Party) : FlowLogic<Signed
class ExistingResponderFlow(private val otherSide: FlowSession) : FlowLogic<Unit>() {
@Suspendable
override fun call() {
// DOCSTART ExistingResponderFlow
// First we have to run the SignTransactionFlow, which will return a SignedTransaction.
val txWeJustSigned = subFlow(object : SignTransactionFlow(otherSide) {
@Suspendable
override fun checkTransaction(stx: SignedTransaction) {
// Do checks here
// Implement responder flow transaction checks here
}
})
// DOCSTART ExistingResponderFlow

if (otherSide.getCounterpartyFlowInfo().flowVersion >= 2) {
// The other side is not using the old CorDapp so call ReceiveFinalityFlow to record the finalised transaction.
// If SignTransactionFlow is used then we can verify the tranaction we receive for recording is the same one
Expand Down

0 comments on commit d97fac0

Please sign in to comment.