blockchain

package
v0.0.0-...-bba5479 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EthRpcPort      = "8545"
	CosmosRpcPort   = "26657"
	CosmosRestPort  = "1317"
	CometbftRpcPort = "26657"
)
View Source
var (
	ErrorNotSuccess = errors.New("Error: Not success")
)

Functions

func ComposeUrl

func ComposeUrl(ip, port, path string) string

func EthFetchBlockReceiptStatus

func EthFetchBlockReceiptStatus(url string, height uint64) (map[string]bool, error)

func EthFetchTxReceiptStatus

func EthFetchTxReceiptStatus(url string, txHash string) (uint64, error)

func IsValidatorJailed

func IsValidatorJailed(url string) (bool, error)

func Monitor

func Monitor(config Config)

func MustMonitorFromViper

func MustMonitorFromViper()

Types

type BlockInfo

type BlockInfo struct {
	Height    uint64
	Timestamp uint64
	Hash      string
	TxHashes  []string
}

func EthGetLatestBlockInfo

func EthGetLatestBlockInfo(url string) (*BlockInfo, error)

type BlockTxInfo

type BlockTxInfo struct {
	Height   uint64
	TxHashes []string
}

type Config

type Config struct {
	Nodes                     map[string]string
	MempoolInterval           int    `default:"1"`
	NodeInterval              int    `default:"3"`
	ValidatorInterval         int    `default:"15"`
	BlockBehindThreshold      uint64 `default:"10"`
	BlockGapThreshold         uint64 `default:"30"`
	Validators                map[string]string
	MempoolCfg                MempoolMonitorConfig
	ValidatorCfg              ValidatorMonitorConfig
	CosmosRPC                 string `default:"https://127.0.0.1:26657"`
	CosmosRest                string `default:"http://127.0.0.1:1317"`
	CometbftRPC               string `default:"http://127.0.0.1:26657"`
	BlockTxCntLimit           int    `default:"100"`
	FailedTxCntAlarmThreshold int    `default:"2"`
	Mode                      string `default:"localtest"`
	CommonEvtReportCfg        health.TimedCounterConfig
	CriticalEvtReportCfg      health.TimedCounterConfig
}

type Consensus

type Consensus struct {
	// contains filtered or unexported fields
}

func MustNewConsensus

func MustNewConsensus(urlstr string, commonCfg health.TimedCounterConfig) *Consensus

func (*Consensus) GetBlockValidatorCnt

func (m *Consensus) GetBlockValidatorCnt(height uint64) int

func (*Consensus) UpdateUncommitTxCnt

func (m *Consensus) UpdateUncommitTxCnt() int

type GrowChecker

type GrowChecker struct {
	// contains filtered or unexported fields
}

func MustNewGrowChecker

func MustNewGrowChecker(healthCfg health.TimedCounterConfig) *GrowChecker

func (*GrowChecker) Check

func (hc *GrowChecker) Check(height uint64)

type MempoolMonitorConfig

type MempoolMonitorConfig struct {
	AlarmThreshold uint64 `default:"90"`
	PoolSize       uint64 `default:"5000"`
	// contains filtered or unexported fields
}

type Node

type Node struct {
	// contains filtered or unexported fields
}

func FindMaxBlockHeight

func FindMaxBlockHeight(nodes []*Node) (uint64, *Node)

func MustNewNode

func MustNewNode(name, urlstr string) *Node

func (*Node) CheckFork

func (node *Node) CheckFork(recordor map[uint64]string)

func (*Node) CheckHeight

func (node *Node) CheckHeight(height, threshold uint64, config health.TimedCounterConfig)

func (*Node) FetchBlockReceiptStatus

func (node *Node) FetchBlockReceiptStatus(config health.TimedCounterConfig, height uint64) (map[string]bool, error)

func (*Node) FetchTxReceiptStatus

func (node *Node) FetchTxReceiptStatus(config health.TimedCounterConfig, txHash string) (bool, error)

func (*Node) UpdateHeight

func (node *Node) UpdateHeight(maxGap uint64, commonCfg, criticalCfg health.TimedCounterConfig)

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func MustNewValidator

func MustNewValidator(url *url.URL, name, address string, commonCfg health.TimedCounterConfig) *Validator

func NewValidator

func NewValidator(url *url.URL, name, address string, commonCfg health.TimedCounterConfig) (*Validator, error)

func (*Validator) CheckStatusSilence

func (validator *Validator) CheckStatusSilence()

func (Validator) String

func (validator Validator) String() string

func (*Validator) Update

func (validator *Validator) Update()

type ValidatorMonitorConfig

type ValidatorMonitorConfig struct {
	AlarmThreshold uint64 `default:"75"`
	MaxSize        uint64 `default:"200"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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