There is any rollback function in Hyperledger Fabric v2.4? If exists then where we call it in Api side or chaincode side? It's possible to rollback in Chaincode in Javascript
like in chaincode hyperledger fabric there was a function ctx.stub.rollback()
which rollback the data on error handling.
Rollback function or any other way to rollback the ledger if the other network transaction is failed?
I am not aware of there ever being a ctx.stub.rollback()
function in the chaincode / contract public API. If you want to indicate that a transaction proposal is unsuccessful in a smart contract then you return an error from the transaction function. This returns an error to the client and does not endorse the transaction proposal.
It is useful to understand the Fabric transaction submit flow to see where the proposal step - where the smart contract transaction function is actually executed - fits in.
Once a transaction has been successfully committed to the blockchain (with sufficient endorsements to pass validation), the ledger state is updated. The blockchain is immutable so you cannot remove transactions; only submit subsequent transactions that modify (or revert) the ledger state.