Documentation ¶
Index ¶
- Constants
- Variables
- type GenerationSignatureProvider
- type Hit
- type PosCalculator
- type Validator
- func (cv *Validator) GenerateHitSource(height uint64, header proto.BlockHeader) ([]byte, error)
- func (cv *Validator) RangeForGeneratingBalanceByHeight(height uint64) (uint64, uint64)
- func (cv *Validator) ValidateHeaderBeforeBlockApplying(newestHeader *proto.BlockHeader, height proto.Height) error
- func (cv *Validator) ValidateHeadersBatch(headers []proto.BlockHeader, startHeight proto.Height) error
Constants ¶
View Source
const (
MinBaseTarget = 9
)
Variables ¶
View Source
var ( NXTPosCalculator = PosCalculator(&nxtPosCalculator{}) FairPosCalculatorV1 = NewFairPosCalculator(delayDeltaV1, tMinV1) )
View Source
var ( NXTGenerationSignatureProvider = GenerationSignatureProvider(&nxtGenerationSignatureProvider{}) VRFGenerationSignatureProvider = GenerationSignatureProvider(&vrfGenerationSignatureProvider{}) )
Functions ¶
This section is empty.
Types ¶
type GenerationSignatureProvider ¶ added in v0.5.0
type GenerationSignatureProvider interface { // GenerationSignature calculates generation signature from given message using secret or public key of block's generator. GenerationSignature(key [crypto.KeySize]byte, msg []byte) ([]byte, error) // HitSource calculates hit source bytes for given message and key. HitSource(key [crypto.KeySize]byte, msg []byte) ([]byte, error) // VerifyGenerationSignature checks that generation signature is valid for given message and generator's public key. // It returns verification result and error if any. VerifyGenerationSignature(pk crypto.PublicKey, msg, sig []byte) (bool, []byte, error) }
type PosCalculator ¶ added in v0.5.0
type PosCalculator interface { HeightForHit(height uint64) uint64 CalculateBaseTarget( targetBlockDelaySeconds uint64, prevHeight uint64, prevTarget uint64, parentTimestamp uint64, greatGrandParentTimestamp uint64, currentTimestamp uint64, ) (uint64, error) CalculateDelay(hit *big.Int, parentTarget, balance uint64) (uint64, error) }
func NewFairPosCalculator ¶ added in v0.10.0
func NewFairPosCalculator(delayDelta uint64, tMin float64) PosCalculator
NewFairPosCalculator creates a custom FairPosCalculator, if this parameter is not specified in the config, then FairPosCalculatorV2 is used by default
type Validator ¶ added in v0.9.0
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶ added in v0.9.0
func NewValidator(state stateInfoProvider, settings *settings.BlockchainSettings, tm types.Time) *Validator
func (*Validator) GenerateHitSource ¶ added in v0.9.0
func (*Validator) RangeForGeneratingBalanceByHeight ¶ added in v0.9.0
func (*Validator) ValidateHeaderBeforeBlockApplying ¶ added in v0.10.0
func (*Validator) ValidateHeadersBatch ¶ added in v0.10.0
Click to show internal directories.
Click to hide internal directories.