update change pool address send authorize info
This commit is contained in:
@@ -35,8 +35,8 @@ func NewMiner(coin string, poolAddress string, minerConn net.Conn) (*Miner, erro
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 动态切换矿池地址并建立新连接
|
||||
func (m *Miner) ChangePoolAddress(newAddress string) {
|
||||
// 动态切换矿池地址并建立新连接,切换时由proxy构造,由于每个池子的authorize认证不同,需单独处理
|
||||
func (m *Miner) ChangePoolAddress(newAddress string, authorizeMsg string) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
@@ -54,7 +54,7 @@ func (m *Miner) ChangePoolAddress(newAddress string) {
|
||||
|
||||
m.PoolConn = newConn
|
||||
m.PoolAddress = newAddress
|
||||
|
||||
m.PoolConn.Write([]byte(authorizeMsg + "\n")) // 发送认证信息
|
||||
fmt.Println("成功切换矿池地址为:", newAddress)
|
||||
}
|
||||
|
||||
@@ -78,10 +78,10 @@ func (m *Miner) HandleMinerMsg(ch chan string) {
|
||||
case "nexa":
|
||||
//
|
||||
default:
|
||||
var msg msg.Authorize_msg
|
||||
if err := json.Unmarshal([]byte(msgStr), &msg); err == nil &&
|
||||
msg.Method == "mining.authorize" && len(msg.Params) >= 1 && !sent {
|
||||
parts := strings.Split(msg.Params[0], ".")
|
||||
var _msg msg.Authorize_msg
|
||||
if err := json.Unmarshal([]byte(msgStr), &_msg); err == nil &&
|
||||
_msg.Method == "mining.authorize" && len(_msg.Params) >= 1 && !sent {
|
||||
parts := strings.Split(_msg.Params[0], ".")
|
||||
if len(parts) >= 2 {
|
||||
userSign := parts[0] + "-" + parts[1]
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user