rootchain

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: AGPL-3.0, ISC Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSignerIsNil = errors.New("signer is nil")

Functions

func GetPublicKeyAndVerifier

func GetPublicKeyAndVerifier(signer crypto.Signer) ([]byte, crypto.Verifier, error)

func NewGenesis

func NewGenesis(partitions []*genesis.PartitionRecord, rootSigner crypto.Signer, encPubKey crypto.Verifier) (*genesis.RootGenesis, []*genesis.PartitionGenesis, error)

NewGenesis creates a new genesis for the root chain and each partition.

func NewGenesisFromPartitionNodes

func NewGenesisFromPartitionNodes(nodes []*genesis.PartitionNode, rootSigner crypto.Signer, encPubKey crypto.Verifier) (*genesis.RootGenesis, []*genesis.PartitionGenesis, error)

NewGenesisFromPartitionNodes creates a new genesis for the root chain and partitions.

Types

type Net

type Net interface {
	Send(msg network.OutputMessage, receivers []peer.ID) error
	ReceivedChannel() <-chan network.ReceivedMessage
}

Net provides an interface for sending messages to and receiving messages from other nodes in the network.

type Option

type Option func(c *rootChainConf)

func WithT3Timeout

func WithT3Timeout(timeout time.Duration) Option

type RootChain

type RootChain struct {
	// contains filtered or unexported fields
}

func NewRootChain

func NewRootChain(peer *network.Peer, genesis *genesis.RootGenesis, signer crypto.Signer, net Net, opts ...Option) (*RootChain, error)

NewRootChain creates a new instance of the root chain.

func (*RootChain) Close

func (rc *RootChain) Close()

type State

type State struct {
	// contains filtered or unexported fields
}

State holds the State of the root chain.

func NewStateFromGenesis

func NewStateFromGenesis(g *genesis.RootGenesis, signer crypto.Signer) (*State, error)

func NewStateFromPartitionRecords

func NewStateFromPartitionRecords(partitions []*genesis.PartitionRecord, signer crypto.Signer, hashAlgorithm gocrypto.Hash) (*State, error)

NewStateFromPartitionRecords creates the State from the genesis.PartitionRecord array. The State returned by this method is usually used to generate genesis file.

func (*State) CopyOldInputRecords

func (s *State) CopyOldInputRecords(identifier string)

CopyOldInputRecords copies input records from the latest unicity certificates to inputRecords.

func (*State) CreateUnicityCertificates

func (s *State) CreateUnicityCertificates() ([]string, error)

func (*State) GetLatestUnicityCertificate

func (s *State) GetLatestUnicityCertificate(systemID string) *certificates.UnicityCertificate

func (*State) GetRoundNumber

func (s *State) GetRoundNumber() uint64

func (*State) HandleBlockCertificationRequest

func (s *State) HandleBlockCertificationRequest(req *certification.BlockCertificationRequest) (*certificates.UnicityCertificate, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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