RPCResponse.Result && EventData are registered interfaces; -skip_upnp option

This commit is contained in:
Jae Kwon
2015-08-10 20:38:45 -07:00
parent 65d40a2d08
commit 1b9fd811a1
60 changed files with 1468 additions and 1398 deletions

View File

@ -7,21 +7,21 @@ import (
ctypes "github.com/tendermint/tendermint/rpc/core/types"
)
func GenPrivAccount() (*acm.PrivAccount, error) {
return acm.GenPrivAccount(), nil
func GenPrivAccount() (*ctypes.ResultGenPrivAccount, error) {
return &ctypes.ResultGenPrivAccount{acm.GenPrivAccount()}, nil
}
// If the account is not known, returns nil, nil.
func GetAccount(address []byte) (*acm.Account, error) {
func GetAccount(address []byte) (*ctypes.ResultGetAccount, error) {
cache := mempoolReactor.Mempool.GetCache()
account := cache.GetAccount(address)
if account == nil {
return nil, nil
}
return account, nil
return &ctypes.ResultGetAccount{account}, nil
}
func GetStorage(address, key []byte) (*ctypes.ResponseGetStorage, error) {
func GetStorage(address, key []byte) (*ctypes.ResultGetStorage, error) {
state := consensusState.GetState()
account := state.GetAccount(address)
if account == nil {
@ -32,12 +32,12 @@ func GetStorage(address, key []byte) (*ctypes.ResponseGetStorage, error) {
_, value := storageTree.Get(LeftPadWord256(key).Bytes())
if value == nil {
return &ctypes.ResponseGetStorage{key, nil}, nil
return &ctypes.ResultGetStorage{key, nil}, nil
}
return &ctypes.ResponseGetStorage{key, value.([]byte)}, nil
return &ctypes.ResultGetStorage{key, value.([]byte)}, nil
}
func ListAccounts() (*ctypes.ResponseListAccounts, error) {
func ListAccounts() (*ctypes.ResultListAccounts, error) {
var blockHeight int
var accounts []*acm.Account
state := consensusState.GetState()
@ -46,10 +46,10 @@ func ListAccounts() (*ctypes.ResponseListAccounts, error) {
accounts = append(accounts, value.(*acm.Account))
return false
})
return &ctypes.ResponseListAccounts{blockHeight, accounts}, nil
return &ctypes.ResultListAccounts{blockHeight, accounts}, nil
}
func DumpStorage(address []byte) (*ctypes.ResponseDumpStorage, error) {
func DumpStorage(address []byte) (*ctypes.ResultDumpStorage, error) {
state := consensusState.GetState()
account := state.GetAccount(address)
if account == nil {
@ -63,5 +63,5 @@ func DumpStorage(address []byte) (*ctypes.ResponseDumpStorage, error) {
key.([]byte), value.([]byte)})
return false
})
return &ctypes.ResponseDumpStorage{storageRoot, storageItems}, nil
return &ctypes.ResultDumpStorage{storageRoot, storageItems}, nil
}