fixes; load from file with valsets and chains

This commit is contained in:
Ethan Buchman
2016-01-21 22:57:24 -05:00
parent 1af021846e
commit de1d5f6353
6 changed files with 222 additions and 47 deletions

View File

@ -11,11 +11,12 @@ func Routes(network *TendermintNetwork) map[string]*rpc.RPCFunc {
// "subscribe": rpc.NewWSRPCFunc(Subscribe, []string{"event"}),
// "unsubscribe": rpc.NewWSRPCFunc(Unsubscribe, []string{"event"}),
"status": rpc.NewRPCFunc(StatusResult(network), ""),
"blockchain": rpc.NewRPCFunc(GetChainResult(network), "chain"),
"register_chain": rpc.NewRPCFunc(RegisterChainResult(network), "chainConfig"),
"validator_set": rpc.NewRPCFunc(GetValidatorSetResult(network), "valsetID"),
"validator": rpc.NewRPCFunc(GetValidatorResult(network), "valSetID,valID"),
"status": rpc.NewRPCFunc(StatusResult(network), ""),
"blockchain": rpc.NewRPCFunc(GetChainResult(network), "chain"),
"register_chain": rpc.NewRPCFunc(RegisterChainResult(network), "chainConfig"),
"validator_set": rpc.NewRPCFunc(GetValidatorSetResult(network), "valsetID"),
"register_validator_set": rpc.NewRPCFunc(RegisterValidatorSetResult(network), "valSet"),
"validator": rpc.NewRPCFunc(GetValidatorResult(network), "valSetID,valID"),
"start_meter": rpc.NewRPCFunc(network.StartMeter, "chainID,valID,event"),
"stop_meter": rpc.NewRPCFunc(network.StopMeter, "chainID,valID,event"),
@ -47,6 +48,12 @@ func GetValidatorSetResult(network *TendermintNetwork) interface{} {
}
}
func RegisterValidatorSetResult(network *TendermintNetwork) interface{} {
return func(valSet *types.ValidatorSet) (NetMonResult, error) {
return network.RegisterValidatorSet(valSet)
}
}
func GetValidatorResult(network *TendermintNetwork) interface{} {
return func(valSetID, valID string) (NetMonResult, error) {
return network.GetValidator(valSetID, valID)