Commit V.S. DeliverTx #381
-
Hi team, The Commit doc says
For DeliverTx, the doc says:
I have two understandings:
I think a) is the right understanding but wanna double check with you. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @pcpLiu. In general, it isn't safe for the application to update its state until a block is fully committed. The application can execute and stage delivered transactions to persistent storage if it wants, but the effects of those transactions should not be exposed to users of the application until after a successful commit. Otherwise, suppose the consensus node or the application itself fail during delivery: After restart, a node will replay the block(s) from the last-known-good application height. Unless the transactions are idempotent, replaying the same transactions may change the application's state differently than the original transactions would have done. So the safe answer is closer to (b). |
Beta Was this translation helpful? Give feedback.
Hi @pcpLiu. In general, it isn't safe for the application to update its state until a block is fully committed. The application can execute and stage delivered transactions to persistent storage if it wants, but the effects of those transactions should not be exposed to users of the application until after a successful commit.
Otherwise, suppose the consensus node or the application itself fail during delivery: After restart, a node will replay the block(s) from the last-known-good application height. Unless the transactions are idempotent, replaying the same transactions may change the application's state differently than the original transactions would have done.
So the safe answer is c…