Browse Source

login wallet.worker and ping speed miners

master
yuriy0803 3 years ago
parent
commit
4332b9b14e
  1. 14
      proxy/handlers.go
  2. 4
      proxy/miner.go
  3. 1
      proxy/proxy.go
  4. 4
      proxy/stratum.go
  5. 3
      www/app/controllers/account/payouts.js
  6. 1
      www/config/environment.js

14
proxy/handlers.go

@ -1,6 +1,7 @@
package proxy
import (
"errors"
"log"
"regexp"
"strings"
@ -21,6 +22,8 @@ func (s *ProxyServer) handleLoginRPC(cs *Session, params []string, id string) (b
}
login := strings.ToLower(params[0])
login = strings.Split(login, ".")[0]
if !util.IsValidHexAddress(login) {
return false, &ErrorReply{Code: -1, Message: "Invalid login"}
}
@ -68,22 +71,22 @@ func (s *ProxyServer) handleSubmitRPC(cs *Session, login, id string, params []st
log.Printf("Malformed PoW result from %s@%s %v", login, cs.ip, params)
return false, &ErrorReply{Code: -1, Message: "Malformed PoW result"}
}
go func(s *ProxyServer, cs *Session, login, id string, params []string) {
t := s.currentBlockTemplate()
exist, validShare := s.processShare(login, id, cs.ip, t, params)
ok := s.policy.ApplySharePolicy(cs.ip, !exist && validShare)
if exist {
log.Printf("Duplicate share from %s@%s %v", login, cs.ip, params)
return false, &ErrorReply{Code: 22, Message: "Duplicate share"}
cs.lastErr = errors.New("Duplicate share")
}
if !validShare {
log.Printf("Invalid share from %s@%s", login, cs.ip)
// Bad shares limit reached, return error and close
if !ok {
return false, &ErrorReply{Code: 23, Message: "Invalid share"}
cs.lastErr = errors.New("Invalid share")
}
return false, nil
}
if s.config.Proxy.Debug {
@ -91,10 +94,13 @@ func (s *ProxyServer) handleSubmitRPC(cs *Session, login, id string, params []st
}
if !ok {
return true, &ErrorReply{Code: -1, Message: "High rate of invalid shares"}
cs.lastErr = errors.New("High rate of invalid shares")
}
}(s, cs, login, id, params)
return true, nil
}
func (s *ProxyServer) handleGetBlockByNumberRPC() *rpc.GetBlockReplyPart {
t := s.currentBlockTemplate()
var reply *rpc.GetBlockReplyPart

4
proxy/miner.go

@ -6,8 +6,8 @@ import (
"strconv"
"strings"
"github.com/yuriy0803/poolhash"
"github.com/ethereum/go-ethereum/common"
"github.com/yuriy0803/etchash"
)
var (
@ -19,6 +19,7 @@ var (
)
func (s *ProxyServer) processShare(login, id, ip string, t *BlockTemplate, params []string) (bool, bool) {
if hasher == nil {
if s.config.Network == "classic" {
hasher = etchash.New(&ecip1099FBlockClassic, nil)
@ -34,6 +35,7 @@ func (s *ProxyServer) processShare(login, id, ip string, t *BlockTemplate, param
return false, false
}
}
nonceHex := params[0]
hashNoNonce := params[1]
mixDigest := params[2]

1
proxy/proxy.go

@ -45,6 +45,7 @@ type Session struct {
sync.Mutex
conn net.Conn
login string
lastErr error
}
func NewProxy(cfg *Config, backend *storage.RedisClient) *ProxyServer {

4
proxy/stratum.go

@ -66,7 +66,7 @@ func (s *ProxyServer) ListenTCP() {
accept <- n
go func(cs *Session) {
err = s.handleTCPClient(cs)
if err != nil {
if err != nil || cs.lastErr != nil {
s.removeSession(cs)
conn.Close()
}
@ -222,7 +222,7 @@ func (s *ProxyServer) broadcastNewJobs() {
go func(cs *Session) {
err := cs.pushNewJob(&reply)
<-bcast
if err != nil {
if err != nil || cs.lastErr != nil {
log.Printf("Job transmit error to %v@%v: %v", cs.login, cs.ip, err)
s.removeSession(cs)
} else {

3
www/app/controllers/account/payouts.js

@ -3,6 +3,7 @@ import Ember from 'ember';
export default Ember.Controller.extend({
applicationController: Ember.inject.controller('application'),
stats: Ember.computed.reads('applicationController.model.stats'),
config: Ember.computed.reads('applicationController.config'),
intl: Ember.inject.service(),
chartPaymentText: Ember.computed('model', {
@ -64,7 +65,7 @@ export default Ember.Controller.extend({
},
tooltip: {
formatter: function() {
return "<b>" + Highcharts.dateFormat('%Y-%m-%d', new Date(this.x)) + "<b><br>Payment&nbsp;<b>" + this.y.toFixed(8) + "&nbsp;ESN</b>";
return "<b>" + Highcharts.dateFormat('%d-%m-%Y', new Date(this.x)) + "<b><br>Payment&nbsp;<b>" + this.y.toFixed(8) + "<b><br>" + e.get('config.Unit');
},
useHTML: true
},

1
www/config/environment.js

@ -27,6 +27,7 @@ module.exports = function(environment) {
// The ETC network used (classic, mordor)
Network: 'classic',
Unit: 'ETC',
// Fee and payout details
PoolFee: '1%',

Loading…
Cancel
Save