From 708428c01ef546a9a5661d0e24189a19c51c1512 Mon Sep 17 00:00:00 2001 From: romanman Date: Wed, 18 Jun 2014 10:39:26 +0100 Subject: [PATCH] Play program dialog + Fix for OOG Exception --- .../src/main/java/org/ethereum/vm/Program.java | 8 -------- ethereumj-core/src/main/java/org/ethereum/vm/VM.java | 11 +++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ethereumj-core/src/main/java/org/ethereum/vm/Program.java b/ethereumj-core/src/main/java/org/ethereum/vm/Program.java index 753bcae2..99a5ef4b 100644 --- a/ethereumj-core/src/main/java/org/ethereum/vm/Program.java +++ b/ethereumj-core/src/main/java/org/ethereum/vm/Program.java @@ -50,14 +50,6 @@ public class Program { this.invokeData = invokeData; this.ops = ops; - // In case the program invoked by wire got - // transaction, this will be the gas cost, - // otherwise the call done by other contract - // charged by CALL op - if (invokeData.byTransaction()){ - spendGas(GasCost.TRANSACTION, "TRANSACTION"); - spendGas(GasCost.TXDATA * invokeData.getDataSize().intValue(), "DATA"); - } if (invokeData.getStorage() != null){ storage = invokeData.getStorage(); diff --git a/ethereumj-core/src/main/java/org/ethereum/vm/VM.java b/ethereumj-core/src/main/java/org/ethereum/vm/VM.java index 07f58717..26613e8e 100644 --- a/ethereumj-core/src/main/java/org/ethereum/vm/VM.java +++ b/ethereumj-core/src/main/java/org/ethereum/vm/VM.java @@ -569,6 +569,17 @@ public class VM { public void play(Program program) { try { + + // In case the program invoked by wire got + // transaction, this will be the gas cost, + // otherwise the call done by other contract + // charged by CALL op + if (program.invokeData.byTransaction()){ + program.spendGas(GasCost.TRANSACTION, "TRANSACTION"); + program.spendGas(GasCost.TXDATA * program.invokeData.getDataSize().intValue(), "DATA"); + } + + while(!program.isStopped()) this.step(program); } catch (RuntimeException e) {