Browse Source

Add 'keepalived' stratum method

pool
Sammy Libre 7 years ago
parent
commit
eac8eb0228
  1. 4
      stratum/handlers.go
  2. 2
      stratum/proto.go
  3. 2
      stratum/stratum.go

4
stratum/handlers.go

@ -56,7 +56,7 @@ func (s *StratumServer) handleGetJobRPC(cs *Session, params *GetJobParams) (*Job @@ -56,7 +56,7 @@ func (s *StratumServer) handleGetJobRPC(cs *Session, params *GetJobParams) (*Job
return cs.getJob(t), nil
}
func (s *StratumServer) handleSubmitRPC(cs *Session, params *SubmitParams) (*SubmitReply, *ErrorReply) {
func (s *StratumServer) handleSubmitRPC(cs *Session, params *SubmitParams) (*StatusReply, *ErrorReply) {
miner, ok := s.miners.Get(params.Id)
if !ok {
return nil, &ErrorReply{Code: -1, Message: "Unauthenticated"}
@ -89,7 +89,7 @@ func (s *StratumServer) handleSubmitRPC(cs *Session, params *SubmitParams) (*Sub @@ -89,7 +89,7 @@ func (s *StratumServer) handleSubmitRPC(cs *Session, params *SubmitParams) (*Sub
if !validShare {
return nil, &ErrorReply{Code: -1, Message: "Low difficulty share"}
}
return &SubmitReply{Status: "OK"}, nil
return &StatusReply{Status: "OK"}, nil
}
func (s *StratumServer) handleUnknownRPC(req *JSONRpcReq) *ErrorReply {

2
stratum/proto.go

@ -50,7 +50,7 @@ type JobReplyData struct { @@ -50,7 +50,7 @@ type JobReplyData struct {
Target string `json:"target"`
}
type SubmitReply struct {
type StatusReply struct {
Status string `json:"status"`
}

2
stratum/stratum.go

@ -267,6 +267,8 @@ func (cs *Session) handleMessage(s *StratumServer, e *Endpoint, req *JSONRpcReq) @@ -267,6 +267,8 @@ func (cs *Session) handleMessage(s *StratumServer, e *Endpoint, req *JSONRpcReq)
return cs.sendError(req.Id, errReply, false)
}
return cs.sendResult(req.Id, &reply)
case "keepalived":
return cs.sendResult(req.Id, &StatusReply{Status: "KEEPALIVED"})
default:
errReply := s.handleUnknownRPC(req)
return cs.sendError(req.Id, errReply, true)

Loading…
Cancel
Save