[NOD-1532] Add comments

This commit is contained in:
Mike Zak 2020-11-17 11:59:11 +02:00 committed by Svarog
parent b2188f5993
commit 7224d58940
4 changed files with 7 additions and 2 deletions

View File

@ -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)

View File

@ -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)}
}

View File

@ -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)}
}

View File

@ -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)