Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Preventing invalid spending of broadcasted states - ReplyToMessageResponder
class ReplyToMessageResponder(private val session: FlowSession) : FlowLogic<SignedTransaction>() {
override fun call(): SignedTransaction {
val stx = subFlow(object : SignTransactionFlow(session) {
override fun checkTransaction(stx: SignedTransaction) {
val message = stx.coreTransaction.outputsOfType<MessageState>().single()
require(message.sender != ourIdentity) {
"The sender of the new message cannot have my identity when I am not the creator of the transaction"
require(message.sender == session.counterparty) {
"The sender of the reply must must be the party creating this transaction"
return subFlow(
otherSideSession = session,
expectedTxId =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.