Documentation
¶
Index ¶
- type BlockChain
- func (bc *BlockChain) AppendBlock(b *Block) error
- func (bc *BlockChain) ChainID() uint64
- func (bc *BlockChain) Children(prevBlockHash Hash) ([]*Block, error)
- func (bc *BlockChain) ChildrenCompact(prevBlockHash Hash) ([]*CompactBlock, error)
- func (bc *BlockChain) ConvergeType() ConvergeType
- func (bc *BlockChain) ExistsBlock(blockHash Hash) (bool, error)
- func (bc *BlockChain) Finalize(block *Block) error
- func (bc *BlockChain) GetAllBlocksByHeight(height BlockNum) ([]*Block, error)
- func (bc *BlockChain) GetAllCompactBlocks() ([]*CompactBlock, error)
- func (bc *BlockChain) GetAllCompactBlocksByHeight(height BlockNum) ([]*CompactBlock, error)
- func (bc *BlockChain) GetBlock(blockHash Hash) (*Block, error)
- func (bc *BlockChain) GetBlockByHeight(height BlockNum) (*Block, error)
- func (bc *BlockChain) GetCompactBlock(blockHash Hash) (*CompactBlock, error)
- func (bc *BlockChain) GetCompactBlockByHeight(height BlockNum) (*CompactBlock, error)
- func (bc *BlockChain) GetEndBlock() (*Block, error)
- func (bc *BlockChain) GetEndCompactBlock() (*CompactBlock, error)
- func (bc *BlockChain) GetFinalizedBlockByHeight(height BlockNum) (*Block, error)
- func (bc *BlockChain) GetFinalizedCompactBlockByHeight(height BlockNum) (*CompactBlock, error)
- func (bc *BlockChain) GetGenesis() (*Block, error)
- func (bc *BlockChain) GetRangeBlocks(startHeight, endHeight BlockNum) (blocks []*Block, err error)
- func (bc *BlockChain) LastFinalized() (*Block, error)
- func (bc *BlockChain) LastFinalizedCompact() (*CompactBlock, error)
- func (bc *BlockChain) NewEmptyBlock() *Block
- func (bc *BlockChain) SetGenesis(b *Block) error
- func (bc *BlockChain) UpdateBlock(b *Block) error
- func (bc *BlockChain) UpdateBlockByHeight(b *Block) error
- type BlocksScheme
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) ChainID ¶ added in v1.0.5
func (bc *BlockChain) ChainID() uint64
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(block *Block) 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) GetFinalizedBlockByHeight ¶ added in v1.2.11
func (bc *BlockChain) GetFinalizedBlockByHeight(height BlockNum) (*Block, error)
func (*BlockChain) GetFinalizedCompactBlockByHeight ¶ added in v1.2.11
func (bc *BlockChain) GetFinalizedCompactBlockByHeight(height BlockNum) (*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;type:varchar(100)"`
PrevHash string
Height BlockNum `gorm:"index"`
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
Click to show internal directories.
Click to hide internal directories.