Some renames and small fixes.

This commit is contained in:
Jae Kwon
2015-04-08 12:30:49 -07:00
parent 6b5383918f
commit 7356556938
12 changed files with 28 additions and 28 deletions

View File

@ -15,7 +15,7 @@ func GetAccount(address []byte) (*ResponseGetAccount, error) {
return &ResponseGetAccount{cache.GetAccount(address)}, nil
}
func GetStorage(address, storage []byte) (*ResponseGetStorage, error) {
func GetStorage(address, key []byte) (*ResponseGetStorage, error) {
state := consensusState.GetState()
account := state.GetAccount(address)
if account == nil {
@ -24,11 +24,11 @@ func GetStorage(address, storage []byte) (*ResponseGetStorage, error) {
storageRoot := account.StorageRoot
storageTree := state.LoadStorage(storageRoot)
_, value := storageTree.Get(RightPadWord256(storage).Bytes())
_, value := storageTree.Get(RightPadWord256(key).Bytes())
if value == nil {
return &ResponseGetStorage{storage, nil}, nil
return &ResponseGetStorage{key, nil}, nil
}
return &ResponseGetStorage{storage, value.([]byte)}, nil
return &ResponseGetStorage{key, value.([]byte)}, nil
}
func ListAccounts() (*ResponseListAccounts, error) {
@ -50,9 +50,9 @@ func DumpStorage(addr []byte) (*ResponseDumpStorage, error) {
return nil, fmt.Errorf("Unknown address: %X", addr)
}
storageRoot := account.StorageRoot
storage := state.LoadStorage(storageRoot)
storageTree := state.LoadStorage(storageRoot)
storageItems := []StorageItem{}
storage.Iterate(func(key interface{}, value interface{}) bool {
storageTree.Iterate(func(key interface{}, value interface{}) bool {
storageItems = append(storageItems, StorageItem{
key.([]byte), value.([]byte)})
return false