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
762 B

package core
import (
"fmt"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
)
func GetName(name string) (*types.NameRegEntry, error) {
st := consensusState.GetState() // performs a copy
entry := st.GetNameRegEntry(name)
if entry == nil {
return nil, fmt.Errorf("Name %s not found", name)
}
return entry, nil
}
func ListNames() (*ctypes.ResponseListNames, 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.ResponseListNames{blockHeight, names}, nil
}