From 671a3058018a59e0c5e116bf1da4c7a4cc4a1f27 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Tue, 19 Feb 2019 18:37:22 +0800 Subject: [PATCH] core/state: fix state iterator --- core/state/statedb.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 8ad25a5824..a019f4e8fe 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -486,7 +486,14 @@ func (db *StateDB) ForEachStorage(addr common.Address, cb func(key, value common cb(key, value) continue } - cb(key, common.BytesToHash(it.Value)) + + if len(it.Value) > 0 { + _, content, _, err := rlp.Split(it.Value) + if err != nil { + continue + } + cb(key, common.BytesToHash(content)) + } } }