mirror of
https://github.com/corda/corda.git
synced 2024-12-21 13:57:54 +00:00
Updating FinalityFlow documentation with example code for use with SignTransactionFlow in flow responder.
This commit is contained in:
parent
d33cb16c5e
commit
a78278927f
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user