Documentation ¶
Index ¶
- Variables
- func BigDiffToLittle(diff *big.Int) float64
- func CalculateTarget(bits uint64) big.Int
- func DiffToHash(diff float64) float64
- func DiffToTarget(diff float64) *big.Int
- func GenerateJobHeader(headerData []byte) []uint64
- func GenerateLargeJobParams(headerData []byte, timestamp uint64) string
- func GetAverageHashrateGHs(stats *WorkStats) float64
- func InitInvalidCounter(worker *gostratum.StratumContext, errorType string)
- func InitWorkerCounters(worker *gostratum.StratumContext)
- func ListenAndServe(cfg BridgeConfig) error
- func MiningStateGenerator() any
- func RecordBalances(response *appmessage.GetBalancesByAddressesResponseMessage)
- func RecordBlockFound(worker *gostratum.StratumContext, nonce, bluescore uint64, hash string)
- func RecordDisconnect(worker *gostratum.StratumContext)
- func RecordDupeShare(worker *gostratum.StratumContext)
- func RecordInvalidShare(worker *gostratum.StratumContext)
- func RecordNetworkStats(hashrate uint64, blockCount uint64, difficulty float64)
- func RecordNewJob(worker *gostratum.StratumContext)
- func RecordShareFound(worker *gostratum.StratumContext, shareDiff float64)
- func RecordStaleShare(worker *gostratum.StratumContext)
- func RecordWeakShare(worker *gostratum.StratumContext)
- func RecordWorkerError(address string, shortError ErrorShortCodeT)
- func SerializeBlockHeader(template *appmessage.RPCBlock) ([]byte, error)
- func StartPromServer(log *zap.SugaredLogger, port string)
- func TargetToDiff(target *big.Int) float64
- type BridgeConfig
- type ErrorShortCodeT
- type KarlsenApi
- type MiningState
- type WorkStats
Constants ¶
This section is empty.
Variables ¶
View Source
var ()
Functions ¶
func BigDiffToLittle ¶
func CalculateTarget ¶
func DiffToHash ¶
func DiffToTarget ¶
func GenerateJobHeader ¶
func GenerateLargeJobParams ¶
func GetAverageHashrateGHs ¶
func InitInvalidCounter ¶
func InitInvalidCounter(worker *gostratum.StratumContext, errorType string)
func InitWorkerCounters ¶
func InitWorkerCounters(worker *gostratum.StratumContext)
func ListenAndServe ¶
func ListenAndServe(cfg BridgeConfig) error
func MiningStateGenerator ¶
func MiningStateGenerator() any
func RecordBalances ¶
func RecordBalances(response *appmessage.GetBalancesByAddressesResponseMessage)
func RecordBlockFound ¶
func RecordBlockFound(worker *gostratum.StratumContext, nonce, bluescore uint64, hash string)
func RecordDisconnect ¶
func RecordDisconnect(worker *gostratum.StratumContext)
func RecordDupeShare ¶
func RecordDupeShare(worker *gostratum.StratumContext)
func RecordInvalidShare ¶
func RecordInvalidShare(worker *gostratum.StratumContext)
func RecordNetworkStats ¶
func RecordNewJob ¶
func RecordNewJob(worker *gostratum.StratumContext)
func RecordShareFound ¶
func RecordShareFound(worker *gostratum.StratumContext, shareDiff float64)
func RecordStaleShare ¶
func RecordStaleShare(worker *gostratum.StratumContext)
func RecordWeakShare ¶
func RecordWeakShare(worker *gostratum.StratumContext)
func RecordWorkerError ¶
func RecordWorkerError(address string, shortError ErrorShortCodeT)
func SerializeBlockHeader ¶
func SerializeBlockHeader(template *appmessage.RPCBlock) ([]byte, error)
func StartPromServer ¶
func StartPromServer(log *zap.SugaredLogger, port string)
func TargetToDiff ¶ added in v2.2.0
Types ¶
type BridgeConfig ¶
type BridgeConfig struct { StratumPort string `yaml:"stratum_port"` RPCServer string `yaml:"karlsend_address"` PromPort string `yaml:"prom_port"` PrintStats bool `yaml:"print_stats"` UseLogFile bool `yaml:"log_to_file"` HealthCheckPort string `yaml:"health_check_port"` SoloMining bool `yaml:"solo_mining"` BlockWaitTime time.Duration `yaml:"block_wait_time"` VarDiff bool `yaml:"var_diff"` VarDiffStats bool `yaml:"var_diff_stats"` ExtranonceSize uint `yaml:"extranonce_size"` TestnetMining bool `yaml:"testnet_mining"` }
type ErrorShortCodeT ¶
type ErrorShortCodeT string
const ( ErrNoMinerAddress ErrorShortCodeT = "err_no_miner_address" ErrFailedBlockFetch ErrorShortCodeT = "err_failed_block_fetch" ErrInvalidAddressFmt ErrorShortCodeT = "err_malformed_wallet_address" ErrMissingJob ErrorShortCodeT = "err_missing_job" ErrBadDataFromMiner ErrorShortCodeT = "err_bad_data_from_miner" ErrFailedSendWork ErrorShortCodeT = "err_failed_sending_work" ErrFailedSetDiff ErrorShortCodeT = "err_diff_set_failed" ErrDisconnected ErrorShortCodeT = "err_worker_disconnected" )
type KarlsenApi ¶
type KarlsenApi struct {
// contains filtered or unexported fields
}
func NewKarlsenAPI ¶
func NewKarlsenAPI(address string, blockWaitTime time.Duration, logger *zap.SugaredLogger) (*KarlsenApi, error)
func (*KarlsenApi) GetBlockTemplate ¶
func (ks *KarlsenApi) GetBlockTemplate( client *gostratum.StratumContext) (*appmessage.GetBlockTemplateResponseMessage, error)
func (*KarlsenApi) Start ¶
func (ks *KarlsenApi) Start(ctx context.Context, blockCb func())
type MiningState ¶
type MiningState struct { Jobs map[int]*appmessage.RPCBlock JobLock sync.Mutex // contains filtered or unexported fields }
func GetMiningState ¶
func GetMiningState(ctx *gostratum.StratumContext) *MiningState
func (*MiningState) AddJob ¶
func (ms *MiningState) AddJob(job *appmessage.RPCBlock) int
func (*MiningState) GetJob ¶
func (ms *MiningState) GetJob(id int) (*appmessage.RPCBlock, bool)
Click to show internal directories.
Click to hide internal directories.