Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyShuffleMapping[T any](v []T, mappings ShuffleMapping) []T
- func BanError(err error) error
- func CoinbaseIdHash(hasher *sha3.HasherState, coinbaseBlobMinusBaseRTC types.Hash, ...)
- func TargetHex(target uint64) string
- type BanEntry
- type Client
- type Job
- 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, supportsTemplate bool) (err error)
- func (s *Server) SendTemplateResponse(c *Client, id any, supportsTemplate bool) (err error)
- func (s *Server) Update()
- type ShuffleMapping
- type ShuffleMappingIndices
- type Template
- func (tpl *Template) Blob(preAllocatedBuffer []byte, consensus *sidechain.Consensus, ...) []byte
- func (tpl *Template) BufferLength(consensus *sidechain.Consensus, merkleProof crypto.MerkleProof, ...) int
- func (tpl *Template) CoinbaseBlob(preAllocatedBuffer []byte, extraNonce uint32, merkleRoot 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, merkleRoot 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) TemplateId(hasher *sha3.HasherState, preAllocatedBuffer []byte, ...)
- func (tpl *Template) Timestamp() uint64
- func (tpl *Template) Write(writer io.Writer, consensus *sidechain.Consensus, ...) error
Constants ¶
View Source
const HighFeeValue uint64 = 6000000000
HighFeeValue 0.006 XMR
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 ¶
View Source
var ErrBannable = errors.New("banned")
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 Job ¶ added in v4.9.0
type Job struct {
TemplateCounter uint64
ExtraNonce uint32
SideRandomNumber uint32
SideExtraNonce uint32
MerkleRoot types.Hash
MerkleProof crypto.MerkleProof
MergeMiningExtra sidechain.MergeMiningExtra
}
func JobFromString ¶ added in v4.9.0
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(c *Client, consensus *sidechain.Consensus, job Job, 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
SubmitMainFunc func(b *block.Block) 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
// MerkleRootOffset offset of a types.Hash for merge mining id
MerkleRootOffset int
// TransactionsOffset Start of transactions section
TransactionsOffset int
// TemplateSideDataOffset Start of side data section
TemplateSideDataOffset int
MainHeight uint64
MainParent types.Hash
SideHeight uint64
SideParent types.Hash
SideDifficulty types.Difficulty
MerkleTreeMainBranch []types.Hash
}
func TemplateFromPoolBlock ¶
func (*Template) Blob ¶
func (tpl *Template) Blob(preAllocatedBuffer []byte, consensus *sidechain.Consensus, nonce, extraNonce, sideRandomNumber, sideExtraNonce uint32, merkleRoot types.Hash, merkleProof crypto.MerkleProof, mmExtra sidechain.MergeMiningExtra, softwareId p2pooltypes.SoftwareId, softwareVersion p2pooltypes.SoftwareVersion) []byte
func (*Template) BufferLength ¶ added in v4.9.0
func (tpl *Template) BufferLength(consensus *sidechain.Consensus, merkleProof crypto.MerkleProof, mmExtra sidechain.MergeMiningExtra) int
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 ¶
func (tpl *Template) TemplateId(hasher *sha3.HasherState, preAllocatedBuffer []byte, consensus *sidechain.Consensus, sideRandomNumber, sideExtraNonce uint32, merkleProof crypto.MerkleProof, mmExtra sidechain.MergeMiningExtra, softwareId p2pooltypes.SoftwareId, softwareVersion p2pooltypes.SoftwareVersion, result *types.Hash)
func (*Template) Write ¶
func (tpl *Template) Write(writer io.Writer, consensus *sidechain.Consensus, nonce, extraNonce, sideRandomNumber, sideExtraNonce uint32, merkleRoot types.Hash, merkleProof crypto.MerkleProof, mmExtra sidechain.MergeMiningExtra, softwareId p2pooltypes.SoftwareId, softwareVersion p2pooltypes.SoftwareVersion) error
Click to show internal directories.
Click to hide internal directories.