Skip to content

Instantly share code, notes, and snippets.

@lankydan
Created May 23, 2019 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lankydan/5461b49b286418093f5cab242838875d to your computer and use it in GitHub Desktop.
Save lankydan/5461b49b286418093f5cab242838875d to your computer and use it in GitHub Desktop.
Corda customising transaction validation - Base Flow
@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