Skip to main content
10 events
when toggle format what by license comment
Sep 24, 2017 at 6:25 comment added alper Not logically but I just push some nodes in to linkedlist, so as revert I need to remove them. PS: Of course I forget to accept before sorry about that.
Sep 24, 2017 at 5:02 comment added Rob Hitchens As general rules of thumb, prefer to "Fail Hard" whenever possible, since it reverts everything for you (opposite of "catch"). You can think of possible responses as "yes", "no" and "unacceptable". Try to put your "guards up front" and don't change things in the first place if untangling it is a problem. You're describing some sort of partial success that you should probably break down logically - either total failure or complete success.
Sep 24, 2017 at 4:09 comment added alper My if condition is a function and my change some states, which will return true or false. The function may consume a lot of gas. So it may seem to just use throw instead of if/else since reverting states by hand may consume additional gas usage. @Rob Hitchens
Sep 24, 2017 at 4:02 vote accept alper
Apr 15, 2017 at 19:48 comment added Rob Hitchens I you don't throw, then revert all state changes.
Apr 15, 2017 at 10:55 comment added alper As I understand instead of throw, I should come up with some kind of "reverting state" mechanism? Shouldn't require additional gas mechanism? @RobHitchens
Apr 15, 2017 at 10:48 vote accept alper
Apr 15, 2017 at 10:51
Apr 14, 2017 at 6:54 comment added alper “unclear why funds are supposed to be sent to one of possible” Think it a system like an Amazon. When we purchase an item pay() first the money will be dropped from clients account. On the payMeBack(), condition check that for ex: does the item successfully delivered to the seller. If yes, gained money by the contract will be paid to the seller seller.send(gainedWei). If no, it will pay back to the client as refund client.send(gainedWei). Hope it is bit more clear. So mainly payMeBack also should decide who will gain the money seller or the client based on the conditions. @RobHitchens.
Apr 13, 2017 at 13:24 history edited Rob Hitchens CC BY-SA 3.0
added 371 characters in body
Apr 13, 2017 at 13:19 history answered Rob Hitchens CC BY-SA 3.0