blockchain

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockChain

type BlockChain struct {
	ItxDB
	// contains filtered or unexported fields
}

func NewBlockChain

func NewBlockChain(nodeType int, cfg *config.BlockchainConf, txdb ItxDB) *BlockChain

func (*BlockChain) AppendBlock

func (bc *BlockChain) AppendBlock(b *Block) error

func (*BlockChain) Children

func (bc *BlockChain) Children(prevBlockHash Hash) ([]*Block, error)

func (*BlockChain) ChildrenCompact

func (bc *BlockChain) ChildrenCompact(prevBlockHash Hash) ([]*CompactBlock, error)

func (*BlockChain) ConvergeType

func (bc *BlockChain) ConvergeType() ConvergeType

func (*BlockChain) ExistsBlock

func (bc *BlockChain) ExistsBlock(blockHash Hash) (bool, error)

func (*BlockChain) Finalize

func (bc *BlockChain) Finalize(blockHash Hash) error

func (*BlockChain) GetAllBlocksByHeight

func (bc *BlockChain) GetAllBlocksByHeight(height BlockNum) ([]*Block, error)

func (*BlockChain) GetAllCompactBlocks

func (bc *BlockChain) GetAllCompactBlocks() ([]*CompactBlock, error)

func (*BlockChain) GetAllCompactBlocksByHeight

func (bc *BlockChain) GetAllCompactBlocksByHeight(height BlockNum) ([]*CompactBlock, error)

func (*BlockChain) GetBlock

func (bc *BlockChain) GetBlock(blockHash Hash) (*Block, error)

func (*BlockChain) GetBlockByHeight

func (bc *BlockChain) GetBlockByHeight(height BlockNum) (*Block, error)

func (*BlockChain) GetCompactBlock

func (bc *BlockChain) GetCompactBlock(blockHash Hash) (*CompactBlock, error)

func (*BlockChain) GetCompactBlockByHeight

func (bc *BlockChain) GetCompactBlockByHeight(height BlockNum) (*CompactBlock, error)

func (*BlockChain) GetEndBlock

func (bc *BlockChain) GetEndBlock() (*Block, error)

func (*BlockChain) GetEndCompactBlock

func (bc *BlockChain) GetEndCompactBlock() (*CompactBlock, error)

func (*BlockChain) GetGenesis

func (bc *BlockChain) GetGenesis() (*Block, error)

func (*BlockChain) GetRangeBlocks

func (bc *BlockChain) GetRangeBlocks(startHeight, endHeight BlockNum) (blocks []*Block, err error)

func (*BlockChain) LastFinalized

func (bc *BlockChain) LastFinalized() (*Block, error)

func (*BlockChain) LastFinalizedCompact

func (bc *BlockChain) LastFinalizedCompact() (*CompactBlock, error)

func (*BlockChain) NewEmptyBlock

func (bc *BlockChain) NewEmptyBlock() *Block

func (*BlockChain) SetGenesis

func (bc *BlockChain) SetGenesis(b *Block) error

func (*BlockChain) UpdateBlock

func (bc *BlockChain) UpdateBlock(b *Block) error

func (*BlockChain) UpdateBlockByHeight

func (bc *BlockChain) UpdateBlockByHeight(b *Block) error

type BlocksScheme

type BlocksScheme struct {
	ChainID     uint64
	Hash        string `gorm:"primaryKey"`
	PrevHash    string
	Height      BlockNum
	TxnRoot     string
	StateRoot   string
	ReceiptRoot string

	Timestamp  uint64
	TxnsHashes string
	PeerID     string

	LeiLimit uint64
	LeiUsed  uint64

	Finalize bool

	MinerPubkey    string
	MinerSignature string

	Validators []byte

	Nonce      uint64
	Difficulty uint64

	ProofBlock  string
	ProofHeight BlockNum
	Proof       string

	Extra string
}

func (BlocksScheme) TableName

func (BlocksScheme) TableName() string

Jump to

Keyboard shortcuts

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