mirror of
https://github.com/kvazar-network/keva-stratum.git
synced 2025-01-13 00:27:54 +00:00
Add 'keepalived' stratum method
This commit is contained in:
parent
bf0ffb035f
commit
eac8eb0228
@ -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
|
||||
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 {
|
||||
|
@ -50,7 +50,7 @@ type JobReplyData struct {
|
||||
Target string `json:"target"`
|
||||
}
|
||||
|
||||
type SubmitReply struct {
|
||||
type StatusReply struct {
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
|
@ -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…
Reference in New Issue
Block a user