Skip to content

Commit 1e985f9

Browse files
committed
Fixed casting error
* big(bytes) == 0 when len(bytes) > 0
1 parent 4789084 commit 1e985f9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

vm/vm_debug.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
181181

182182
var mult *big.Int
183183
y, x := stack.Peekn()
184-
val := closure.GetStorage(x)
185-
if val.BigInt().Cmp(ethutil.Big0) == 0 && len(y.Bytes()) > 0 {
184+
//val := closure.GetStorage(x)
185+
val := statedb.GetState(closure.Address(), x.Bytes())
186+
if len(val) == 0 && len(y.Bytes()) > 0 {
186187
// 0 => non 0
187188
mult = ethutil.Big3
188-
} else if val.BigInt().Cmp(ethutil.Big0) != 0 && len(y.Bytes()) == 0 {
189+
} else if len(val) > 0 && len(y.Bytes()) == 0 {
189190
statedb.Refund(caller.Address(), GasSStoreRefund)
190191

191192
mult = ethutil.Big0

0 commit comments

Comments
 (0)