aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/state/state_test.go2
-rw-r--r--core/vm/gas_table.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/core/state/state_test.go b/core/state/state_test.go
index 12778f6f1..123559ea9 100644
--- a/core/state/state_test.go
+++ b/core/state/state_test.go
@@ -99,7 +99,7 @@ func (s *StateSuite) TestNull(c *checker.C) {
s.state.SetState(address, common.Hash{}, value)
s.state.Commit(false)
value = s.state.GetState(address, common.Hash{})
- if !common.EmptyHash(value) {
+ if value != (common.Hash{}) {
c.Errorf("expected empty hash. got %x", value)
}
}
diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go
index 83adba428..0764c67a4 100644
--- a/core/vm/gas_table.go
+++ b/core/vm/gas_table.go
@@ -124,12 +124,12 @@ func gasSStore(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, m
// 1. From a zero-value address to a non-zero value (NEW VALUE)
// 2. From a non-zero value address to a zero-value address (DELETE)
// 3. From a non-zero to a non-zero (CHANGE)
- if common.EmptyHash(val) && !common.EmptyHash(common.BigToHash(y)) {
+ if val == (common.Hash{}) && y.Sign() != 0 {
// 0 => non 0
return params.SstoreSetGas, nil
- } else if !common.EmptyHash(val) && common.EmptyHash(common.BigToHash(y)) {
+ } else if val != (common.Hash{}) && y.Sign() == 0 {
+ // non 0 => 0
evm.StateDB.AddRefund(params.SstoreRefundGas)
-
return params.SstoreClearGas, nil
} else {
// non 0 => non 0 (or 0 => 0)