candidate

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate added in v0.3.0

func Validate(m message.Message) error

Validate an incoming Candidate message.

func ValidateCandidate added in v0.3.0

func ValidateCandidate(cm block.Block) error

ValidateCandidate makes sure the hash and root are correct, to avoid malicious nodes from overwriting the candidate block for a specific hash.

Types

type Requestor added in v0.4.0

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

Requestor serves to retrieve certain Candidate messages from peers in the network.

func NewRequestor added in v0.4.0

func NewRequestor(publisher eventbus.Publisher) *Requestor

NewRequestor returns an initialized Requestor struct.

func (*Requestor) ProcessCandidate added in v0.4.0

func (r *Requestor) ProcessCandidate(srcPeerID string, msg message.Message) ([]bytes.Buffer, error)

ProcessCandidate will process a received Candidate message. Invalid and non-matching Candidate messages are discarded.

func (*Requestor) RequestCandidate added in v0.4.0

func (r *Requestor) RequestCandidate(ctx context.Context, hash []byte) (block.Block, error)

RequestCandidate will attempt to fetch a Candidate message for a given hash from the network.

Jump to

Keyboard shortcuts

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