user123959
user123959

Reputation: 1256

How can you ensure all transactions/subflows in a Corda flow are finalized?

I'm wondering about the case where you have a flow that requires subflows with their own transactions that are finalized. For example if you need your flow to issue cash to multiple parties or to handle multiple asset transfers in one flow, how would you ensure that either ALL of the changes go in to effect or none, considering that these are separate finalized subflows? The issue is I don't want the overall flow to be partially completed.

For example, say the flow needs to involve a transfer of assets from Party A and B and as well from Party B and C -- The party A and B subflow is completed and finalized, but Party C fails to sign the second transaction. In this case, the overall flow would not be completed but there would be side effects from the A and B subflow that was completed, correct? Would I need to instead customize all of the subflows to utilize the same transaction?

Upvotes: 0

Views: 143

Answers (1)

Joel
Joel

Reputation: 23210

In Corda, the unit of atomicity is the transaction. As soon as a transaction is committed, it cannot be rolled back. In your case, all the ledger updates that you want to occur at once must be part of the same transaction.

Upvotes: 0

Related Questions