mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-1532] Add comments
This commit is contained in:
parent
b2188f5993
commit
7224d58940
@ -11,6 +11,7 @@ type ReachabilityManager interface {
|
||||
UpdateReindexRoot(selectedTip *externalapi.DomainHash) error
|
||||
}
|
||||
|
||||
// TestReachabilityManager adds to the main ReachabilityManager methods required by tests
|
||||
type TestReachabilityManager interface {
|
||||
ReachabilityManager
|
||||
SetReachabilityReindexWindow(reindexWindow uint64)
|
||||
|
@ -9,6 +9,7 @@ type testConsensusStateManager struct {
|
||||
*consensusStateManager
|
||||
}
|
||||
|
||||
// NewTestConsensusStateManager creates an instance of a TestConsensusStateManager
|
||||
func NewTestConsensusStateManager(baseConsensusStateManager model.ConsensusStateManager) model.TestConsensusStateManager {
|
||||
return &testConsensusStateManager{consensusStateManager: baseConsensusStateManager.(*consensusStateManager)}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ func (t testReachabilityManager) SetReachabilityReindexWindow(reindexWindow uint
|
||||
t.reachabilityManager.reindexWindow = reindexWindow
|
||||
}
|
||||
|
||||
// NewTestReachabilityManager creates an instance of a TestReachabilityManager
|
||||
func NewTestReachabilityManager(manager model.ReachabilityManager) model.TestReachabilityManager {
|
||||
return &testReachabilityManager{reachabilityManager: manager.(*reachabilityManager)}
|
||||
}
|
||||
|
@ -1,15 +1,17 @@
|
||||
package mining
|
||||
|
||||
import (
|
||||
"math"
|
||||
"math/rand"
|
||||
|
||||
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
|
||||
"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
|
||||
"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
|
||||
utilsMath "github.com/kaspanet/kaspad/domain/consensus/utils/math"
|
||||
"github.com/pkg/errors"
|
||||
"math"
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
// SolveBlock increments the given block's nonce until it matches the difficulty requirements in its bits field
|
||||
func SolveBlock(block *externalapi.DomainBlock, rd *rand.Rand) {
|
||||
targetDifficulty := utilsMath.CompactToBig(block.Header.Bits)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user