| 392 | } |
| 393 | |
| 394 | func storageRangeAt(st state.Trie, start []byte, maxResult int) (StorageRangeResult, error) { |
| 395 | it := trie.NewIterator(st.NodeIterator(start)) |
| 396 | result := StorageRangeResult{Storage: storageMap{}} |
| 397 | for i := 0; i < maxResult && it.Next(); i++ { |
| 398 | _, content, _, err := rlp.Split(it.Value) |
| 399 | if err != nil { |
| 400 | return StorageRangeResult{}, err |
| 401 | } |
| 402 | e := storageEntry{Value: common.BytesToHash(content)} |
| 403 | if preimage := st.GetKey(it.Key); preimage != nil { |
| 404 | preimage := common.BytesToHash(preimage) |
| 405 | e.Key = &preimage |
| 406 | } |
| 407 | result.Storage[common.BytesToHash(it.Key)] = e |
| 408 | } |
| 409 | // Add the 'next key' so clients can continue downloading. |
| 410 | if it.Next() { |
| 411 | next := common.BytesToHash(it.Key) |
| 412 | result.NextKey = &next |
| 413 | } |
| 414 | return result, nil |
| 415 | } |
| 416 | |
| 417 | // GetModifiedAccountsByNumber returns all accounts that have changed between the |
| 418 | // two blocks specified. A change is defined as a difference in nonce, balance, |