From af3b31db242902eb434ca01d3c933c19c4d97e25 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Sat, 21 Mar 2015 13:15:58 -0700 Subject: [PATCH] Check StorageRoot for Zero before state.Load(). --- state/vm_app_state.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/state/vm_app_state.go b/state/vm_app_state.go index e82a21c17..e0cf66ea5 100644 --- a/state/vm_app_state.go +++ b/state/vm_app_state.go @@ -30,13 +30,19 @@ func toStateAccount(acc *vm.Account) *ac.Account { if !ok { pubKey = ac.PubKeyNil{} } + var storageRoot []byte + if acc.StorageRoot.IsZero() { + storageRoot = nil + } else { + storageRoot = acc.StorageRoot.Bytes() + } return &ac.Account{ Address: acc.Address.Address(), PubKey: pubKey, Balance: acc.Balance, Code: acc.Code, Sequence: uint(acc.Nonce), - StorageRoot: acc.StorageRoot.Bytes(), + StorageRoot: storageRoot, } }