{"action":"created","issue":{"url":"https://api.github.com/repos/MetaMask/metamask-plugin/issues/510","repository_url":"https://api.github.com/repos/MetaMask/metamask-plugin","labels_url":"https://api.github.com/repos/MetaMask/metamask-plugin/issues/510/labels{/name}","comments_url":"https://api.github.com/repos/MetaMask/metamask-plugin/issues/510/comments","events_url":"https://api.github.com/repos/MetaMask/metamask-plugin/issues/510/events","html_url":"https://github.com/MetaMask/metamask-plugin/issues/510","id":168435138,"number":510,"title":"Transactions fail after encountering out of gas error.","user":{"login":"AustP","id":2007045,"avatar_url":"https://avatars.githubusercontent.com/u/2007045?v=3","gravatar_id":"","url":"https://api.github.com/users/AustP","html_url":"https://github.com/AustP","followers_url":"https://api.github.com/users/AustP/followers","following_url":"https://api.github.com/users/AustP/following{/other_user}","gists_url":"https://api.github.com/users/AustP/gists{/gist_id}","starred_url":"https://api.github.com/users/AustP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AustP/subscriptions","organizations_url":"https://api.github.com/users/AustP/orgs","repos_url":"https://api.github.com/users/AustP/repos","events_url":"https://api.github.com/users/AustP/events{/privacy}","received_events_url":"https://api.github.com/users/AustP/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-29T23:50:16Z","updated_at":"2016-07-31T04:18:57Z","closed_at":null,"body":"I was testing my Dapp and sent ETH to my contract. I had done this probably about 20 times before but for some reason this time I got a out of gas error.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/2007045/17266362/67a234f2-55b4-11e6-9f79-867d6d0ee186.png)\r\n\r\nSo I tried sending the ETH again. After approving the transaction via MetaMask, nothing happens. I don't get any errors logged, and my contract doesn't receive any ETH. The transaction shows up in MetaMask's transaction history though.\r\n\r\nAnyways, I checked MetaMask's background page's console for any errors. After about 30 seconds of nothing happening, this error shows up in the console:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/2007045/17266161/4928035a-55b2-11e6-9bfe-4f4e44bc2e1c.png)\r\n"},"comment":{"url":"https://api.github.com/repos/MetaMask/metamask-plugin/issues/comments/236408867","html_url":"https://github.com/MetaMask/metamask-plugin/issues/510#issuecomment-236408867","issue_url":"https://api.github.com/repos/MetaMask/metamask-plugin/issues/510","id":236408867,"user":{"login":"AustP","id":2007045,"avatar_url":"https://avatars.githubusercontent.com/u/2007045?v=3","gravatar_id":"","url":"https://api.github.com/users/AustP","html_url":"https://github.com/AustP","followers_url":"https://api.github.com/users/AustP/followers","following_url":"https://api.github.com/users/AustP/following{/other_user}","gists_url":"https://api.github.com/users/AustP/gists{/gist_id}","starred_url":"https://api.github.com/users/AustP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AustP/subscriptions","organizations_url":"https://api.github.com/users/AustP/orgs","repos_url":"https://api.github.com/users/AustP/repos","events_url":"https://api.github.com/users/AustP/events{/privacy}","received_events_url":"https://api.github.com/users/AustP/received_events","type":"User","site_admin":false},"created_at":"2016-07-31T04:18:57Z","updated_at":"2016-07-31T04:18:57Z","body":"I've got some more information. This might be a web3 issue after all...\r\n\r\nSo I just updated my solidity code, and now whenever I send a transaction with more than the allowed ether, I get the out of gas exception. Here is the block snippet that handles that logic:\r\n\r\n    // if they go over the maximum, refund them the rest\r\n    if (participant.amount > maximum) {\r\n        uint refund = participant.amount - maximum;\r\n        participant.amount = maximum;\r\n        amount -= refund;\r\n        msg.sender.send(refund);\r\n    }\r\n\r\nNow, if I change the block to this:\r\n\r\n    // if they go over the maximum, refund them the rest\r\n    if (participant.amount > maximum) {\r\n        uint refund = participant.amount - maximum;\r\n        amount -= refund;\r\n        msg.sender.send(refund);\r\n\r\n\r\n        // NOTICE: this line moved to the bottom\r\n        participant.amount = maximum;\r\n    }\r\n\r\nthen when I send a transaction with more than the allowed ether, I don't get the exception and everything works as intended."}}
{"actor":{"display_login":"AustP"}}