<p>The commit you linked is no longer relevant to current Hyperledger Fabric versions. This functionality was added before v1.0, which restructured the entire framework architecture.</p>

<p>As of v1.0+, transactions are first simulated by endorsers, which create a signed set of state changes resulting from the chaincode. If enough endorsers sign a transaction (according to an endorsement policy), the client can then send the transaction to the ordering service for inclusion in the ledger. A transaction that results in an error in the chaincode would never get to this point, because it would fail to gather the necessary endorsements due to the error. The client must modify the transaction or request a modification of the chaincode for it to work.</p>

<p>Check out the Hyperledger Fabric architecture <a href="https://arxiv.org/abs/1801.10228" rel="nofollow noreferrer">paper</a> for a more detailed explanation, including a sequence diagram.</p>
How does transaction rollback work in Hyperledger Fabric?
<p>I'm looking for a transaction rollback. This is necessary if a chaincode transaction modifies the state, but then fails with an error before it is able to return.</p>

<p>I saw this is done for a pull request but I can not understand how does it works</p>

<p><a href="https://github.com/hyperledger-archives/fabric/pull/254" rel="nofollow noreferrer">Added support for rolling back a tx if chaincode execution fails</a> </p>

<p>Someone can give me an example how does it works?</p>

<p><strong>EDIT</strong></p>

<p>What I'm looking for is the concept of Transaction in database(unit of work) but in Hyperledger Fabric</p>

<p>Let's suppose that we are going to register a product for a list of clients, if there is a problem with the registration of the product in some customer then the operation is eliminated and the registration is not made to any client</p>