SignTransactionFlow(otherSideSession: FlowSession, progressTracker: ProgressTracker = SignTransactionFlow.tracker())
The SignTransactionFlow should be called in response to the CollectSignaturesFlow. It automates the signing of a transaction providing the transaction:
Usage:
Example - checking and signing a transaction involving a net.corda.core.contracts.DummyContract, see CollectSignaturesFlowTests.kt for further examples:
class Responder(val otherPartySession: FlowSession): FlowLogic<SignedTransaction>() {
@Suspendable override fun call(): SignedTransaction {
// [SignTransactionFlow] sub-classed as a singleton object.
val flow = object : SignTransactionFlow(otherPartySession) {
@Suspendable override fun checkTransaction(stx: SignedTransaction) = requireThat {
val tx = stx.tx
val magicNumberState = tx.outputs.single().data as DummyContract.MultiOwnerState
"Must be 1337 or greater" using (magicNumberState.magicNumber >= 1337)
}
}
// Invoke the subFlow, in response to the counterparty calling [CollectSignaturesFlow].
val expectedTxId = subFlow(flow).id
return subFlow(ReceiveFinalityFlow(otherPartySession, expectedTxId))
}
}
otherSideSession
- The session which is providing you a transaction to sign.