You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
783 B

package core
import (
"fmt"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
)
func GetName(name string) (*ctypes.ResultGetName, error) {
st := consensusState.GetState() // performs a copy
entry := st.GetNameRegEntry(name)
if entry == nil {
return nil, fmt.Errorf("Name %s not found", name)
}
return &ctypes.ResultGetName{entry}, nil
}
func ListNames() (*ctypes.ResultListNames, error) {
var blockHeight int
var names []*types.NameRegEntry
state := consensusState.GetState()
blockHeight = state.LastBlockHeight
state.GetNames().Iterate(func(key interface{}, value interface{}) bool {
names = append(names, value.(*types.NameRegEntry))
return false
})
return &ctypes.ResultListNames{blockHeight, names}, nil
}