Documentation
¶
Index ¶
Constants ¶
View Source
const NoLimit uint64 = math.MaxUint64
Request unlimited certificates.
Variables ¶
This section is empty.
Functions ¶
func FetchProtocolName ¶
func FetchProtocolName(nn gpbft.NetworkName) protocol.ID
Types ¶
type Client ¶
Client is a libp2p certificate exchange client for requesting finality certificates from specific peers.
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, p peer.ID, req *Request) (_rh *ResponseHeader, _ch <-chan *certs.FinalityCertificate, _err error)
Request finality certificates from the specified peer. Returned finality certificates start at the requested instance number and are sequential, but are otherwise unvalidated.
type Request ¶
type Request struct {
// First instance to fetch.
FirstInstance uint64
// Max number of instances to fetch. The server may respond with fewer certificates than
// requested, even if more are available.
Limit uint64
// Include the full power table needed to validate the first finality certificate.
// Checked by the user against their last finality certificate.
IncludePowerTable bool
}
type ResponseHeader ¶
type ResponseHeader struct {
// The next instance to be finalized. This is 0 when no instances have been finalized.
PendingInstance uint64
// Power table, if requested, or empty.
PowerTable gpbft.PowerEntries
}
func (*ResponseHeader) MarshalCBOR ¶
func (t *ResponseHeader) MarshalCBOR(w io.Writer) error
func (*ResponseHeader) UnmarshalCBOR ¶
func (t *ResponseHeader) UnmarshalCBOR(r io.Reader) (err error)
type Server ¶
type Server struct {
// Request timeouts. If non-zero, requests will be canceled after the specified duration.
RequestTimeout time.Duration
NetworkName gpbft.NetworkName
Host host.Host
Store *certstore.Store
// contains filtered or unexported fields
}
Server is libp2p a certificate exchange server.
Click to show internal directories.
Click to hide internal directories.