Documentation ¶
Index ¶
- func Number(blockID thor.Bytes32) uint32
- type Block
- func (b *Block) Body() *Body
- func (b *Block) DecodeRLP(s *rlp.Stream) error
- func (b *Block) EncodeRLP(w io.Writer) error
- func (b *Block) Header() *Header
- func (b *Block) Size() metric.StorageSize
- func (b *Block) String() string
- func (b *Block) Transactions() tx.Transactions
- func (b *Block) WithSignature(sig []byte) *Block
- type Body
- type Builder
- func (b *Builder) Beneficiary(addr thor.Address) *Builder
- func (b *Builder) Build() *Block
- func (b *Builder) GasLimit(limit uint64) *Builder
- func (b *Builder) GasUsed(used uint64) *Builder
- func (b *Builder) ParentID(id thor.Bytes32) *Builder
- func (b *Builder) ReceiptsRoot(hash thor.Bytes32) *Builder
- func (b *Builder) StateRoot(hash thor.Bytes32) *Builder
- func (b *Builder) Timestamp(ts uint64) *Builder
- func (b *Builder) TotalScore(score uint64) *Builder
- func (b *Builder) Transaction(tx *tx.Transaction) *Builder
- func (b *Builder) TransactionFeatures(features tx.Features) *Builder
- type GasLimit
- type Header
- func (h *Header) Beneficiary() thor.Address
- func (h *Header) DecodeRLP(s *rlp.Stream) error
- func (h *Header) EncodeRLP(w io.Writer) error
- func (h *Header) GasLimit() uint64
- func (h *Header) GasUsed() uint64
- func (h *Header) ID() (id thor.Bytes32)
- func (h *Header) Number() uint32
- func (h *Header) ParentID() thor.Bytes32
- func (h *Header) ReceiptsRoot() thor.Bytes32
- func (h *Header) Signature() []byte
- func (h *Header) Signer() (signer thor.Address, err error)
- func (h *Header) SigningHash() (hash thor.Bytes32)
- func (h *Header) StateRoot() thor.Bytes32
- func (h *Header) String() string
- func (h *Header) Timestamp() uint64
- func (h *Header) TotalScore() uint64
- func (h *Header) TxsFeatures() tx.Features
- func (h *Header) TxsRoot() thor.Bytes32
- type Raw
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block is an immutable block type.
func Compose ¶
func Compose(header *Header, txs tx.Transactions) *Block
Compose compose a block with all needed components Note: This method is usually to recover a block by its portions, and the TxsRoot is not verified. To build up a block, use a Builder.
func (*Block) Transactions ¶
func (b *Block) Transactions() tx.Transactions
Transactions returns a copy of transactions.
func (*Block) WithSignature ¶
WithSignature create a new block object with signature set.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder to make it easy to build a block object.
func (*Builder) Beneficiary ¶
Beneficiary set recipient of reward.
func (*Builder) ReceiptsRoot ¶
ReceiptsRoot set receipts root.
func (*Builder) TotalScore ¶
TotalScore set total score.
func (*Builder) Transaction ¶
func (b *Builder) Transaction(tx *tx.Transaction) *Builder
Transaction add a transaction.
type GasLimit ¶
type GasLimit uint64
GasLimit to support block gas limit validation and adjustment.
func (GasLimit) Adjust ¶
Adjust suppose the receiver is parent gas limit, and calculate a valid gas limit value by apply `delta`.
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header contains almost all information about a block, except block body. It's immutable.
func (*Header) Beneficiary ¶
Beneficiary returns reward recipient.
func (*Header) ID ¶
ID computes id of block. The block ID is defined as: blockNumber + hash(signingHash, signer)[4:].
func (*Header) ReceiptsRoot ¶
ReceiptsRoot returns merkle root of tx receipts.
func (*Header) SigningHash ¶
SigningHash computes hash of all header fields excluding signature.
func (*Header) StateRoot ¶
StateRoot returns account state merkle root just afert this block being applied.
func (*Header) TotalScore ¶
TotalScore returns total score that cumulated from genesis block to this one.
func (*Header) TxsFeatures ¶ added in v1.1.0
TxsFeatures returns supported txs features.