Browse Source

zilliqa switch hmm?

master
yuriy0803 2 years ago
parent
commit
f4d5d4eb34
  1. 7
      proxy/proto.go
  2. 22
      proxy/stratum.go

7
proxy/proto.go

@ -44,3 +44,10 @@ type ErrorReply struct {
Code int `json:"code"` Code int `json:"code"`
Message string `json:"message"` Message string `json:"message"`
} }
// Definiere den Typ JSONStratumResult
type JSONStratumResult struct {
Id interface{} `json:"id"`
Result interface{} `json:"result,omitempty"`
Error interface{} `json:"error,omitempty"`
}

22
proxy/stratum.go

@ -156,7 +156,29 @@ func (cs *Session) handleTCPMessage(s *ProxyServer, req *StratumReq) error {
cs.setStratumMode("EthProxy") cs.setStratumMode("EthProxy")
log.Println("EthProxy login", cs.ip) log.Println("EthProxy login", cs.ip)
return cs.sendTCPResult(req.Id, reply) return cs.sendTCPResult(req.Id, reply)
case "zilliqa switch":
// Setze den Stratum-Modus auf "Zilliqa"
cs.setStratumMode("Zilliqa")
// Bestätige die Umschaltung an den Client
confirmationMessage := JSONStratumResult{
Id: req.Id,
Result: "Stratum mode switched to Zilliqa. Currently no ZIL work available.",
}
err := cs.sendTCPResult(req.Id, confirmationMessage)
if err != nil {
return err
}
// Senden einer Meldung an den Client, dass keine ZIL-Arbeit verfügbar ist
noZILWorkMessage := JSONStratumResult{
Id: req.Id,
Result: "No ZIL work available at the moment.",
}
err = cs.sendTCPResult(req.Id, noZILWorkMessage)
if err != nil {
return err
}
case "mining.subscribe": case "mining.subscribe":
var params []string var params []string
err := json.Unmarshal(req.Params, &params) err := json.Unmarshal(req.Params, &params)

Loading…
Cancel
Save