Documentation
¶
Index ¶
- Variables
- func SetupCurrencies(rawConfig map[string]interface{})
- func SetupShareChains(rawConfig map[string]interface{})
- type Algo
- type ChainConfig
- type ChainConfigDecoder
- type HashFunc
- type Service
- func (s *Service) KeepAlive(labels map[string]string) error
- func (s *Service) LoadCommonConfig() *viper.Viper
- func (s *Service) LoadServiceConfig(config *viper.Viper, name string)
- func (s *Service) LoadServices(namespace string) (map[string]*ServiceStatus, error)
- func (s *Service) ServiceWatcher(watchNamespace string) (chan ServiceStatusUpdate, error)
- type ServiceStatus
- type ServiceStatusUpdate
- type ShareChainConfig
Constants ¶
This section is empty.
Variables ¶
var AlgoConfig = map[string]*Algo{}
var CurrencyConfig = map[string]*ChainConfig{}
This is a global lookup for currency information. All programs load "common" configuration on start and populate this by calling "SetupCurrencies"
var RawCurrencyConfig map[string]interface{}
Functions ¶
func SetupCurrencies ¶
func SetupCurrencies(rawConfig map[string]interface{})
This parses the viper config structure using ChainConfigDecoder to populate CurrencyConfig with ChainConfig structures
func SetupShareChains ¶
func SetupShareChains(rawConfig map[string]interface{})
Types ¶
type ChainConfig ¶
type ChainConfig struct {
Code string
BlockMatureConfirms int64
FlushAux bool
PayoutTransactionFee int
MultiAlgo bool
MultiAlgoMap map[string]uint32
MultiAlgoBitShift uint32
MultiAlgoBitWidth uint32
Algo *Algo
Params *chaincfg.Params `json:"-"`
BlockSubsidyAddress *btcutil.Address
}
This encodes network rules and pool wide preferences for handling of that currency. There would be a different one of these for testnet, mainnet, or regtest blockchains for a single currency.
func (*ChainConfig) MarshalJSON ¶
func (u *ChainConfig) MarshalJSON() ([]byte, error)
type ChainConfigDecoder ¶
type ChainConfigDecoder struct {
// The currency code. These are canoncially differentiated "LTC_T" for a
// litecoin testnet, or "LTC_R" for a litecoin regtest network, since this
// Code technically encodes the network type as well. It must be unique.
Code string
// Number of confirmations required before coinbase UTXOs are allowed to be
// spent. This is a network rule that varies per-currency. This is required
// to know when we can payout credits to users. If set too low,
// transactions will fail to be confirmed by the network
BlockMatureConfirms int64
// If this currency is merge mined, should we flush stratum miner jobs when
// a new block is announced? This should be selected based on the cost of a
// work restart (in stale shares), and the value of merge mined currency.
// If the merge mined currency is worth 1/1000th of the main chain
// currency, probably leave this false. If they are close in value,
// consider setting it to true
FlushAux bool
// This is the transaction fee to use for payouts. Given in satoshis / byte
PayoutTransactionFee int
// The address to send newly mined coins
SubsidyAddress string
// The name of an algorithm. Current options are scrypt, sha256d, lyra2rev2, x17, argon2
PowAlgorithm string
// Address Version (pubkey prefix) given in hex (1 byte)
PubKeyAddrID string
// Private key version for Wallet Import Format (WIF) given in hex (1 byte)
PrivKeyID string
// Private key version for Wallet Import Format (WIF) given in hex (1 byte)
PrivKeyAddrID string
// The p2p message magic bytes. This is a sequence of 4 bytes that allow
// bitcoin to reject connections from litecoin nodes, etc. It is sent at
// the beginning of every message on bitcoin p2p networks, and is unique to
// the currency and network
NetMagic uint32
// A flag for whether the following group settings are relevant.
// Configuring these details allows the job generator to change the version
// bits in block headers for multi-algo currencies, allowing only a single
// coinserver to be required
MultiAlgo bool
// A map from algorithm name to integer identifier. Usually found in pureheader.h
MultiAlgoMap map[string]uint32
// The number of bits to shift the algo identifier into the version (0-31)
MultiAlgoBitShift uint32
// The bit width of the algo identifier in the version
MultiAlgoBitWidth uint32
}
This is the structure for the config file represnetation of a "ChainConfig". Many of these properties get parsed into special datastructures for easier use later
type Service ¶
type Service struct {
Name string
PushStatus chan map[string]interface{}
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) LoadCommonConfig ¶
func (*Service) LoadServiceConfig ¶
func (*Service) LoadServices ¶
func (s *Service) LoadServices(namespace string) (map[string]*ServiceStatus, error)
Requests all services of a specific namespace. This is used in the same context as ServiceWatcher, except for simple script executions
func (*Service) ServiceWatcher ¶
func (s *Service) ServiceWatcher(watchNamespace string) (chan ServiceStatusUpdate, error)
This watches for services of a specific namespace to change, and broadcasts those changes over the provided channel. How the updates are handled is up to the reciever
type ServiceStatus ¶
type ServiceStatusUpdate ¶
type ServiceStatusUpdate struct {
ServiceType string
ServiceID string
Status *ServiceStatus
Action string
}
type ShareChainConfig ¶
type ShareChainConfig struct {
}