Created
May 23, 2019 13:10
-
-
Save lankydan/5461b49b286418093f5cab242838875d to your computer and use it in GitHub Desktop.
Corda customising transaction validation - Base Flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@InitiatingFlow | |
open class SendMessageFlow(private val message: MessageState) : | |
FlowLogic<SignedTransaction>() { | |
open fun extraTransactionValidation(transaction: TransactionBuilder) { | |
// to be implemented by subtype flows - otherwise do nothing | |
} | |
@Suspendable | |
final override fun call(): SignedTransaction { | |
// build transaction | |
val tx = verifyAndSign(transaction) | |
// collect signatures | |
// save transaction | |
} | |
private fun verifyAndSign(transaction: TransactionBuilder): SignedTransaction { | |
extraTransactionValidation(transaction) | |
transaction.verify(serviceHub) | |
return serviceHub.signInitialTransaction(transaction) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment