txsync

package
v0.2201.6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGetTxs              = "GetTxs"
	MaxGetTxsResponseTime     = 5 * time.Second
	MaxGetTxsCount            = 128
	MaxGetTxsParallelRequests = 5
)

Constants related to the GetTxs method.

View Source
const TxSyncProtocolID = "txsync"

TxSyncProtocolID is a unique protocol identifier for the transaction sync protocol.

Variables

View Source
var TxSyncProtocolVersion = version.Version{Major: 1, Minor: 0, Patch: 0}

TxSyncProtocolVersion is the supported version of the transaction sync protocol.

Functions

func NewServer

func NewServer(runtimeID common.Namespace, txPool txpool.TransactionPool) rpc.Server

NewServer creates a new transaction sync protocol server.

Types

type Client

type Client interface {
	// GetTxs queries peers for transaction data.
	GetTxs(ctx context.Context, request *GetTxsRequest) (*GetTxsResponse, error)
}

Client is a transaction sync protocol client.

func NewClient

func NewClient(p2p rpc.P2P, runtimeID common.Namespace) Client

NewClient creates a new transaction sync protocol client.

type GetTxsRequest

type GetTxsRequest struct {
	Txs []hash.Hash `json:"txs"`
}

GetTxsRequest is a GetTxs request.

type GetTxsResponse

type GetTxsResponse struct {
	Txs [][]byte `json:"txs,omitempty"`
}

GetTxsResponse is a response to a GetTxs request.

Jump to

Keyboard shortcuts

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