Versions in this module Expand all Collapse all v1 v1.1.0 Oct 24, 2023 v1.0.0 Oct 17, 2023 Changes in this version + func ConnectToGRPCServer(addr string) (*grpc.ClientConn, protos.P2PClient) + type Downloader struct + BlockCh chan *types.Block + BlockchainDB *dbstore.BlockchainDB + Peers []*Peer + Self string + TxpoolCh chan *types.Transaction + func NewDownloader(self string, initPeers []string, txpoolCh chan *types.Transaction, ...) *Downloader + func (d *Downloader) GetPeers() []*Peer + func (d *Downloader) Start() + type P2PMessage struct + Error error + From string + Message string + Query string + type P2PServer struct + BlockchainDB *dbstore.BlockchainDB + Downloader *Downloader + GRPCSrv *grpc.Server + Lis net.Listener + P2PAddrBlockNumberMap map[string]int + P2PAddrBroadcastMapmu sync.Mutex + Peers []string + Peersmu sync.Mutex + Port string + StateDB *dbstore.StateDB + Txpool *txpool.TxPool + func NewServer(port string, initPeers []string, statedb *dbstore.StateDB, ...) *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 struct + Addr string + ClientConn *grpc.ClientConn + LatestBlock *types.Block + P2PClient protos.P2PClient + func (p *Peer) PeerBlocksLoop(blockCh chan *types.Block, blockchainDB dbstore.BlockchainDB) + func (p *Peer) PeerTxpoolLoop(txpoolCh chan *types.Transaction)