gossip

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Client handles outbound gossip

func (*Client) Close

func (mb *Client) Close()

Close will stop the gossip bus such that it can not be started again

func (*Client) Done

func (mb *Client) Done() <-chan struct{}

Done blocks until the service has an exit

func (*Client) Init

func (mb *Client) Init(database *db.Database, peerSub interfaces.PeerSubscription, app appClient) error

Init sets ups all subscriptions. This MUST be run at least once. It has no effect if run more than once.

func (*Client) ReGossip

func (mb *Client) ReGossip() error

ReGossip performs the reGossip logic

func (*Client) Start

func (mb *Client) Start() error

Start will start the service

type Handlers

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

Handlers consumes gossip and updates local state

func (*Handlers) Close

func (mb *Handlers) Close()

Close will shut down the gossip system such that it can not be restarted

func (*Handlers) Done

func (mb *Handlers) Done() <-chan struct{}

Done blocks until the service has an exit

func (*Handlers) HandleP2PGossipBlockHeader

func (mb *Handlers) HandleP2PGossipBlockHeader(pctx context.Context, msg *pb.GossipBlockHeaderMessage) (*pb.GossipBlockHeaderAck, error)

HandleP2PGossipBlockHeader adds a nextHeight to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) HandleP2PGossipNextHeight

func (mb *Handlers) HandleP2PGossipNextHeight(pctx context.Context, msg *pb.GossipNextHeightMessage) (*pb.GossipNextHeightAck, error)

HandleP2PGossipNextHeight adds a nextHeight to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) HandleP2PGossipNextRound

func (mb *Handlers) HandleP2PGossipNextRound(pctx context.Context, msg *pb.GossipNextRoundMessage) (*pb.GossipNextRoundAck, error)

HandleP2PGossipNextRound adds a nextRound to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) HandleP2PGossipPreCommit

func (mb *Handlers) HandleP2PGossipPreCommit(pctx context.Context, msg *pb.GossipPreCommitMessage) (*pb.GossipPreCommitAck, error)

HandleP2PGossipPreCommit adds a preCommit to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) HandleP2PGossipPreCommitNil

func (mb *Handlers) HandleP2PGossipPreCommitNil(pctx context.Context, msg *pb.GossipPreCommitNilMessage) (*pb.GossipPreCommitNilAck, error)

HandleP2PGossipPreCommitNil adds a preCommitNil to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) HandleP2PGossipPreVote

func (mb *Handlers) HandleP2PGossipPreVote(pctx context.Context, msg *pb.GossipPreVoteMessage) (*pb.GossipPreVoteAck, error)

HandleP2PGossipPreVote adds a preVote to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) HandleP2PGossipPreVoteNil

func (mb *Handlers) HandleP2PGossipPreVoteNil(pctx context.Context, msg *pb.GossipPreVoteNilMessage) (*pb.GossipPreVoteNilAck, error)

HandleP2PGossipPreVoteNil adds a preVoteNil to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) HandleP2PGossipProposal

func (mb *Handlers) HandleP2PGossipProposal(pctx context.Context, msg *pb.GossipProposalMessage) (*pb.GossipProposalAck, error)

HandleP2PGossipProposal adds a proposal to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) HandleP2PGossipTransaction

func (mb *Handlers) HandleP2PGossipTransaction(pctx context.Context, msg *pb.GossipTransactionMessage) (*pb.GossipTransactionAck, error)

HandleP2PGossipTransaction adds a transaction to the database This method should be invoked when a remote peer sends this type of object to the local node over the gossip protocol

func (*Handlers) Init

func (mb *Handlers) Init(database *db.Database, peerSub interfaces.PeerSubscription, app appHandler, handlers *lstate.Handlers) error

Init will initialize the gossip consumer it must be run at least once and will have no effect if run more than once

func (*Handlers) UpdateBlocksFromGossip

func (mb *Handlers) UpdateBlocksFromGossip() error

UpdateBlocksFromGossip stores blocks only from a remote node

func (*Handlers) UpdateStateFromGossip

func (mb *Handlers) UpdateStateFromGossip(forceExit <-chan struct{}, mut interfaces.Lockable, safe func() bool) error

UpdateStateFromGossip stores messages from a remote node

Jump to

Keyboard shortcuts

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