mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 06:31:57 +00:00
namereg rpc and tests
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
)
|
||||
|
||||
// XXX: need we be careful about rendering bytes as string or is that their problem ?
|
||||
func NameRegEntry(name []byte) (*ctypes.ResponseNameRegEntry, 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.ResponseNameRegEntry{entry}, nil
|
||||
}
|
||||
@@ -20,6 +20,7 @@ var Routes = map[string]*rpc.RPCFunc{
|
||||
"broadcast_tx": rpc.NewRPCFunc(BroadcastTx, []string{"tx"}),
|
||||
"list_unconfirmed_txs": rpc.NewRPCFunc(ListUnconfirmedTxs, []string{}),
|
||||
"list_accounts": rpc.NewRPCFunc(ListAccounts, []string{}),
|
||||
"name_reg_entry": rpc.NewRPCFunc(NameRegEntry, []string{"name"}),
|
||||
"unsafe/gen_priv_account": rpc.NewRPCFunc(GenPrivAccount, []string{}),
|
||||
"unsafe/sign_tx": rpc.NewRPCFunc(SignTx, []string{"tx", "privAccounts"}),
|
||||
}
|
||||
|
||||
@@ -100,3 +100,7 @@ type ResponseDumpConsensusState struct {
|
||||
RoundState string `json:"round_state"`
|
||||
PeerRoundStates []string `json:"peer_round_states"`
|
||||
}
|
||||
|
||||
type ResponseNameRegEntry struct {
|
||||
Entry *types.NameRegEntry `json:"entry"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user