Function revert() is supposed to stop contract execution and rollback every change on blockchain except events reported. That's exactly what I need, but it seems to me it is not working as expected. In the following example, using remix.ethereum.org IDE and JS VM chain:
contract test {
function a() public {
L(1);
revert();
}
event L(uint256 n);
}
When a() function is called on JS VM the following error appears:
... test.a errored: VM error: revert.
revert The transaction has been reverted to the initial state.
And no event has been recorded.
Have tested assert(false), require(false) and throw(), same result.
Any idea how to stop the contract without losing event records? Thx!