Documentation ¶
Index ¶
- func ConnectToGRPCServer(addr string) (*grpc.ClientConn, protos.P2PClient)
- type Downloader
- type P2PMessage
- type P2PServer
- func (p2psrv *P2PServer) BlocksInRange(ctx context.Context, in *protos.BlocksInRangeRequest) (*protos.BlocksInRangeResponse, error)
- func (p2psrv *P2PServer) LatestBlock(ctx context.Context, in *protos.LatestBlockRequest) (*protos.LatestBlockResponse, error)
- func (p2psrv *P2PServer) StartServer()
- func (p2psrv *P2PServer) TxPoolPending(ctx context.Context, in *protos.TxpoolPendingRequest) (*protos.TxpoolPendingResponse, error)
- type Peer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToGRPCServer ¶
func ConnectToGRPCServer(addr string) (*grpc.ClientConn, protos.P2PClient)
Types ¶
type Downloader ¶
type Downloader struct { Peers []*Peer Self string TxpoolCh chan *types.Transaction BlockCh chan *types.Block BlockchainDB *dbstore.BlockchainDB }
func NewDownloader ¶
func NewDownloader(self string, initPeers []string, txpoolCh chan *types.Transaction, blockCh chan *types.Block, blockchainDB *dbstore.BlockchainDB) *Downloader
func (*Downloader) GetPeers ¶
func (d *Downloader) GetPeers() []*Peer
func (*Downloader) Start ¶
func (d *Downloader) Start()
type P2PServer ¶
type P2PServer struct { Port string Lis net.Listener GRPCSrv *grpc.Server Peers []string P2PAddrBlockNumberMap map[string]int Downloader *Downloader BlockchainDB *dbstore.BlockchainDB StateDB *dbstore.StateDB Txpool *txpool.TxPool protos.UnimplementedP2PServer }
func (*P2PServer) BlocksInRange ¶
func (p2psrv *P2PServer) BlocksInRange(ctx context.Context, in *protos.BlocksInRangeRequest) (*protos.BlocksInRangeResponse, error)
func (*P2PServer) LatestBlock ¶
func (p2psrv *P2PServer) LatestBlock(ctx context.Context, in *protos.LatestBlockRequest) (*protos.LatestBlockResponse, error)
func (*P2PServer) StartServer ¶
func (p2psrv *P2PServer) StartServer()
func (*P2PServer) TxPoolPending ¶
func (p2psrv *P2PServer) TxPoolPending(ctx context.Context, in *protos.TxpoolPendingRequest) (*protos.TxpoolPendingResponse, error)
type Peer ¶
type Peer struct { Addr string ClientConn *grpc.ClientConn P2PClient protos.P2PClient LatestBlock *types.Block }
func (*Peer) PeerBlocksLoop ¶
func (p *Peer) PeerBlocksLoop(blockCh chan *types.Block, blockchainDB dbstore.BlockchainDB)
func (*Peer) PeerTxpoolLoop ¶
func (p *Peer) PeerTxpoolLoop(txpoolCh chan *types.Transaction)
Click to show internal directories.
Click to hide internal directories.