Documentation
¶
Overview ¶
Ethereum Block with some information about where it came from.
Package analysis Summary of a specific reorg ¶
Tree of blocks, used to traverse up (from children to parents) and down (from parents to children). Reorgs start on each node with more than one child.
TreeAnalysis takes in a BlockTree and collects information about reorgs
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintNodeAndChildren ¶
Types ¶
type Block ¶
type Block struct {
Block *types.Block
Origin BlockOrigin
NodeUri string
ObservedUnixTimestamp int64
// some helpers
Number uint64
Hash common.Hash
ParentHash common.Hash
}
Block is an geth Block and information about where it came from
type BlockOrigin ¶
type BlockOrigin string
const ( OriginSubscription BlockOrigin = "Subscription" OriginGetParent BlockOrigin = "GetParent" OriginUncle BlockOrigin = "Uncle" )
type BlockTree ¶
type BlockTree struct {
FirstNode *TreeNode
LatestNodes []*TreeNode // Nodes at latest blockheight (can be more than 1)
NodeByHash map[common.Hash]*TreeNode
MainChainNodeByHash map[common.Hash]*TreeNode
}
func NewBlockTree ¶
func NewBlockTree() *BlockTree
type Reorg ¶
type Reorg struct {
IsFinished bool
SeenLive bool
StartBlockHeight uint64 // first block in a reorg (block number after common parent)
EndBlockHeight uint64 // last block in a reorg
Chains map[common.Hash][]*Block
Depth int
BlocksInvolved map[common.Hash]*Block
MainChainHash common.Hash
MainChainBlocks map[common.Hash]*Block
NumReplacedBlocks int
EthNodesInvolved map[string]bool
CommonParent *Block
FirstBlockAfterReorg *Block
}
func (*Reorg) MermaidSyntax ¶
type TreeAnalysis ¶
type TreeAnalysis struct {
Tree *BlockTree
StartBlockHeight uint64 // first block number with siblings
EndBlockHeight uint64
IsSplitOngoing bool
NumBlocks int
NumBlocksMainChain int
Reorgs map[string]*Reorg
}
func NewTreeAnalysis ¶
func NewTreeAnalysis(t *BlockTree) (*TreeAnalysis, error)
func (*TreeAnalysis) Print ¶
func (a *TreeAnalysis) Print()
Click to show internal directories.
Click to hide internal directories.