Browse Source

update

master
yuriy0803 3 years ago
parent
commit
c549c10c54
  1. 9
      README.md
  2. 9
      api.json
  3. 2
      docs/PAYOUTS.md
  4. 51
      payouts.json
  5. 18
      storage/redis.go

9
README.md

@ -264,7 +264,14 @@ otherwise you will get errors on start because of JSON comments.**
"endpoint": "127.0.0.1:6379", "endpoint": "127.0.0.1:6379",
"poolSize": 10, "poolSize": 10,
"database": 0, "database": 0,
"password": "" "password": "",
"sentinelEnabled": false,
"masterName": "mymaster",
"sentinelAddrs": [
"127.0.0.1:26379",
"127.0.0.1:26389",
"127.0.0.1:26399"
]
}, },
"exchange": { "exchange": {

9
api.json

@ -93,7 +93,14 @@
"endpoint": "127.0.0.1:6379", "endpoint": "127.0.0.1:6379",
"poolSize": 10, "poolSize": 10,
"database": 0, "database": 0,
"password": "" "password": "",
"sentinelEnabled": false,
"masterName": "mymaster",
"sentinelAddrs": [
"127.0.0.1:26379",
"127.0.0.1:26389",
"127.0.0.1:26399"
]
}, },
"exchange": { "exchange": {

2
docs/PAYOUTS.md

@ -38,7 +38,7 @@ After payout session, payment module will perform `BGSAVE` (background saving) o
If your payout is not logged and not confirmed by Ethereum network you can resolve it automatically. You need to payouts in maintenance mode by setting up `RESOLVE_PAYOUT=1` or `RESOLVE_PAYOUT=True` environment variable: If your payout is not logged and not confirmed by Ethereum network you can resolve it automatically. You need to payouts in maintenance mode by setting up `RESOLVE_PAYOUT=1` or `RESOLVE_PAYOUT=True` environment variable:
`RESOLVE_PAYOUT=1 ./build/bin/open-etc-pool-friends api.json`. `RESOLVE_PAYOUT=1 ./build/bin/open-etc-pool-friends payouts.json`.
Payout module will fetch all rows from Redis with key `eth:payments:pending` and credit balance back to miners. Usually you will have only single entry there. Payout module will fetch all rows from Redis with key `eth:payments:pending` and credit balance back to miners. Usually you will have only single entry there.

51
payouts.json

@ -0,0 +1,51 @@
{
"threads": 4,
"coin": "etc",
"name": "main",
"pplns": 9000,
"network": "classic",
"coin-name":"etc",
"payouts": {
"enabled": true,
"requirePeers": 1,
"interval": "20m",
"daemon": "http://127.0.0.1:8545",
"timeout": "10s",
"address": "0xd92fa5a9732a0aec36dc8d5a6a1305dc2d3e09e6",
"gas": "21000",
"gasPrice": "50000000000",
"maxPriorityFee": "2000000000",
"autoGas": true,
"threshold": 500000000,
"bgsave": false,
"concurrentTx": 10
},
"upstreamCheckInterval": "5s",
"upstream": [
{
"name": "main",
"url": "http://127.0.0.1:8545",
"timeout": "10s"
}
],
"redis": {
"endpoint": "127.0.0.1:6379",
"poolSize": 10,
"database": 0,
"password": "",
"sentinelEnabled": false,
"masterName": "mymaster",
"sentinelAddrs": [
"127.0.0.1:26379",
"127.0.0.1:26389",
"127.0.0.1:26399"
]
}
}

18
storage/redis.go

@ -16,10 +16,13 @@ import (
) )
type Config struct { type Config struct {
SentinelEnabled bool `json:"sentinelEnabled"`
Endpoint string `json:"endpoint"` Endpoint string `json:"endpoint"`
Password string `json:"password"` Password string `json:"password"`
Database int64 `json:"database"` Database int64 `json:"database"`
PoolSize int `json:"poolSize"` PoolSize int `json:"poolSize"`
MasterName string `json:"masterName"`
SentinelAddrs []string `json:"sentinelAddrs"`
} }
type RedisClient struct { type RedisClient struct {
@ -156,12 +159,25 @@ type Worker struct {
} }
func NewRedisClient(cfg *Config, prefix string, pplns int64, CoinName string) *RedisClient { func NewRedisClient(cfg *Config, prefix string, pplns int64, CoinName string) *RedisClient {
client := redis.NewClient(&redis.Options{ var client *redis.Client
if cfg.SentinelEnabled && len(cfg.MasterName) != 0 && len(cfg.SentinelAddrs) != 0 {
// sentinel mode
client = redis.NewFailoverClient(&redis.FailoverOptions{
MasterName: cfg.MasterName,
SentinelAddrs: cfg.SentinelAddrs,
Password: cfg.Password,
DB: cfg.Database,
PoolSize: cfg.PoolSize,
})
} else {
// single instance
client = redis.NewClient(&redis.Options{
Addr: cfg.Endpoint, Addr: cfg.Endpoint,
Password: cfg.Password, Password: cfg.Password,
DB: cfg.Database, DB: cfg.Database,
PoolSize: cfg.PoolSize, PoolSize: cfg.PoolSize,
}) })
}
return &RedisClient{client: client, prefix: prefix, pplns: pplns, CoinName: CoinName} return &RedisClient{client: client, prefix: prefix, pplns: pplns, CoinName: CoinName}
} }

Loading…
Cancel
Save