blockchain

package
v0.0.0-...-f41d3e3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCK_TYPE      = "block"
	CONNECTION_TYPE = "connects"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainindexBlockchain

type ChainindexBlockchain struct {
	Config    ChainindexBlockchainConfig
	Mu        sync.Mutex
	GraphMu   sync.Mutex
	CheckupMu sync.Mutex

	Heads        map[string]bool
	HeadsToCheck map[string]uint64

	BlockGraph *dagger.Graph
	DB         *database.ChainindexDB

	IbdTransitionPeriodRelativeDepth float64
	// contains filtered or unexported fields
}

func (*ChainindexBlockchain) AddBlock

func (obc *ChainindexBlockchain) AddBlock(block *ci_pb.BcBlock) bool

func (*ChainindexBlockchain) AddBlockRange

func (obc *ChainindexBlockchain) AddBlockRange(blocks *ci_pb.BcBlocks) int

func (*ChainindexBlockchain) GetBlockByHash

func (obc *ChainindexBlockchain) GetBlockByHash(hash string) (*ci_pb.BcBlock, error)

func (*ChainindexBlockchain) GetBlockByHeight

func (obc *ChainindexBlockchain) GetBlockByHeight(height uint64) (*ci_pb.BcBlock, error)

func (*ChainindexBlockchain) GetBlockByTx

func (obc *ChainindexBlockchain) GetBlockByTx(txHash string) (*ci_pb.BcBlock, error)

func (*ChainindexBlockchain) GetHighestBlock

func (obc *ChainindexBlockchain) GetHighestBlock() (*ci_pb.BcBlock, error)

func (*ChainindexBlockchain) IsFollowingChain

func (obc *ChainindexBlockchain) IsFollowingChain() bool

func (*ChainindexBlockchain) SetFollowingChain

func (obc *ChainindexBlockchain) SetFollowingChain()

func (*ChainindexBlockchain) SyncProgress

func (obc *ChainindexBlockchain) SyncProgress() ProgressInfo

func (*ChainindexBlockchain) UnsetFollowingChain

func (obc *ChainindexBlockchain) UnsetFollowingChain()

type ChainindexBlockchainConfig

type ChainindexBlockchainConfig struct {
	DisjointCheckupDepth  int `json:"disjoint_checkup_depth"`  // if there is a chain segment not connected to db, how long does it have to be to ask to go look for blocks to try to connect?
	DisjointCheckupHeight int `json:"disjoint_checkup_height"` // if any chain segment not connected to db is higher by this number of blocks, investigate it
	DisplayDepth          int `json:"display_depth"`           // only show chains of this length or longer
}

func DefaultChainindexBlockchainConfig

func DefaultChainindexBlockchainConfig() ChainindexBlockchainConfig

type HeadInformation

type HeadInformation struct {
	Hash         string
	Depth        uint64
	LowestBlock  *ci_pb.BcBlock
	HighestBlock *ci_pb.BcBlock
	HasDB        bool
}

type ProgressInfo

type ProgressInfo struct {
	Done                   bool
	StartingBlock          *ci_pb.BcBlock
	CurrentBlock           *ci_pb.BcBlock
	HighestPeerBlockHeight uint64
}

Jump to

Keyboard shortcuts

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