diff --git a/README.md b/README.md index f5221af..52548db 100644 --- a/README.md +++ b/README.md @@ -263,4 +263,20 @@ json { }, "id": 1 } +``` + +### xdag_poolVersion +#### request +``` +curl http://127.0.0.1:8082/api -s -X POST -H "Content-Type: application/json" --data +'{"jsonrpc":"2.0","method":"xdag_poolVersion","params":[""],"id":1}' +``` + +#### response +``` +json { + "jsonrpc": "2.0", + "result": "0.1.0", + "id": 1 +} ``` \ No newline at end of file diff --git a/main.go b/main.go index 5f3f668..bce9339 100644 --- a/main.go +++ b/main.go @@ -126,6 +126,7 @@ func startFrontend(cfg *pool.Config, s *stratum.StratumServer) { apiServer.Add("xdag_minerAccount", s.XdagMinerAccount) apiServer.Add("xdag_minerHashrate", s.XdagMinerHashrate) apiServer.Add("xdag_poolHashrate", s.XdagPoolHashrate) + apiServer.Add("xdag_poolVersion", s.XdagPoolVersion) err := apiServer.Run(cfg.Frontend.Listen) if err != nil { diff --git a/pool/pool.go b/pool/pool.go index ed75aa6..11f0564 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -5,6 +5,7 @@ import ( "sync" ) +const Version = "0.1.0" const PoolKey = "" // it can make pool boot/reboot without interfering. type StorageConfig struct { diff --git a/stratum/api.go b/stratum/api.go index 5b62c8d..7df1118 100644 --- a/stratum/api.go +++ b/stratum/api.go @@ -11,6 +11,7 @@ import ( "time" "github.com/XDagger/xdagpool/jrpc" + "github.com/XDagger/xdagpool/pool" "github.com/XDagger/xdagpool/util" "github.com/XDagger/xdagpool/ws" "github.com/gorilla/mux" @@ -1031,3 +1032,7 @@ func (s *StratumServer) XdagPoolHashrate(id uint64, params json.RawMessage) jrpc TotalOnline: totalOnline, }, nil) } + +func (s *StratumServer) XdagPoolVersion(id uint64, params json.RawMessage) jrpc.Response { + return jrpc.EncodeResponse(id, pool.Version, nil) +}