validation

package
v0.0.0-...-1bcd00c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAnchorSuccessRatio

func GetAnchorSuccessRatio(coreID string, state *types.AnchorState) (float64, error)

func GetCalSuccessRatio

func GetCalSuccessRatio(coreID string, state *types.AnchorState) (float64, error)

func GetJWKChanges

func GetJWKChanges(coreID string, state *types.AnchorState) (int64, error)

func GetLastNSubmitters

func GetLastNSubmitters(n int64, state types.AnchorState) map[string]int64

GetLastNSubmitters : Given a past block range, get map of Cores that have submitted CAL tx

func GetPubKeyHex

func GetPubKeyHex(coreID string, state types.AnchorState) string

GetPubKeyHex : Gets the public key of a core, given the CoreID string

func GetValidationRecord

func GetValidationRecord(coreID string, state types.AnchorState) (string, types.TxValidation, error)

GetValidationRecord : Gets a validation record for a Core, given the CoreID

func IncrementFailedAnchor

func IncrementFailedAnchor(coreID string, state *types.AnchorState) error

IncrementFailedAnchor : increments the successful anchor record, given a coreID string and a pointer to state db

func IncrementSuccessAnchor

func IncrementSuccessAnchor(coreID string, state *types.AnchorState) error

IncrementSuccessAnchor : increments the successful anchor record, given a coreID string and a pointer to state db

func IsHabitualViolator

func IsHabitualViolator(limit types.RateLimit) bool

IsHabitualViolator : find out if the core has been violating rate limits

func IsValidBtcc

func IsValidBtcc(tx types.Tx, state types.AnchorState) bool

IsValidBtcc : Check if BTCC tx corresponds to a previous BTC-A

func IsValidator

func IsValidator(ID string, state *types.AnchorState) (amValidator bool)

IsValidator : determines if a node is a validator by checking an external ID

func NewTxValidation

func NewTxValidation() types.TxValidation

NewTxValidation : initialize values for validation of tx

func NewTxValidationMap

func NewTxValidationMap() map[string]types.TxValidation

NewTxValidationMap : initialize record keeping for validations

func RateLimitUpdate

func RateLimitUpdate(currHeight int64, limit *types.RateLimit)

RateLimitUpdate : simple token bucket rate limiter

func SetValidationRecord

func SetValidationRecord(coreID string, validationRecord types.TxValidation, state *types.AnchorState) error

SetValidationRecord : sets a validation record on the state db pointer

func UpdateAcceptTx

func UpdateAcceptTx(limit *types.RateLimit)

UpdateAcceptTx : Update successful acceptance of Tx for rate limiting

func Validate

func Validate(incoming []byte, state *types.AnchorState) (types.Tx, bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL