cluster

package
v0.33.24-atree-inlining Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2024 License: AGPL-3.0 Imports: 2 Imported by: 6

Documentation

Overview

Package cluster contains models related to collection node cluster consensus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Header  *flow.Header
	Payload *Payload
}

Block represents a block in collection node cluster consensus. It contains a standard block header with a payload containing only a single collection.

func Genesis

func Genesis() *Block

func (Block) ID

func (b Block) ID() flow.Identifier

ID returns the ID of the underlying block header.

func (*Block) SetPayload

func (b *Block) SetPayload(payload Payload)

SetPayload sets the payload and payload hash.

type Payload

type Payload struct {

	// Collection is the collection being created.
	Collection flow.Collection

	// ReferenceBlockID is the ID of a reference block on the main chain. It
	// is defined as the ID of the reference block with the lowest height
	// from all transactions within the collection. If the collection is empty,
	// the proposer may choose any reference block, so long as it is finalized
	// and within the epoch the cluster is associated with. If a cluster was
	// assigned for epoch E, then all of its reference blocks must have a view
	// in the range [E.FirstView, E.FinalView]. However, if epoch fallback is
	// triggered in epoch E, then any reference block with view ≥ E.FirstView
	// may be used.
	//
	// This determines when the collection expires, using the same expiry rules
	// as transactions. It is also used as the reference point for committee
	// state (staking, etc.) when validating the containing block.
	//
	// The root block of a cluster chain has an empty reference block ID, as it
	// is created in advance of its members (necessarily) being authorized network
	// members. It is invalid for any non-root block to have an empty reference
	// block ID.
	ReferenceBlockID flow.Identifier
}

Payload is the payload for blocks in collection node cluster consensus. It contains only a single collection.

func EmptyPayload

func EmptyPayload(refID flow.Identifier) Payload

EmptyPayload returns a payload with an empty collection and the given reference block ID.

func PayloadFromTransactions

func PayloadFromTransactions(refID flow.Identifier, transactions ...*flow.TransactionBody) Payload

PayloadFromTransactions creates a payload given a reference block ID and a list of transaction hashes.

func (Payload) Fingerprint

func (p Payload) Fingerprint() []byte

func (Payload) Hash

func (p Payload) Hash() flow.Identifier

Hash returns the hash of the payload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL