Skip to content

Instantly share code, notes, and snippets.

@lankydan
Created May 23, 2019 13:11
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/f2aee3a95e1859eeaa802c63b37fb393 to your computer and use it in GitHub Desktop.
Save lankydan/f2aee3a95e1859eeaa802c63b37fb393 to your computer and use it in GitHub Desktop.
Corda customising transaction validation - extra validation Flow
class ExtraValidationSendMessageFlow(message: MessageState) :
SendMessageFlow(message) {
override fun extraTransactionValidation(transaction: TransactionBuilder) {
requireThat {
val messages = transaction.toLedgerTransaction(serviceHub).outputsOfType<MessageState>()
"There must be only one output message" using (messages.size == 1)
val message = messages.single()
"Message must contain the secret passphrase" using (message.contents.contains("I love Corda"))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment