gossip

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TxTopicName is the topic name for transactions.
	TxTopicName = "coin.tx"

	// BlockTopicName is the topic name for blocks.
	BlockTopicName = "coin.block"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Gossip

type Gossip interface {
	// ListenTx passes incoming transactions to a callback.
	// Only valid transactions will be passed to the callback.
	ListenTx(ctx context.Context, processTx func(*pb.Transaction) error) error
	// ListenBlock passes incoming blocks to a callback.
	// Only valid blocks will be passed to the callback.
	// A synchronous callback is given to sync the local chain.
	ListenBlock(ctx context.Context, processBlock func(*pb.Block) error, sync func([]byte) error) error
	// PublishTx sends a new transaction to the gossip.
	PublishTx(tx *pb.Transaction) error
	// PublishBlock sends a new block to the gossip.
	PublishBlock(block *pb.Block) error

	// AddBlockListener returns a channel on which new valid
	// block headers received will be published.
	AddBlockListener() chan *pb.Header

	// Close closes the gossip layer.
	Close() error
}

Gossip is an interface used to gossip transactions and blocks.

func NewGossip

func NewGossip(
	h host.Host,
	p *pubsub.PubSub,
	s state.Reader,
	c chain.Reader,
	v validator.Validator,
) Gossip

NewGossip returns gossip.

Directories

Path Synopsis
Package mockgossip is a generated GoMock package.
Package mockgossip is a generated GoMock package.

Jump to

Keyboard shortcuts

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