processing

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxFrameSize = uint64(250000)
)

Variables

This section is empty.

Functions

func GetMempoolTxs

func GetMempoolTxs(bus *wire.RPCBus, txID []byte) ([]transactions.Transaction, error)

GetMempoolTxs is a wire.GetMempoolTx API wrapper. Later it could be moved into a separate utils pkg

func ReadFrame

func ReadFrame(r io.Reader) ([]byte, error)

func WriteFrame

func WriteFrame(buf *bytes.Buffer) (*bytes.Buffer, error)

BuildFrame builds a length-prefixing wire message frame

Types

type BlockHashBroker

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

BlockHashBroker is a processing unit which handles GetBlocks messages. It has a database connection, and a channel pointing to the outgoing message queue of the requesting peer.

func NewBlockHashBroker

func NewBlockHashBroker(db database.DB, responseChan chan<- *bytes.Buffer) *BlockHashBroker

NewBlockHashBroker will return an initialized BlockHashBroker.

func (*BlockHashBroker) AdvertiseMissingBlocks

func (b *BlockHashBroker) AdvertiseMissingBlocks(m *bytes.Buffer) error

AdvertiseMissingBlocks takes a GetBlocks wire message, finds the requesting peer's height, and returns an inventory message of up to 500 blocks which follow the provided locator.

type DataBroker

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

DataBroker is a processing unit responsible for handling GetData messages. It maintains a connection to the outgoing message queue of the peer it receives this message from.

func NewDataBroker

func NewDataBroker(db database.DB, rpcBus *wire.RPCBus, responseChan chan<- *bytes.Buffer) *DataBroker

NewDataBroker returns an initialized DataBroker.

func (*DataBroker) SendItems

func (d *DataBroker) SendItems(m *bytes.Buffer) error

SendItems takes a GetData message from the wire, and iterates through the list, sending back each item's complete data to the requesting peer.

func (*DataBroker) SendTxsItems

func (d *DataBroker) SendTxsItems() error

type DataRequestor

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

DataRequestor is a processing unit which handles inventory messages received from peers on the Dusk wire protocol. It maintains a connection to the outgoing message queue of an individual peer.

func NewDataRequestor

func NewDataRequestor(db database.DB, rpcBus *wire.RPCBus, responseChan chan<- *bytes.Buffer) *DataRequestor

NewDataRequestor returns an initialized DataRequestor.

func (*DataRequestor) RequestMempoolItems

func (d *DataRequestor) RequestMempoolItems() error

RequestMempoolItems sends topics.Mempool to request available mempool txs

func (*DataRequestor) RequestMissingItems

func (d *DataRequestor) RequestMissingItems(m *bytes.Buffer) error

AskForMissingItems takes an inventory message, checks it for any items that the node is missing, puts these items in a GetData wire message, and sends it off to the peer's outgoing message queue, requesting the items in full.

type Gossip

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

Gossip is a preprocessor for gossip messages.

func NewGossip

func NewGossip(magic protocol.Magic) *Gossip

NewGossip returns a gossip preprocessor with the specified magic.

func (*Gossip) Process

func (g *Gossip) Process(m *bytes.Buffer) (*bytes.Buffer, error)

Process a message that is passing through, by prepending the network magic to the buffer, and then COBS encoding it.

func (*Gossip) Write

func (h *Gossip) Write(m *bytes.Buffer) (*bytes.Buffer, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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