gitlab.com/SiaPrime/SiaPrime@v1.4.1/modules/miningpool.go (about) 1 package modules 2 3 import ( 4 "time" 5 6 "gitlab.com/SiaPrime/SiaPrime/types" 7 ) 8 9 const ( 10 // PoolDir names the directory that contains the pool persistence. 11 PoolDir = "miningpool" 12 ) 13 14 var ( 15 // Whatever variables we need as we go 16 ) 17 18 type ( 19 20 // PoolInternalSettings contains a list of settings that can be changed. 21 PoolInternalSettings struct { 22 PoolNetworkPort int `json:"networkport"` 23 PoolName string `json:"name"` 24 PoolID uint64 `json:"poolid"` 25 PoolDBConnection string `json:"dbconnection"` 26 PoolDBName string `json:"dbname"` 27 PoolWallet types.UnlockHash `json:"poolwallet"` 28 } 29 30 // PoolClient contains summary info for a mining client 31 PoolClient struct { 32 ClientName string `json:"clientname"` 33 Balance string `json:"balance"` 34 BlocksMined uint64 `json:"blocksminer"` 35 Workers []PoolWorker `json:"workers"` 36 } 37 38 // PoolClientTransaction represents a mining client transaction 39 PoolClientTransaction struct { 40 BalanceChange string `json:"balancechange"` 41 TxTime time.Time `json:"txtime"` 42 Memo string `json:"memo"` 43 } 44 45 // PoolWorker represents a mining client worker 46 PoolWorker struct { 47 WorkerName string `json:"workername"` 48 LastShareTime time.Time `json:"lastsharetime"` 49 CurrentDifficulty float64 `json:"currentdifficulty"` 50 CumulativeDifficulty float64 `json:"cumulativedifficulty"` 51 SharesThisBlock uint64 `json:"sharesthisblock"` 52 InvalidSharesThisBlock uint64 `json:"invalidsharesthisblock"` 53 StaleSharesThisBlock uint64 `json:"stalesharesthisblock"` 54 BlocksFound uint64 `json:"blocksfound"` 55 } 56 57 // PoolBlock represents a block mined by the pool 58 PoolBlock struct { 59 BlockNumber uint64 `json:"blocknumber"` 60 BlockHeight uint64 `json:"blockheight"` 61 BlockReward string `json:"blockreward"` 62 BlockTime time.Time `json:"blocktime"` 63 BlockStatus string `json:"blockstatus"` 64 } 65 66 // PoolBlockClient represents a block mined by the pool 67 PoolBlockClient struct { 68 ClientName string `json:"clientname"` 69 ClientPercentage float64 `json:"clientpercentage"` 70 ClientReward string `json:"clientreward"` 71 } 72 73 // PoolWorkingStatus reports the working state of a pool. Can be one of 74 // "starting", "accepting", or "not accepting". 75 PoolWorkingStatus string 76 77 // PoolConnectabilityStatus reports the connectability state of a pool. Can be 78 // one of "checking", "connectable", or "not connectable" 79 PoolConnectabilityStatus string 80 81 // A Pool accepts incoming target solutions, tracks the share (an attempted solution), 82 // checks to see if we have a new block, and if so, pays all the share submitters, 83 // proportionally based on their share of the solution (minus a percentage to the 84 // pool operator ) 85 Pool interface { 86 // InternalSettings returns the pool's internal settings, including 87 // potentially private or sensitive information. 88 InternalSettings() PoolInternalSettings 89 90 // SetInternalSettings sets the parameters of the pool. 91 SetInternalSettings(PoolInternalSettings) error 92 93 // Close closes the Pool. 94 Close() error 95 96 // Returns the number of open tcp connections the pool currently is servicing 97 NumConnections() int 98 99 // Returns the number of open tcp connections the pool has opened since startup 100 NumConnectionsOpened() uint64 101 } 102 )