Documentation ¶
Index ¶
Constants ¶
View Source
const ( PrefixRegisterKey = "register_" PrefixJobKey = "job_" )
View Source
const ( KeyRegId = "id" KeyRegPayoutAddress = "payoutAddress" KeyRegPoolTag = "poolTag" KeyRegCoinType = "coinType" KeyRegUsedTestNet = "usedTestNet" KeyRegExtraNonce1Length = "extraNonce1Length" KeyRegExtraNonce2Length = "extraNonce2Length" )
Variables ¶
View Source
var (
CoinTypeBTC string = "BTC"
)
Functions ¶
This section is empty.
Types ¶
type BlockCoinBasePart ¶
type BlockCoinBasePart struct { CoinBase1 string CoinBase2 string ExtraNonce1 string ExtraNonce2 string }
func NewBlockCoinBasePart ¶
func NewBlockCoinBasePart() *BlockCoinBasePart
type BlockHeaderPart ¶
type BlockHeaderPart struct { Version string PrevHash string NBits string Nonce string NTime string }
func NewBlockHeaderPart ¶
func NewBlockHeaderPart() *BlockHeaderPart
type CacheService ¶
type CacheService interface { SetRegisterContext(key RegisterKey, r *Register) error GetRegisterContext(key RegisterKey) (*Register, error) DelRegisterContext(key RegisterKey) error SetBlockTransactions(key JobKey, expireTs int, transactions []*Transaction) error GetBlockTransactions(key JobKey) ([]*Transaction, error) }
type CoinService ¶
type CoinService interface { IsValidAddress(address string, isUsedTestNet bool) bool GetLatestStratumJob(r *Register) (*StratumJobPart, []*Transaction, error) MakeBlock(r *Register, header *BlockHeaderPart, base *BlockCoinBasePart, transactions []*Transaction) (*Block, error) SubmitBlock(data string) (bool, error) IsSolveHash(hash string, targetDifficulty *big.Int) (bool, error) GetTargetDifficulty(bits string) (*big.Int, error) GetNewBlockHeight() (int, error) }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
func (*Manager) GetCacheService ¶
func (m *Manager) GetCacheService() CacheService
func (*Manager) GetCoinService ¶
func (m *Manager) GetCoinService(coinType string) CoinService
func (*Manager) SetCacheService ¶
func (m *Manager) SetCacheService(service CacheService) *Manager
func (*Manager) SetCoinService ¶
func (m *Manager) SetCoinService(coinType string, service CoinService) *Manager
type Register ¶
type Register struct { Id string PayoutAddress string PoolTag string CoinType string UsedTestNet bool ExtraNonce1Length int ExtraNonce2Length int }
func NewRegister ¶
func NewRegister() *Register
type RegisterKey ¶
type RegisterKey string
func GenRegisterKey ¶
func GenRegisterKey(registerId string) RegisterKey
type StratumJobMetaPart ¶
func NewStratumJobMetaPart ¶
func NewStratumJobMetaPart() *StratumJobMetaPart
type StratumJobPart ¶
type StratumJobPart struct { PrevHash string CoinBase1 string CoinBase2 string MerkleBranch []string Version string NBits string Meta *StratumJobMetaPart }
func NewStratumJobPart ¶
func NewStratumJobPart() *StratumJobPart
func (*StratumJobPart) ToPBStratumJob ¶
func (job *StratumJobPart) ToPBStratumJob() *pb.StratumJob
type Transaction ¶
func NewBlockTransactionPart ¶
func NewBlockTransactionPart(hash string, data string) *Transaction
Click to show internal directories.
Click to hide internal directories.