Documentation ¶
Overview ¶
Many api integration functions and ideas from: https://github.com/JKKGBE/open-zcash-pool which is a fork of https://github.com/sammy007/open-ethereum-pool
Generated from https://github.com/streamrail/concurrent-map
Some payments integration functions and ideas from: https://github.com/JKKGBE/open-zcash-pool which is a fork of https://github.com/sammy007/open-ethereum-pool
Some struct integrations and ideas from: https://github.com/JKKGBE/open-zcash-pool which is a fork of https://github.com/sammy007/open-ethereum-pool
Many unlocker integration functions and ideas from: https://github.com/JKKGBE/open-zcash-pool which is a fork of https://github.com/sammy007/open-ethereum-pool
Index ¶
- Constants
- Variables
- type ApiBlocks
- type ApiEventPayments
- type ApiMiner
- type ApiPayments
- type ApiServer
- func (apiServer *ApiServer) AccountIndex(writer http.ResponseWriter, r *http.Request)
- func (apiServer *ApiServer) BlocksIndex(writer http.ResponseWriter, _ *http.Request)
- func (apiServer *ApiServer) ChartsIndex(writer http.ResponseWriter, _ *http.Request)
- func (apiServer *ApiServer) EventsIndex(writer http.ResponseWriter, _ *http.Request)
- func (apiServer *ApiServer) GetConfigIndex() map[string]interface{}
- func (apiServer *ApiServer) MinersIndex(writer http.ResponseWriter, _ *http.Request)
- func (apiServer *ApiServer) PaymentsIndex(writer http.ResponseWriter, _ *http.Request)
- func (apiServer *ApiServer) Start()
- func (apiServer *ApiServer) StatsIndex(writer http.ResponseWriter, _ *http.Request)
- type BlockDataGrav
- type BlockTemplate
- type BlockUnlocker
- type BlocksFound
- type BlocksFoundByHeight
- type ChartData
- type Charts
- type Endpoint
- type ErrorReply
- type EventData
- type Events
- type GetJobParams
- type GravitonCharts
- type GravitonMiners
- type GravitonStore
- func (g *GravitonStore) CompareMinerStats(storedMiner, miner *Miner, hashrateExpiration time.Duration) (*Miner, bool)
- func (g *GravitonStore) GetAllMinerStats() []*Miner
- func (g *GravitonStore) GetBlocksFound(blocktype string) *BlocksFound
- func (g *GravitonStore) GetBlocksFoundByHeightArr() *BlocksFoundByHeight
- func (g *GravitonStore) GetChartsData(chartType string) *GravitonCharts
- func (g *GravitonStore) GetConfig(coin string) *pool.Config
- func (g *GravitonStore) GetEventsData(date string) map[string]*Miner
- func (g *GravitonStore) GetEventsPayment(date string) *PaymentPending
- func (g *GravitonStore) GetMinerIDRegistrations() []*Miner
- func (g *GravitonStore) GetMinerStatsByID(minerID string) *Miner
- func (g *GravitonStore) GetPendingPayments() []*PaymentPending
- func (g *GravitonStore) GetPoolRoundStats() *PoolRound
- func (g *GravitonStore) GetProcessedPayments() *ProcessedPayments
- func (g *GravitonStore) GetRoundShares(roundHeight int64) (map[string]int64, int64, error)
- func (g *GravitonStore) NewGravDB(poolhost, dbFolder, dbmigratewait string, dbmaxsnapshot uint64)
- func (g *GravitonStore) OverwriteEventsData(info map[string]*Miner, date string) error
- func (g *GravitonStore) OverwritePendingPayments(info *PendingPayments) error
- func (g *GravitonStore) OverwritePoolRoundStats(info *PoolRound) error
- func (g *GravitonStore) RemoveKey(key string) error
- func (g *GravitonStore) SwapGravDB(poolhost, dbFolder string)
- func (g *GravitonStore) UpdatePoolRoundStats(miners MinersMap, blockFound bool) error
- func (g *GravitonStore) WriteBlocks(info *BlockDataGrav, blockType string) error
- func (g *GravitonStore) WriteBlocksFoundByHeightArr(height int64, isSolo bool) error
- func (g *GravitonStore) WriteChartsData(data *ChartData, chartType string, interval, maximumPeriod int64) error
- func (g *GravitonStore) WriteConfig(config *pool.Config) error
- func (g *GravitonStore) WriteEventsPayment(payment *PaymentPending, date string) error
- func (g *GravitonStore) WriteImmatureBlock(block *BlockDataGrav) error
- func (g *GravitonStore) WriteImmaturePayments(info *PaymentPending) error
- func (g *GravitonStore) WriteMaturedBlocks(block *BlockDataGrav) error
- func (g *GravitonStore) WriteMinerIDRegistration(miner *Miner) error
- func (g *GravitonStore) WriteMinerStats(miners MinersMap, hashrateExpiration time.Duration) error
- func (g *GravitonStore) WriteMinerStatsByID(miner *Miner, hashrateExpiration time.Duration) error
- func (g *GravitonStore) WriteOrphanedBlocks(orphanedBlocks []*BlockDataGrav) error
- func (g *GravitonStore) WritePendingPayments(info *PaymentPending) error
- func (g *GravitonStore) WriteProcessedPayments(info *MinerPayments) error
- func (g *GravitonStore) WriteRoundShares(roundHeight int64, roundShares map[string]int64) error
- type JSONPushMessage
- type JSONRpcReq
- type JSONRpcResp
- type Job
- type JobReply
- type JobReplyData
- type LastBlock
- type LoginParams
- type Miner
- type MinerPayments
- type MinerStats
- type MinersMap
- type MinersMapShared
- type MiningShare
- type PaymentPending
- type PayoutTracker
- type PayoutsProcessor
- type PendingPayments
- type PoolRound
- type ProcessedPayments
- type RandomRewardEventDays
- type RandomRewardEventMiners
- type Session
- type StatusReply
- type StratumServer
- type SubmitParams
- type TreeKV
- type UnlockResultGrav
- type VarDiff
Constants ¶
const MINER_TX_AMOUNT_UNLOCK = config.MINER_TX_AMOUNT_UNLOCK
Get constant blocks required to mature from derosuite
const (
MaxReqSize = 10 * 1024
)
Variables ¶
var APIErrorLogger = logFileOutAPI("ERROR")
var APIInfoLogger = logFileOutAPI("INFO")
var BlocksErrorLogger = logFileOutBlocks("ERROR")
var BlocksInfoLogger = logFileOutBlocks("INFO")
var ChartsErrorLogger = logFileOutCharts("ERROR")
var ChartsInfoLogger = logFileOutCharts("INFO")
var EventsErrorLogger = logFileOutEvents("ERROR")
var EventsInfoLogger = logFileOutEvents("INFO")
var HandlersErrorLogger = logFileOutHandlers("ERROR")
var HandlersInfoLogger = logFileOutHandlers("INFO")
var MinerErrorLogger = logFileOutMiner("ERROR")
var MinerInfoLogger = logFileOutMiner("INFO")
var PaymentsErrorLogger = logFileOutPayments("ERROR")
var PaymentsInfoLogger = logFileOutPayments("INFO")
var SHARD_COUNT = 32
var StorageErrorLogger = logFileOutStorage("ERROR")
var StorageInfoLogger = logFileOutStorage("INFO")
var StratumErrorLogger = logFileOutStratum("ERROR")
var StratumInfoLogger = logFileOutStratum("INFO")
var UnlockerErrorLogger = logFileOutUnlocker("ERROR")
var UnlockerInfoLogger = logFileOutUnlocker("INFO")
Functions ¶
This section is empty.
Types ¶
type ApiEventPayments ¶
type ApiPayments ¶
type ApiServer ¶
type ApiServer struct {
// contains filtered or unexported fields
}
func NewApiServer ¶
func NewApiServer(cfg *pool.APIConfig, s *StratumServer, eventsconfig *pool.EventsConfig) *ApiServer
func (*ApiServer) AccountIndex ¶
func (apiServer *ApiServer) AccountIndex(writer http.ResponseWriter, r *http.Request)
func (*ApiServer) BlocksIndex ¶
func (apiServer *ApiServer) BlocksIndex(writer http.ResponseWriter, _ *http.Request)
func (*ApiServer) ChartsIndex ¶
func (apiServer *ApiServer) ChartsIndex(writer http.ResponseWriter, _ *http.Request)
func (*ApiServer) EventsIndex ¶
func (apiServer *ApiServer) EventsIndex(writer http.ResponseWriter, _ *http.Request)
func (*ApiServer) GetConfigIndex ¶
func (*ApiServer) MinersIndex ¶
func (apiServer *ApiServer) MinersIndex(writer http.ResponseWriter, _ *http.Request)
func (*ApiServer) PaymentsIndex ¶
func (apiServer *ApiServer) PaymentsIndex(writer http.ResponseWriter, _ *http.Request)
func (*ApiServer) StatsIndex ¶
func (apiServer *ApiServer) StatsIndex(writer http.ResponseWriter, _ *http.Request)
type BlockDataGrav ¶
type BlockDataGrav struct { Height int64 Timestamp int64 Difficulty int64 Orphan bool Solo bool Hash string Address string Nonce string PowHash string Reward uint64 ExtraReward *big.Int RoundHeight int64 BlockState string }
func (*BlockDataGrav) RoundKey ¶
func (blockDataGrav *BlockDataGrav) RoundKey() string
type BlockTemplate ¶
type BlockUnlocker ¶
type BlockUnlocker struct {
// contains filtered or unexported fields
}
func NewBlockUnlocker ¶
func NewBlockUnlocker(cfg *pool.UnlockerConfig, s *StratumServer) *BlockUnlocker
func (*BlockUnlocker) StartBlockUnlocker ¶
func (u *BlockUnlocker) StartBlockUnlocker(s *StratumServer)
type BlocksFound ¶
type BlocksFound struct {
MinedBlocks []*BlockDataGrav
}
type BlocksFoundByHeight ¶
type Charts ¶
type Charts struct { PoolChartsConfig *pool.PoolChartsConfig SoloChartsConfig *pool.SoloChartsConfig Api *ApiServer }
func NewChartsProcessor ¶
func NewChartsProcessor(pcfg *pool.PoolChartsConfig, scfg *pool.SoloChartsConfig, a *ApiServer) *Charts
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func NewEndpoint ¶
Defines parameters for the ports to be listened on, such as default difficulty
func (*Endpoint) Listen ¶
func (e *Endpoint) Listen(s *StratumServer)
Starts listening on the ports defined in s.Listen()
type ErrorReply ¶
type Events ¶
type Events struct { EventsConfig *pool.EventsConfig CoinUnits int64 }
func NewEventsProcessor ¶
func NewEventsProcessor(eventsconfig *pool.EventsConfig, coinunits int64) *Events
type GetJobParams ¶
type GetJobParams struct {
Id string `json:"id"`
}
type GravitonCharts ¶
type GravitonCharts struct {
Values []*ChartData
}
type GravitonMiners ¶
type GravitonMiners struct {
Miners []*Miner
}
type GravitonStore ¶
type GravitonStore struct { DB *graviton.Store DBFolder string DBPath string DBTree string DBMaxSnapshot uint64 DBMigrateWait time.Duration Writing int // contains filtered or unexported fields }
var Graviton_backend *GravitonStore = &GravitonStore{}
func (*GravitonStore) CompareMinerStats ¶
func (*GravitonStore) GetAllMinerStats ¶
func (g *GravitonStore) GetAllMinerStats() []*Miner
func (*GravitonStore) GetBlocksFound ¶
func (g *GravitonStore) GetBlocksFound(blocktype string) *BlocksFound
Allow for getting the blocks found by pool/solo. blocktype: orphaned, candidate, immature, matured or specify all for returning all blocks
func (*GravitonStore) GetBlocksFoundByHeightArr ¶
func (g *GravitonStore) GetBlocksFoundByHeightArr() *BlocksFoundByHeight
func (*GravitonStore) GetChartsData ¶
func (g *GravitonStore) GetChartsData(chartType string) *GravitonCharts
func (*GravitonStore) GetEventsData ¶
func (g *GravitonStore) GetEventsData(date string) map[string]*Miner
func (*GravitonStore) GetEventsPayment ¶
func (g *GravitonStore) GetEventsPayment(date string) *PaymentPending
func (*GravitonStore) GetMinerIDRegistrations ¶
func (g *GravitonStore) GetMinerIDRegistrations() []*Miner
func (*GravitonStore) GetMinerStatsByID ¶
func (g *GravitonStore) GetMinerStatsByID(minerID string) *Miner
func (*GravitonStore) GetPendingPayments ¶
func (g *GravitonStore) GetPendingPayments() []*PaymentPending
func (*GravitonStore) GetPoolRoundStats ¶
func (g *GravitonStore) GetPoolRoundStats() *PoolRound
func (*GravitonStore) GetProcessedPayments ¶
func (g *GravitonStore) GetProcessedPayments() *ProcessedPayments
func (*GravitonStore) GetRoundShares ¶
func (*GravitonStore) NewGravDB ¶
func (g *GravitonStore) NewGravDB(poolhost, dbFolder, dbmigratewait string, dbmaxsnapshot uint64)
func (*GravitonStore) OverwriteEventsData ¶
func (g *GravitonStore) OverwriteEventsData(info map[string]*Miner, date string) error
This function is to overwrite events data
func (*GravitonStore) OverwritePendingPayments ¶
func (g *GravitonStore) OverwritePendingPayments(info *PendingPayments) error
This function is to overwrite pending payments in the event of 'deleting' a pending payment after payment has been processed
func (*GravitonStore) OverwritePoolRoundStats ¶
func (g *GravitonStore) OverwritePoolRoundStats(info *PoolRound) error
This function is to overwrite pool round stats which will retain *current* pool round details and updated to blank out at each new round / nextRound storage function
func (*GravitonStore) RemoveKey ¶
func (g *GravitonStore) RemoveKey(key string) error
Function that will remove a k/v pair
func (*GravitonStore) SwapGravDB ¶
func (g *GravitonStore) SwapGravDB(poolhost, dbFolder string)
Swaps the store pointer from existing to new after copying latest snapshot to new DB - fast as cursor + disk writes allow [possible other alternatives such as mem store for some of these interwoven, testing needed]
func (*GravitonStore) UpdatePoolRoundStats ¶
func (g *GravitonStore) UpdatePoolRoundStats(miners MinersMap, blockFound bool) error
func (*GravitonStore) WriteBlocks ¶
func (g *GravitonStore) WriteBlocks(info *BlockDataGrav, blockType string) error
func (*GravitonStore) WriteBlocksFoundByHeightArr ¶
func (g *GravitonStore) WriteBlocksFoundByHeightArr(height int64, isSolo bool) error
Array of int64 [heights] of blocks found by pool, this does not include solo blocks found. Used as reference points for round hash calculations
func (*GravitonStore) WriteChartsData ¶
func (g *GravitonStore) WriteChartsData(data *ChartData, chartType string, interval, maximumPeriod int64) error
func (*GravitonStore) WriteConfig ¶
func (g *GravitonStore) WriteConfig(config *pool.Config) error
func (*GravitonStore) WriteEventsPayment ¶
func (g *GravitonStore) WriteEventsPayment(payment *PaymentPending, date string) error
func (*GravitonStore) WriteImmatureBlock ¶
func (g *GravitonStore) WriteImmatureBlock(block *BlockDataGrav) error
func (*GravitonStore) WriteImmaturePayments ¶
func (g *GravitonStore) WriteImmaturePayments(info *PaymentPending) error
func (*GravitonStore) WriteMaturedBlocks ¶
func (g *GravitonStore) WriteMaturedBlocks(block *BlockDataGrav) error
func (*GravitonStore) WriteMinerIDRegistration ¶
func (g *GravitonStore) WriteMinerIDRegistration(miner *Miner) error
func (*GravitonStore) WriteMinerStats ¶
func (g *GravitonStore) WriteMinerStats(miners MinersMap, hashrateExpiration time.Duration) error
func (*GravitonStore) WriteMinerStatsByID ¶
func (g *GravitonStore) WriteMinerStatsByID(miner *Miner, hashrateExpiration time.Duration) error
func (*GravitonStore) WriteOrphanedBlocks ¶
func (g *GravitonStore) WriteOrphanedBlocks(orphanedBlocks []*BlockDataGrav) error
func (*GravitonStore) WritePendingPayments ¶
func (g *GravitonStore) WritePendingPayments(info *PaymentPending) error
func (*GravitonStore) WriteProcessedPayments ¶
func (g *GravitonStore) WriteProcessedPayments(info *MinerPayments) error
func (*GravitonStore) WriteRoundShares ¶
func (g *GravitonStore) WriteRoundShares(roundHeight int64, roundShares map[string]int64) error
type JSONPushMessage ¶
type JSONRpcReq ¶
type JSONRpcReq struct { Id *json.RawMessage `json:"id"` Method string `json:"method"` Params *json.RawMessage `json:"params"` }
type JSONRpcResp ¶
type JSONRpcResp struct { Id *json.RawMessage `json:"id"` Version string `json:"jsonrpc"` Result interface{} `json:"result"` Error interface{} `json:"error"` }
type JobReply ¶
type JobReply struct { Id string `json:"id"` Job *JobReplyData `json:"job"` Status string `json:"status"` }
type JobReplyData ¶
type LoginParams ¶
type Miner ¶
type Miner struct { LastBeat int64 StartedAt int64 EventDataOffset int64 //EventDataTempTime int64 Accepts int64 Rejects int64 RoundHeight int64 Hashrate int64 Offline bool sync.RWMutex Id string Address string PaymentID string FixedDiff uint64 IsSolo bool WorkID string Ip string DonatePercent int64 DonationTotal int64 }
type MinerPayments ¶
type MinerStats ¶
type MinersMap ¶
type MinersMap []*MinersMapShared
A "thread" safe map of type string:*Miner. To avoid lock bottlenecks this map is dived to several (SHARD_COUNT) map shards.
func (MinersMap) GetShard ¶
func (m MinersMap) GetShard(key string) *MinersMapShared
Returns shard under given key
type MinersMapShared ¶
type MinersMapShared struct {}
type MiningShare ¶
type MiningShare struct {}
type PaymentPending ¶
type PayoutTracker ¶
type PayoutTracker struct { Destinations []rpc.Destinations PaymentIDs []string }
type PayoutsProcessor ¶
type PayoutsProcessor struct {
// contains filtered or unexported fields
}
func NewPayoutsProcessor ¶
func NewPayoutsProcessor(cfg *pool.PaymentsConfig, s *StratumServer) *PayoutsProcessor
func (*PayoutsProcessor) Start ¶
func (u *PayoutsProcessor) Start(s *StratumServer)
type PendingPayments ¶
type PendingPayments struct {
PendingPayout []*PaymentPending
}
type ProcessedPayments ¶
type ProcessedPayments struct {
MinerPayments []*MinerPayments
}
type RandomRewardEventDays ¶
type RandomRewardEventDays struct {
EventDayDetails map[int64]*RandomRewardEventMiners
}
type RandomRewardEventMiners ¶
type StatusReply ¶
type StratumServer ¶
type StratumServer struct {
// contains filtered or unexported fields
}
func NewStratum ¶
func NewStratum(cfg *pool.Config) *StratumServer
func (*StratumServer) Listen ¶
func (s *StratumServer) Listen()
Sets up stratum to listen on the ports in config.json
func (*StratumServer) SetupCloseHandler ¶
func (s *StratumServer) SetupCloseHandler()
SetupCloseHandler creates a 'listener' on a new goroutine which will notify the program if it receives an interrupt from the OS. We then handle this by calling our clean up procedure and exiting the program. Reference: https://golangcode.com/handle-ctrl-c-exit-in-terminal/
type SubmitParams ¶
type UnlockResultGrav ¶
type UnlockResultGrav struct {
// contains filtered or unexported fields
}