Documentation
¶
Index ¶
- Constants
- Variables
- func SeedHash(block uint64) []byte
- type Kawpow
- func New(config params.PowConfig, notify []string, noverify bool, logger *log.Logger) *Kawpow
- func NewFakeDelayer(delay time.Duration) *Kawpow
- func NewFakeFailer(fail uint64) *Kawpow
- func NewFaker() *Kawpow
- func NewFullFaker() *Kawpow
- func NewShared() *Kawpow
- func NewTester(notify []string, noverify bool) *Kawpow
- func (kawpow *Kawpow) ComputePowHash(header *types.WorkObjectHeader) (common.Hash, error)
- func (kawpow *Kawpow) ComputePowLight(header *types.WorkObjectHeader) (mixHash, powHash common.Hash)
- func (kawpow *Kawpow) Mine(workObject *types.WorkObject, abort <-chan struct{}, ...)
- func (kawpow *Kawpow) MineToThreshold(workObject *types.WorkObject, workShareThreshold int, abort <-chan struct{}, ...)
- func (kawpow *Kawpow) Seal(header *types.WorkObject, results chan<- *types.WorkObject, ...) error
- func (kawpow *Kawpow) SetThreads(threads int)
- func (kawpow *Kawpow) Threads() int
- func (kawpow *Kawpow) VerifyKawpowShare(headerHash common.Hash, nonce uint64, blockNumber uint64) (common.Hash, common.Hash, error)
Constants ¶
const ( // Kawpow specific constants C_epochLength = 7500 // Blocks per epoch )
Variables ¶
var ErrInvalidDumpMagic = errors.New("invalid dump magic")
Functions ¶
Types ¶
type Kawpow ¶
type Kawpow struct {
// contains filtered or unexported fields
}
Kawpow is a proof-of-work consensus engine using the kawpow hash algorithm
func New ¶
New creates a full sized kawpow PoW scheme and starts a background thread for remote mining, also optionally notifying a batch of remote services of new work packages.
func NewFakeDelayer ¶
NewFakeDelayer creates a kawpow consensus engine with a fake PoW scheme that accepts all blocks as valid, but delays verifications by some time, though they still have to conform to the Quai consensus rules.
func NewFakeFailer ¶
NewFakeFailer creates a kawpow consensus engine with a fake PoW scheme that accepts all blocks as valid apart from the single one specified, though they still have to conform to the Quai consensus rules.
func NewFaker ¶
func NewFaker() *Kawpow
NewFaker creates a kawpow consensus engine with a fake PoW scheme that accepts all blocks' seal as valid, though they still have to conform to the Quai consensus rules.
func NewFullFaker ¶
func NewFullFaker() *Kawpow
NewFullFaker creates an kawpow consensus engine with a full fake scheme that accepts all blocks as valid, without checking any consensus rules whatsoever.
func NewShared ¶
func NewShared() *Kawpow
NewShared creates a full sized kawpow PoW shared between all requesters running in the same process.
func NewTester ¶
NewTester creates a small sized kawpow PoW scheme useful only for testing purposes.
func (*Kawpow) ComputePowHash ¶
func (*Kawpow) ComputePowLight ¶
func (kawpow *Kawpow) ComputePowLight(header *types.WorkObjectHeader) (mixHash, powHash common.Hash)
ComputePowLight computes the kawpow hash and returns mixHash and powHash
func (*Kawpow) Mine ¶
func (kawpow *Kawpow) Mine(workObject *types.WorkObject, abort <-chan struct{}, found chan *types.WorkObject)
func (*Kawpow) MineToThreshold ¶
func (kawpow *Kawpow) MineToThreshold(workObject *types.WorkObject, workShareThreshold int, abort <-chan struct{}, found chan *types.WorkObject)
func (*Kawpow) Seal ¶
func (kawpow *Kawpow) Seal(header *types.WorkObject, results chan<- *types.WorkObject, stop <-chan struct{}) error
Seal implements consensus.Engine, attempting to find a nonce that satisfies the header's difficulty requirements.
func (*Kawpow) SetThreads ¶
SetThreads updates the number of mining threads currently enabled. Calling this method does not start mining, only sets the thread count. If zero is specified, the miner will use all cores of the machine. Setting a thread count below zero is allowed and will cause the miner to idle, without any work being done.
func (*Kawpow) Threads ¶
Threads returns the number of mining threads currently enabled. This doesn't necessarily mean that mining is running!
func (*Kawpow) VerifyKawpowShare ¶
func (kawpow *Kawpow) VerifyKawpowShare(headerHash common.Hash, nonce uint64, blockNumber uint64) (common.Hash, common.Hash, error)
VerifyKawpowShare validates a Kawpow share for pool mining. This function is used by mining pools to validate shares without requiring a full WorkObject.
Parameters: - headerHash: The Kawpow header hash (seal hash) from RavencoinBlockHeader.GetKAWPOWHeaderHash() - nonce: The 64-bit nonce value - mixHash: The mix hash submitted by the miner - blockNumber: The block height for epoch calculation
Returns: - calculatedMixHash: The mix hash calculated by the Kawpow algorithm - powHash: The proof-of-work hash to compare against the target - error: Any error that occurred during calculation