Documentation ¶
Index ¶
- Variables
- type Header
- func (h *Header) DecodeRLP(s *rlp.Stream) error
- func (h *Header) EncodeRLP(w io.Writer) error
- func (h *Header) Hash() ethcommon.Hash
- func (h *Header) IsLastBlockInEpoch() bool
- func (h *Header) Logger(logger *zerolog.Logger) *zerolog.Logger
- func (h Header) MarshalJSON() ([]byte, error)
- func (h Header) String() string
- func (h *Header) With() HeaderFieldSetter
- type HeaderFieldSetter
- func (s HeaderFieldSetter) Bloom(newBloom types.Bloom) HeaderFieldSetter
- func (s HeaderFieldSetter) Coinbase(newCoinbase common.Address) HeaderFieldSetter
- func (s HeaderFieldSetter) CrossLinks(newCrossLinks []byte) HeaderFieldSetter
- func (s HeaderFieldSetter) Epoch(newEpoch *big.Int) HeaderFieldSetter
- func (s HeaderFieldSetter) Extra(newExtra []byte) HeaderFieldSetter
- func (s HeaderFieldSetter) GasLimit(newGasLimit uint64) HeaderFieldSetter
- func (s HeaderFieldSetter) GasUsed(newGasUsed uint64) HeaderFieldSetter
- func (s HeaderFieldSetter) Header() *Header
- func (s HeaderFieldSetter) IncomingReceiptHash(newIncomingReceiptHash common.Hash) HeaderFieldSetter
- func (s HeaderFieldSetter) LastCommitBitmap(newLastCommitBitmap []byte) HeaderFieldSetter
- func (s HeaderFieldSetter) LastCommitSignature(newLastCommitSignature [96]byte) HeaderFieldSetter
- func (s HeaderFieldSetter) MixDigest(newMixDigest common.Hash) HeaderFieldSetter
- func (s HeaderFieldSetter) Number(newNumber *big.Int) HeaderFieldSetter
- func (s HeaderFieldSetter) OutgoingReceiptHash(newOutgoingReceiptHash common.Hash) HeaderFieldSetter
- func (s HeaderFieldSetter) ParentHash(newParentHash common.Hash) HeaderFieldSetter
- func (s HeaderFieldSetter) ReceiptHash(newReceiptHash common.Hash) HeaderFieldSetter
- func (s HeaderFieldSetter) Root(newRoot common.Hash) HeaderFieldSetter
- func (s HeaderFieldSetter) ShardID(newShardID uint32) HeaderFieldSetter
- func (s HeaderFieldSetter) ShardState(newShardState []byte) HeaderFieldSetter
- func (s HeaderFieldSetter) ShardStateHash(newShardStateHash common.Hash) HeaderFieldSetter
- func (s HeaderFieldSetter) Time(newTime *big.Int) HeaderFieldSetter
- func (s HeaderFieldSetter) TxHash(newTxHash common.Hash) HeaderFieldSetter
- func (s HeaderFieldSetter) Vdf(newVdf []byte) HeaderFieldSetter
- func (s HeaderFieldSetter) ViewID(newViewID *big.Int) HeaderFieldSetter
- func (s HeaderFieldSetter) Vrf(newVrf []byte) HeaderFieldSetter
- type HeaderPair
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHeaderIsNil .. ErrHeaderIsNil = errors.New("cannot encode nil header receiver") )
var HeaderRegistry = taggedrlp.NewRegistry()
HeaderRegistry is the taggedrlp type registry for versioned headers.
Functions ¶
This section is empty.
Types ¶
type Header ¶
Header represents a block header in the Harmony blockchain.
func (*Header) Hash ¶
Hash returns the block hash of the header. This uses HeaderRegistry to choose and return the right tagged RLP form of the header.
func (*Header) IsLastBlockInEpoch ¶ added in v1.10.0
IsLastBlockInEpoch returns True if it is the last block of the epoch. Note that the last block contains the shard state of the next epoch.
func (Header) MarshalJSON ¶ added in v1.2.7
MarshalJSON ..
func (*Header) With ¶
func (h *Header) With() HeaderFieldSetter
With returns a field setter context for the header.
Call a chain of setters on the returned field setter, followed by a call of Header method. Example:
header := NewHeader(epoch).With(). ParentHash(parent.Hash()). ShardID(parent.ShardID()). Number(new(big.Int).Add(parent.Number(), big.NewInt(1)). Header()
type HeaderFieldSetter ¶
type HeaderFieldSetter struct {
// contains filtered or unexported fields
}
HeaderFieldSetter is a header field setter.
See NewHeaderWith for how it is used.
func (HeaderFieldSetter) Bloom ¶
func (s HeaderFieldSetter) Bloom(newBloom types.Bloom) HeaderFieldSetter
Bloom sets the smart contract log Bloom filter for this block.
func (HeaderFieldSetter) Coinbase ¶
func (s HeaderFieldSetter) Coinbase(newCoinbase common.Address) HeaderFieldSetter
Coinbase sets the coinbase address field.
func (HeaderFieldSetter) CrossLinks ¶
func (s HeaderFieldSetter) CrossLinks(newCrossLinks []byte) HeaderFieldSetter
CrossLinks sets the RLP-encoded form of non-beacon block headers chosen to be canonical by the beacon committee.
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) Epoch ¶
func (s HeaderFieldSetter) Epoch(newEpoch *big.Int) HeaderFieldSetter
Epoch sets the epoch number of this block.
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) Extra ¶
func (s HeaderFieldSetter) Extra(newExtra []byte) HeaderFieldSetter
Extra sets the extra data field of this block.
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) GasLimit ¶
func (s HeaderFieldSetter) GasLimit(newGasLimit uint64) HeaderFieldSetter
GasLimit sets the gas limit for transactions in this block.
func (HeaderFieldSetter) GasUsed ¶
func (s HeaderFieldSetter) GasUsed(newGasUsed uint64) HeaderFieldSetter
GasUsed sets the amount of gas used by transactions in this block.
func (HeaderFieldSetter) Header ¶
func (s HeaderFieldSetter) Header() *Header
Header returns the header whose fields have been set. Call this at the end of a field setter chain.
func (HeaderFieldSetter) IncomingReceiptHash ¶
func (s HeaderFieldSetter) IncomingReceiptHash(newIncomingReceiptHash common.Hash) HeaderFieldSetter
IncomingReceiptHash sets the ingress transaction receipt trie hash.
func (HeaderFieldSetter) LastCommitBitmap ¶
func (s HeaderFieldSetter) LastCommitBitmap(newLastCommitBitmap []byte) HeaderFieldSetter
LastCommitBitmap sets the signatory bitmap of the previous block.
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) LastCommitSignature ¶
func (s HeaderFieldSetter) LastCommitSignature(newLastCommitSignature [96]byte) HeaderFieldSetter
LastCommitSignature sets the FBFT commit group signature for the last block.
func (HeaderFieldSetter) MixDigest ¶
func (s HeaderFieldSetter) MixDigest(newMixDigest common.Hash) HeaderFieldSetter
MixDigest sets the mixhash of this block.
func (HeaderFieldSetter) Number ¶
func (s HeaderFieldSetter) Number(newNumber *big.Int) HeaderFieldSetter
Number sets the block number.
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) OutgoingReceiptHash ¶
func (s HeaderFieldSetter) OutgoingReceiptHash(newOutgoingReceiptHash common.Hash) HeaderFieldSetter
OutgoingReceiptHash sets the egress transaction receipt trie hash.
func (HeaderFieldSetter) ParentHash ¶
func (s HeaderFieldSetter) ParentHash(newParentHash common.Hash) HeaderFieldSetter
ParentHash sets the parent hash field.
func (HeaderFieldSetter) ReceiptHash ¶
func (s HeaderFieldSetter) ReceiptHash(newReceiptHash common.Hash) HeaderFieldSetter
ReceiptHash sets the same-shard transaction receipt trie hash.
func (HeaderFieldSetter) Root ¶
func (s HeaderFieldSetter) Root(newRoot common.Hash) HeaderFieldSetter
Root sets the state trie root hash field.
func (HeaderFieldSetter) ShardID ¶
func (s HeaderFieldSetter) ShardID(newShardID uint32) HeaderFieldSetter
ShardID sets the shard ID to which this block belongs.
func (HeaderFieldSetter) ShardState ¶
func (s HeaderFieldSetter) ShardState(newShardState []byte) HeaderFieldSetter
ShardState sets the RLP-encoded form of shard state
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) ShardStateHash ¶
func (s HeaderFieldSetter) ShardStateHash(newShardStateHash common.Hash) HeaderFieldSetter
ShardStateHash sets the shard state hash.
func (HeaderFieldSetter) Time ¶
func (s HeaderFieldSetter) Time(newTime *big.Int) HeaderFieldSetter
Time sets the UNIX timestamp of this block.
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) TxHash ¶
func (s HeaderFieldSetter) TxHash(newTxHash common.Hash) HeaderFieldSetter
TxHash sets the transaction trie root hash field.
func (HeaderFieldSetter) Vdf ¶
func (s HeaderFieldSetter) Vdf(newVdf []byte) HeaderFieldSetter
Vdf sets the output of the VDF for the epoch.
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) ViewID ¶
func (s HeaderFieldSetter) ViewID(newViewID *big.Int) HeaderFieldSetter
ViewID sets the view ID in which the block was originally proposed.
It stores a copy; the caller may freely modify the original.
func (HeaderFieldSetter) Vrf ¶
func (s HeaderFieldSetter) Vrf(newVrf []byte) HeaderFieldSetter
Vrf sets the output of the VRF for the epoch.
It stores a copy; the caller may freely modify the original.
type HeaderPair ¶ added in v1.2.7
type HeaderPair struct { BeaconHeader *Header `json:"beacon-chain-header"` ShardHeader *Header `json:"shard-chain-header"` }
HeaderPair ..