Documentation ¶
Index ¶
- Constants
- type BlockIndex
- func (bIndex *BlockIndex) AddStatus(status uint32)
- func (bIndex *BlockIndex) GetAncestor(height int32) *BlockIndex
- func (bIndex *BlockIndex) GetBlockHash() *util.Hash
- func (bIndex *BlockIndex) GetBlockHeader() *block.BlockHeader
- func (bIndex *BlockIndex) GetBlockPos() block.DiskBlockPos
- func (bIndex *BlockIndex) GetBlockTime() uint32
- func (bIndex *BlockIndex) GetBlockTimeMax() uint32
- func (bIndex *BlockIndex) GetMedianTimePast() int64
- func (bIndex *BlockIndex) GetSerializeList() []string
- func (bIndex *BlockIndex) GetUndoPos() block.DiskBlockPos
- func (bIndex *BlockIndex) HasData() bool
- func (bIndex *BlockIndex) HasUndo() bool
- func (bIndex *BlockIndex) IsGenesis(params *model.BitcoinParams) bool
- func (bIndex *BlockIndex) IsInvalid() bool
- func (bIndex *BlockIndex) IsValid(upto uint32) bool
- func (bIndex *BlockIndex) RaiseValidity(upto uint32) bool
- func (bIndex *BlockIndex) Serialize(w io.Writer) error
- func (bIndex *BlockIndex) SetBlockHash(hash util.Hash)
- func (bIndex *BlockIndex) SetNull()
- func (bIndex *BlockIndex) String() string
- func (bIndex *BlockIndex) SubStatus(status uint32)
- func (bIndex *BlockIndex) Unserialize(r io.Reader) error
Constants ¶
View Source
const ( // BlockValidUnknown : Unused. BlockValidUnknown uint32 = 0 // BlockValidHeader : parsed , version ok , hash satisfies claimed PoW, 1 <= vtx count <=max // timestamp not in future BlockValidHeader uint32 = 1 // BlockValidTree : All parent headers found, difficulty matches, timestamp>= median // previous , checkpoint , Implies all parents are also at least TREE BlockValidTree uint32 = 2 // BlockValidTransactions : Only first tx is coinBase, 2 <= coinBase input script length <= 100, // transactions valid, no duplicate txIds , sigOps , size , merkle root . // Implies all parents are at least TREE but not necessarily TRANSACTIONS. // When all parent blocks also have TRANSACTIONS , CBlockIndex ::nChainTx wll be set BlockValidTransactions uint32 = 3 // BlockValidChain : outputs do not overspend inputs , no double spends , coinBase output ok // no immature coinBase spends , BIP30. // Implies all parents are also at least CHAIN. BlockValidChain uint32 = 4 // BlockValidScripts : Scripts & Signatures ok. Implies all parents are also at least SCRIPTS. BlockValidScripts uint32 = 5 // BlockValidMask : All validity bits // BlockValidMask = BlockValidHeader | // BlockValidTree | // BlockValidTransactions | // BlockValidChain | // BlockValidScripts BlockValidMask uint32 = 0x07 // BlockHaveData : full block available in blk*.dat BlockHaveData uint32 = 8 // BlockHaveUndo Undo data available in rev*.dat BlockHaveUndo uint32 = 16 // BlockFailed The block is invalid. BlockFailed uint32 = 32 // BlockFailedParent The block has an invalid parent. BlockFailedParent uint32 = 64 // BlockInvalidMask Mask used to check if the block failed. BlockInvalidMask = BlockFailed | BlockFailedParent )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockIndex ¶
type BlockIndex struct { Header block.BlockHeader // pointer to the index of the predecessor of this block Prev *BlockIndex // height of the entry in the chain. The genesis block has height 0; Height int32 // Which # file this block is stored in (blk?????.dat) File int32 // Byte offset within blk?????.dat where this block's data is stored DataPos uint32 // Byte offset within rev?????.dat where this block's undo data is stored UndoPos uint32 // (memory only) Total amount of work (expected number of hashes) in the // chain up to and including this block ChainWork big.Int // Number of transactions in this block. // Note: in a potential headers-first mode, this number cannot be relied // upon TxCount int32 // (memory only) Number of transactions in the chain up to and including // this block. // This value will be non-zero only if and only if transactions for this // block and all its parents are available. Change to 64-bit type when // necessary; won't happen before 2030 ChainTxCount int32 //status of this block. See enum Status uint32 // (memory only) Sequential id assigned to distinguish order in which // blocks are received. SequenceID uint64 // (memory only) Maximum time in the chain upto and including this block. TimeMax uint32 // contains filtered or unexported fields }
func NewBlockIndex ¶
func NewBlockIndex(blkHeader *block.BlockHeader) *BlockIndex
func (*BlockIndex) AddStatus ¶
func (bIndex *BlockIndex) AddStatus(status uint32)
func (*BlockIndex) GetAncestor ¶
func (bIndex *BlockIndex) GetAncestor(height int32) *BlockIndex
GetAncestor efficiently find an ancestor of this block.
func (*BlockIndex) GetBlockHash ¶
func (bIndex *BlockIndex) GetBlockHash() *util.Hash
func (*BlockIndex) GetBlockHeader ¶
func (bIndex *BlockIndex) GetBlockHeader() *block.BlockHeader
func (*BlockIndex) GetBlockPos ¶
func (bIndex *BlockIndex) GetBlockPos() block.DiskBlockPos
func (*BlockIndex) GetBlockTime ¶
func (bIndex *BlockIndex) GetBlockTime() uint32
func (*BlockIndex) GetBlockTimeMax ¶
func (bIndex *BlockIndex) GetBlockTimeMax() uint32
func (*BlockIndex) GetMedianTimePast ¶
func (bIndex *BlockIndex) GetMedianTimePast() int64
func (*BlockIndex) GetSerializeList ¶
func (bIndex *BlockIndex) GetSerializeList() []string
func (*BlockIndex) GetUndoPos ¶
func (bIndex *BlockIndex) GetUndoPos() block.DiskBlockPos
func (*BlockIndex) HasData ¶
func (bIndex *BlockIndex) HasData() bool
func (*BlockIndex) HasUndo ¶
func (bIndex *BlockIndex) HasUndo() bool
func (*BlockIndex) IsGenesis ¶
func (bIndex *BlockIndex) IsGenesis(params *model.BitcoinParams) bool
func (*BlockIndex) IsInvalid ¶
func (bIndex *BlockIndex) IsInvalid() bool
IsInvalid checks whether this block index entry is valid up to the passed validity level.
func (*BlockIndex) IsValid ¶
func (bIndex *BlockIndex) IsValid(upto uint32) bool
IsValid checks whether this block index entry is valid up to the passed validity level.
func (*BlockIndex) RaiseValidity ¶
func (bIndex *BlockIndex) RaiseValidity(upto uint32) bool
RaiseValidity Raise the validity level of this block index entry. Returns true if the validity was changed.
func (*BlockIndex) SetBlockHash ¶
func (bIndex *BlockIndex) SetBlockHash(hash util.Hash)
func (*BlockIndex) SetNull ¶
func (bIndex *BlockIndex) SetNull()
func (*BlockIndex) String ¶
func (bIndex *BlockIndex) String() string
func (*BlockIndex) SubStatus ¶
func (bIndex *BlockIndex) SubStatus(status uint32)
func (*BlockIndex) Unserialize ¶
func (bIndex *BlockIndex) Unserialize(r io.Reader) error
Click to show internal directories.
Click to hide internal directories.