git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit f148072e804e4e10c0a513d11513ed7e67030f0b

Merge pull request #17 from ewasm/gas-throw

useGas: throw exception if ran out of gas
wanderer authored on 8/12/2016, 4:58:31 PM
GitHub committed on 8/12/2016, 4:58:31 PM
Parent: d4fcd808d2a39cf0b2b48b769c9028f4a8f8b17b
Parent: a56c16bc80f5bb6fe261de15738164037c6f9d79

Files changed

interface.jschanged
interface.jsView
@@ -64,8 +64,11 @@
6464 * @param {integer} amount the amount to subtract to the gas counter
6565 */
6666 useGas (amount) {
6767 if (amount > 0) {
68+ if (this.environment.gasLimit < amount) {
69+ throw new Error('Ran out of gas')
70+ }
6871 this.environment.gasLimit -= amount
6972 }
7073 }
7174

Built with git-ssb-web