Documentation ¶
Index ¶
- Constants
- func ApplyShuffleMapping[T any](v []T, mappings ShuffleMapping) []T
- func CoinbaseIdHash(hasher *sha3.HasherState, coinbaseBlobMinusBaseRTC types.Hash, ...)
- func TargetHex(target uint64) string
- type BanEntry
- type Client
- type JobIdentifier
- type JsonRpcJob
- type JsonRpcMessage
- type JsonRpcResponseJob
- type JsonRpcResult
- type MinerTrackingEntry
- type MiningMempool
- type NewTemplateData
- type Server
- func (s *Server) Ban(ip netip.Addr, duration time.Duration, err error)
- func (s *Server) BuildTemplate(addr address.PackedAddress, forceNewTemplate bool) (tpl *Template, jobCounter uint64, difficultyTarget types.Difficulty, ...)
- func (s *Server) CleanupBanList()
- func (s *Server) CleanupMiners()
- func (s *Server) CloseClient(c *Client)
- func (s *Server) HandleBroadcast(block *sidechain.PoolBlock)
- func (s *Server) HandleMempoolData(data mempool.Mempool)
- func (s *Server) HandleMinerData(minerData *p2pooltypes.MinerData)
- func (s *Server) HandleTip(tip *sidechain.PoolBlock)
- func (s *Server) IsBanned(ip netip.Addr) (bool, *BanEntry)
- func (s *Server) Listen(listen string) error
- func (s *Server) SendTemplate(c *Client) (err error)
- func (s *Server) SendTemplateResponse(c *Client, id any) (err error)
- func (s *Server) Update()
- type ShuffleMapping
- type ShuffleMappingIndices
- type Template
- func (tpl *Template) Blob(preAllocatedBuffer []byte, ...) []byte
- func (tpl *Template) CoinbaseBlob(preAllocatedBuffer []byte, extraNonce uint32, templateId types.Hash) []byte
- func (tpl *Template) CoinbaseBlobId(hasher *sha3.HasherState, preAllocatedBuffer []byte, extraNonce uint32, ...)
- func (tpl *Template) CoinbaseBufferLength() int
- func (tpl *Template) CoinbaseId(hasher *sha3.HasherState, extraNonce uint32, templateId types.Hash, ...)
- func (tpl *Template) HashingBlob(hasher *sha3.HasherState, preAllocatedBuffer []byte, nonce, extraNonce uint32, ...) []byte
- func (tpl *Template) HashingBlobBufferLength() int
- func (tpl *Template) MainBlock() (b mainblock.Block, err error)
- func (tpl *Template) ShareVersion(consensus *sidechain.Consensus) sidechain.ShareVersion
- func (tpl *Template) SideData(consensus *sidechain.Consensus) (d sidechain.SideData, err error)
- func (tpl *Template) TemplateId(hasher *sha3.HasherState, preAllocatedBuffer []byte, ...)
- func (tpl *Template) Timestamp() uint64
- func (tpl *Template) Write(writer io.Writer, nonce, extraNonce, sideRandomNumber, sideExtraNonce uint32, ...) error
Constants ¶
View Source
const HighFeeValue uint64 = 6000000000
HighFeeValue 0.006 XMR
View Source
const JobIdentifierSize = 8 + 4 + 4 + 4 + types.HashSize
View Source
const ShuffleMappingZeroKeyIndex = 0
View Source
const Target4BytesLimit = math.MaxUint64 / 4000001
Target4BytesLimit Use short target format (4 bytes) for diff <= 4 million
View Source
const TimeInMempool = time.Second * 5
Variables ¶
This section is empty.
Functions ¶
func ApplyShuffleMapping ¶
func ApplyShuffleMapping[T any](v []T, mappings ShuffleMapping) []T
ApplyShuffleMapping Applies a shuffle mapping depending on source length Returns nil in case no source length matches shuffle mapping
func CoinbaseIdHash ¶
Types ¶
type Client ¶
type JobIdentifier ¶
type JobIdentifier [JobIdentifierSize]byte
func JobIdentifierFromString ¶
func JobIdentifierFromString(s string) (JobIdentifier, error)
func JobIdentifierFromValues ¶
func JobIdentifierFromValues(templateCounter uint64, extraNonce, sideRandomNumber, sideExtraNonce uint32, templateId types.Hash) JobIdentifier
func (JobIdentifier) ExtraNonce ¶
func (id JobIdentifier) ExtraNonce() uint32
func (JobIdentifier) SideExtraNonce ¶
func (id JobIdentifier) SideExtraNonce() uint32
func (JobIdentifier) SideRandomNumber ¶
func (id JobIdentifier) SideRandomNumber() uint32
func (JobIdentifier) String ¶
func (id JobIdentifier) String() string
func (JobIdentifier) TemplateCounter ¶
func (id JobIdentifier) TemplateCounter() uint64
func (JobIdentifier) TemplateId ¶
func (id JobIdentifier) TemplateId() types.Hash
type JsonRpcJob ¶
type JsonRpcMessage ¶
type JsonRpcResponseJob ¶
type JsonRpcResult ¶
type MinerTrackingEntry ¶
type MinerTrackingEntry struct { Lock sync.RWMutex Counter atomic.Uint64 LastTemplate atomic.Uint64 Templates map[uint64]*Template LastJob time.Time }
func (*MinerTrackingEntry) GetJobBlob ¶
func (e *MinerTrackingEntry) GetJobBlob(jobId JobIdentifier, nonce uint32) []byte
GetJobBlob Gets old job data based on returned id
type MiningMempool ¶
func (*MiningMempool) Add ¶
func (m *MiningMempool) Add(tx *mempool.Entry) (added bool)
Add Inserts a transaction into the mempool.
func (*MiningMempool) Swap ¶
func (m *MiningMempool) Swap(pool mempool.Mempool)
type NewTemplateData ¶
type NewTemplateData struct { PreviousTemplateId types.Hash SideHeight uint64 Difficulty types.Difficulty CumulativeDifficulty types.Difficulty TransactionPrivateKeySeed types.Hash // TransactionPrivateKey Generated from TransactionPrivateKeySeed TransactionPrivateKey crypto.PrivateKeyBytes TransactionPublicKey crypto.PublicKeySlice Timestamp uint64 TotalReward uint64 Transactions []types.Hash MaxRewardAmountsWeight uint64 Uncles []types.Hash Ready bool Window struct { ReservedShareIndex int Shares sidechain.Shares ShuffleMapping ShuffleMapping EphemeralPubKeyCache map[ephemeralPubKeyCacheKey]*ephemeralPubKeyCacheEntry } }
type Server ¶
type Server struct { SubmitFunc func(block *sidechain.PoolBlock) error // contains filtered or unexported fields }
func (*Server) BuildTemplate ¶
func (*Server) CleanupBanList ¶
func (s *Server) CleanupBanList()
func (*Server) CleanupMiners ¶
func (s *Server) CleanupMiners()
func (*Server) CloseClient ¶
func (*Server) HandleBroadcast ¶
func (*Server) HandleMempoolData ¶
func (*Server) HandleMinerData ¶
func (s *Server) HandleMinerData(minerData *p2pooltypes.MinerData)
func (*Server) SendTemplate ¶
func (*Server) SendTemplateResponse ¶
type ShuffleMapping ¶
type ShuffleMapping struct { // Including the index mapping contains a new miner in the list Including []int // Excluding the index mapping doesn't contain a new miner. // len(Excluding) = len(Including) - 1 (unless len(Including) == 1, where it's also 1) Excluding []int }
func BuildShuffleMapping ¶
func BuildShuffleMapping(n int, shareVersion sidechain.ShareVersion, transactionPrivateKeySeed types.Hash, oldMappings ShuffleMapping) (mappings ShuffleMapping)
BuildShuffleMapping Creates a mapping of source to destination miner output post shuffle This uses two mappings, one where a new miner is added to the list, and one where the count stays the same Usual usage will place Zero key in index 0
func (ShuffleMapping) RangePossibleIndices ¶
func (m ShuffleMapping) RangePossibleIndices(f func(i, ix0, ix1, ix2 int))
type ShuffleMappingIndices ¶
type ShuffleMappingIndices [][3]int
type Template ¶
type Template struct { Buffer []byte // NonceOffset offset of an uint32 NonceOffset int CoinbaseOffset int // ExtraNonceOffset offset of an uint32 ExtraNonceOffset int // SidechainIdOffset offset of a types.Hash SidechainIdOffset int // TransactionsOffset Start of transactions section TransactionsOffset int // TemplateSideDataOffset Start of side data section TemplateSideDataOffset int // TemplateExtraBufferOffset offset of 4*uint32 TemplateExtraBufferOffset int MainHeight uint64 MainParent types.Hash SideHeight uint64 SideParent types.Hash SideDifficulty types.Difficulty MerkleTreeMainBranch []types.Hash }
func TemplateFromPoolBlock ¶
func (*Template) CoinbaseBlob ¶
func (*Template) CoinbaseBlobId ¶
func (*Template) CoinbaseBufferLength ¶
func (*Template) CoinbaseId ¶
func (*Template) HashingBlob ¶
func (*Template) HashingBlobBufferLength ¶
func (*Template) ShareVersion ¶
func (tpl *Template) ShareVersion(consensus *sidechain.Consensus) sidechain.ShareVersion
func (*Template) TemplateId ¶
Click to show internal directories.
Click to hide internal directories.