Reputation: 85
Consider the following design problem in Corda. Suppose that I have a ContractState
, say Order
, which carries an explicit status, for instance its either ALIVE
or CANCELED
. The latter status relates to finished orders. I would like to have a transaction which takes a single, ALIVE
input state Order
and consumes it while changing its status to CANCELED
. Can I have an atomic transition accomplishing this task? In other words, is it possible to record the reason why a state was consumed?
Upvotes: 0
Views: 90
Reputation: 2548
Order
has 3 attributes: Order(linearId, status, reason)
.linearId
but with different values for the remaining attributes. This way all states in your vault that have the same linearId
are considered different versions of the same state, there will be only one UNCONSUMED
version; which is the latest version.Order(123, ALIVE, null)
---Update Tx---> Order(123, CANCELED, "No longer needed")
.Order(123, ALIVE, null)
---Cancel Tx---> no output.Upvotes: 2