mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-23 22:15:54 +00:00
Parallel miner
This commit is contained in:
parent
bbdf7b246d
commit
c46503ea7e
@ -2,7 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
nativeerrors "errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@ -38,7 +40,9 @@ func mineLoop(client *minerClient, numberOfBlocks uint64, targetBlocksPerSecond
|
||||
templatesLoop(client, miningAddr, errChan)
|
||||
})
|
||||
|
||||
spawn("blocksLoop", func() {
|
||||
for c := 0; c < (runtime.NumCPU()/2)+1; c++ {
|
||||
c := c
|
||||
spawn(fmt.Sprintf("blocksLoop %d", c), func() {
|
||||
const windowSize = 10
|
||||
hasBlockRateTarget := targetBlocksPerSecond != 0
|
||||
var windowTicker, blockTicker *time.Ticker
|
||||
@ -69,6 +73,7 @@ func mineLoop(client *minerClient, numberOfBlocks uint64, targetBlocksPerSecond
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
spawn("handleFoundBlock", func() {
|
||||
for i := uint64(0); numberOfBlocks == 0 || i < numberOfBlocks; i++ {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user