create git
This commit is contained in:
85
internal/gbt/coin/coin.go
Normal file
85
internal/gbt/coin/coin.go
Normal file
@@ -0,0 +1,85 @@
|
||||
// coin.go
|
||||
package coin
|
||||
|
||||
import (
|
||||
"pool/internal/db"
|
||||
monero_rpc "pool/internal/gbt/monero/rpc"
|
||||
"pool/internal/gbt/tari"
|
||||
"pool/internal/utility"
|
||||
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/zeromq/goczmq"
|
||||
"go.uber.org/zap"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
)
|
||||
|
||||
type RpcConfig struct {
|
||||
Host string `json:"host"`
|
||||
Testnet string `json:"testnet"`
|
||||
Type string `json:"type"`
|
||||
User string `json:"user"`
|
||||
Pass string `json:"pass"`
|
||||
ZmqSub string `json:"zmqsub"`
|
||||
Timeout int `json:"timeout"`
|
||||
}
|
||||
|
||||
type ZmqConfig struct {
|
||||
Pub string `json:"pub"`
|
||||
Sub string `json:"sub"`
|
||||
}
|
||||
|
||||
type ProfitConfig struct {
|
||||
Push string `json:"push"`
|
||||
}
|
||||
|
||||
type GbtConfig struct {
|
||||
Rpc RpcConfig `json:"rpc"`
|
||||
Zmq ZmqConfig `json:"zmq"`
|
||||
Redis utility.RedisConfig `json:"redis"`
|
||||
Profit ProfitConfig `json:"profit"`
|
||||
Zaplog zap.Config `json:"zap"`
|
||||
Logrotae utility.LogRotateConfig `json:"logrotate"`
|
||||
}
|
||||
|
||||
type GbtContext struct {
|
||||
DbCtx *db.DbContext
|
||||
|
||||
NodeSubCh *goczmq.Sock
|
||||
|
||||
PubCh *goczmq.Sock
|
||||
SubCh *goczmq.Sock
|
||||
MoneroNewBlockPubCh *goczmq.Sock // monero gbt有新块产生时发送消息队列
|
||||
MoneroNewBlockSubCh *goczmq.Sock // 模仿自带zmq通知的币
|
||||
PushCh *goczmq.Sock
|
||||
|
||||
Started bool
|
||||
Config GbtConfig
|
||||
Client *rpcclient.Client
|
||||
MoneroClinet *monero_rpc.HttpClient
|
||||
TariClient *tari.BaseNodeClient
|
||||
MoneroAddr string // monero报块地址
|
||||
TariAddr string // tari报块地址
|
||||
ExitNotifyChan chan bool
|
||||
ExitGbtChan chan bool
|
||||
ExitBlockChan chan bool
|
||||
|
||||
//AlivingChan chan bool
|
||||
FlagAliving int32
|
||||
FlagAlivingExit int32
|
||||
|
||||
Log *zap.Logger
|
||||
LogR *lumberjack.Logger
|
||||
|
||||
RedisClient *redis.Client
|
||||
|
||||
Coin string
|
||||
|
||||
MinerAddrs []string
|
||||
MinerAddrIndex int
|
||||
|
||||
/*Blocks int64
|
||||
|
||||
Reward float64
|
||||
Fee float64*/
|
||||
}
|
||||
Reference in New Issue
Block a user