From a78278927fea6aff97ee9018c408e0bdef8b54e8 Mon Sep 17 00:00:00 2001 From: rogersanick Date: Tue, 8 Jan 2019 16:29:59 -0500 Subject: [PATCH 1/2] Updating FinalityFlow documentation with example code for use with SignTransactionFlow in flow responder. --- .../java/net/corda/docs/java/FinalityFlowMigration.java | 9 ++++++--- .../net/corda/docs/kotlin/FinalityFlowMigration.kt | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/source/example-code/src/main/java/net/corda/docs/java/FinalityFlowMigration.java b/docs/source/example-code/src/main/java/net/corda/docs/java/FinalityFlowMigration.java index ddb38ebd0b..2923792ec3 100644 --- a/docs/source/example-code/src/main/java/net/corda/docs/java/FinalityFlowMigration.java +++ b/docs/source/example-code/src/main/java/net/corda/docs/java/FinalityFlowMigration.java @@ -110,18 +110,21 @@ public class FinalityFlowMigration { @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 diff --git a/docs/source/example-code/src/main/kotlin/net/corda/docs/kotlin/FinalityFlowMigration.kt b/docs/source/example-code/src/main/kotlin/net/corda/docs/kotlin/FinalityFlowMigration.kt index 493105a875..64f52fc38e 100644 --- a/docs/source/example-code/src/main/kotlin/net/corda/docs/kotlin/FinalityFlowMigration.kt +++ b/docs/source/example-code/src/main/kotlin/net/corda/docs/kotlin/FinalityFlowMigration.kt @@ -70,13 +70,15 @@ class ExistingInitiatingFlow(private val counterparty: Party) : FlowLogic() { @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 From 285c93e78556d1fc84488bc0ea517d84c8bf3029 Mon Sep 17 00:00:00 2001 From: rogersanick Date: Tue, 8 Jan 2019 16:37:14 -0500 Subject: [PATCH 2/2] Fixed grammar and spelling --- docs/source/app-upgrade-notes.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/app-upgrade-notes.rst b/docs/source/app-upgrade-notes.rst index d528be6b0b..f809616aa9 100644 --- a/docs/source/app-upgrade-notes.rst +++ b/docs/source/app-upgrade-notes.rst @@ -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). @@ -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