Documentation
¶
Index ¶
Constants ¶
const HashCountSpan uint32 = 200000
HashCountSpan counter big enough to avoid mutex bottleneck
const MaxNonce uint32 = 4294967295
MaxNonce standard value
Variables ¶
var Psize = poolsize()
Psize size of the pool
Functions ¶
func Gettarget ¶
func Gettarget(difficulty utils.Difficulty) string
Gettarget TODO Calculate the right target depending on the difficulty. This one is totally made up for testing purpose.
Types ¶
type CPUMiner ¶
type CPUMiner struct {
HashRate chan *HashRate
// contains filtered or unexported fields
}
func NewCPUMiner ¶
type Chunk ¶
Chunk entity defined by a block and a target. Nonce is here for checking if the chunk is valid
func NewChunkList ¶
func NewChunkList(version byte, epoch uint32, difficulty utils.Difficulty) []Chunk
NewChunkList We are splitting a BlockHeader to spread the mining between the different goroutines
type Dispatcher ¶
type Dispatcher struct {
MiningPool chan chan Chunk
ChunkQueueIn chan Chunk
ChunkQueueOut chan Chunk
}
Dispatcher Entity. Contains a Pool of chans to send and receive from other miners. A queue of chunks to mine And a queue of chunks to validate and submit
func (*Dispatcher) Dispatch ¶
func (dispatcher *Dispatcher) Dispatch()
Dispatch starts the counter for loging. Waits for chunk and send it to an available miner
func (*Dispatcher) Run ¶
func (dispatcher *Dispatcher) Run()
Run starts the new dispatcher, create the miners, start them and begin dispatching.
type Miner ¶
type Miner struct {
ID int
MiningPool chan chan Chunk
BlockChannelIn chan Chunk
BlockChannelOut chan Chunk
// contains filtered or unexported fields
}
Miner entity defined by an ID. Worker.