cluster

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 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

	// ReferenceEpoch is the epoch counter to use as reference. This is only
	// valid for root blocks, since these are generated in advance of a reference
	// block being available.
	// TODO needs more thought: https://github.com/dapperlabs/flow-go/issues/4655
	ReferenceEpoch uint64

	// 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.
	//
	// 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.
	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.

type PendingBlock

type PendingBlock struct {
	OriginID flow.Identifier
	Header   *flow.Header
	Payload  *Payload
}

PendingBlock is a wrapper type representing a block that cannot yet be processed. The block header, payload, and sender ID are stored together while waiting for the block to become processable.

Jump to

Keyboard shortcuts

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