Documentation ¶
Index ¶
- func AreChainsEqual(ch1 *Chain, head1 common.Hash, ch2 *Chain, head2 common.Hash) (bool, string)
- func AssertChainsEqual(assert *assert.Assertions, ch1 *Chain, head1 common.Hash, ch2 *Chain, ...)
- func AssertChainsNotEqual(assert *assert.Assertions, ch1 *Chain, head1 common.Hash, ch2 *Chain, ...)
- type BlockByHeightIndexEntry
- type Chain
- func (ch *Chain) AddBlock(block *core.Block) (*core.ExtendedBlock, error)
- func (ch *Chain) AddBlockByHeightIndex(height uint64, block common.Hash)
- func (ch *Chain) AddSnapshotRoot(block *core.Block) (*core.ExtendedBlock, error)
- func (ch *Chain) AddTxReceipt(tx types.Tx, logs []*types.Log, evmRet common.Bytes, ...)
- func (ch *Chain) AddTxsToIndex(block *core.ExtendedBlock, force bool)
- func (ch *Chain) AddVoteToIndex(vote core.Vote)
- func (ch *Chain) CommitBlock(hash common.Hash)
- func (ch *Chain) FinalizePreviousBlocks(hash common.Hash) error
- func (ch *Chain) FindBlock(hash common.Hash) (*core.ExtendedBlock, error)
- func (ch *Chain) FindBlocksByHeight(height uint64) []*core.ExtendedBlock
- func (ch *Chain) FindTxByHash(hash common.Hash) (tx common.Bytes, block *core.ExtendedBlock, founded bool)
- func (ch *Chain) FindTxReceiptByHash(hash common.Hash) (*TxReceiptEntry, bool)
- func (ch *Chain) FindVotesByHash(hash common.Hash) *core.VoteSet
- func (ch *Chain) FixBlockIndex(block *core.ExtendedBlock)
- func (ch *Chain) FixMissingChildren(block *core.ExtendedBlock)
- func (ch *Chain) IsDescendant(ascendantHash common.Hash, descendantHash common.Hash) bool
- func (ch *Chain) IsOrphan(block *core.Block) bool
- func (ch *Chain) MarkBlockHasValidatorUpdate(hash common.Hash) *core.ExtendedBlock
- func (ch *Chain) MarkBlockInvalid(hash common.Hash) *core.ExtendedBlock
- func (ch *Chain) MarkBlockValid(hash common.Hash) *core.ExtendedBlock
- func (ch *Chain) PrintBranch(hash common.Hash) string
- func (ch *Chain) RemoveVotesByHash(hash common.Hash)
- func (ch *Chain) Root() *core.ExtendedBlock
- func (ch *Chain) SaveBlock(block *core.ExtendedBlock) error
- type TxIndexEntry
- type TxReceiptEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreChainsEqual ¶
AreChainsEqual returns whehter two chains are the same.
func AssertChainsEqual ¶
func AssertChainsEqual(assert *assert.Assertions, ch1 *Chain, head1 common.Hash, ch2 *Chain, head2 common.Hash)
AssertChainsEqual asserts that two chains are the same.
func AssertChainsNotEqual ¶
func AssertChainsNotEqual(assert *assert.Assertions, ch1 *Chain, head1 common.Hash, ch2 *Chain, head2 common.Hash)
AssertChainsNotEqual asserts that two chains are not the same.
Types ¶
type BlockByHeightIndexEntry ¶
type Chain ¶
type Chain struct { ChainID string // contains filtered or unexported fields }
Chain represents the blockchain and also is the interface to underlying store.
func CreateTestChainByBlocks ¶
CreateTestChainByBlocks creates a chain with given string slice in format:
[block1_hash, block1_parent_hash, block2_hash, block1_parent_hash, ...]
func (*Chain) AddBlockByHeightIndex ¶
func (*Chain) AddSnapshotRoot ¶
AddSnapshotRoot adds the root block of the chain
func (*Chain) AddTxReceipt ¶
func (ch *Chain) AddTxReceipt(tx types.Tx, logs []*types.Log, evmRet common.Bytes, contractAddr common.Address, gasUsed uint64, evmErr error)
AddTxReceipt adds transaction receipt.
func (*Chain) AddTxsToIndex ¶
func (ch *Chain) AddTxsToIndex(block *core.ExtendedBlock, force bool)
AddTxsToIndex adds transactions in given block to index.
func (*Chain) AddVoteToIndex ¶
AddVoteToIndex adds a vote to index.
func (*Chain) CommitBlock ¶
func (*Chain) FinalizePreviousBlocks ¶
func (*Chain) FindBlocksByHeight ¶
func (ch *Chain) FindBlocksByHeight(height uint64) []*core.ExtendedBlock
FindBlocksByHeight tries to retrieve blocks by height.
func (*Chain) FindTxByHash ¶
func (ch *Chain) FindTxByHash(hash common.Hash) (tx common.Bytes, block *core.ExtendedBlock, founded bool)
FindTxByHash looks up transaction by hash and additionally returns the containing block.
func (*Chain) FindTxReceiptByHash ¶
func (ch *Chain) FindTxReceiptByHash(hash common.Hash) (*TxReceiptEntry, bool)
FindTxReceiptByHash looks up transaction receipt by hash.
func (*Chain) FindVotesByHash ¶
FindVotesByHash looks up votes by hash.
func (*Chain) FixBlockIndex ¶
func (ch *Chain) FixBlockIndex(block *core.ExtendedBlock)
FixBlockIndex fixes index for given block.
func (*Chain) FixMissingChildren ¶
func (ch *Chain) FixMissingChildren(block *core.ExtendedBlock)
FixMissingChildren removes dead links to missing children blocks.
func (*Chain) IsDescendant ¶
IsDescendant determines whether one block is the ascendant of another block.
func (*Chain) MarkBlockHasValidatorUpdate ¶
func (ch *Chain) MarkBlockHasValidatorUpdate(hash common.Hash) *core.ExtendedBlock
func (*Chain) MarkBlockInvalid ¶
func (ch *Chain) MarkBlockInvalid(hash common.Hash) *core.ExtendedBlock
func (*Chain) MarkBlockValid ¶
func (ch *Chain) MarkBlockValid(hash common.Hash) *core.ExtendedBlock
func (*Chain) PrintBranch ¶
PrintBranch return the string describing path from root to given leaf.
func (*Chain) RemoveVotesByHash ¶
RemoveVotesByHash removes votes for givin block.
type TxIndexEntry ¶
TxIndexEntry is a positional metadata to help looking up a transaction given only its hash.