// Request send a rpc call to connected peers.
Request send a rpc call to connected peers.
// Request send a rpc call to connected peers .
func (ln *LNode) Request(method string) {
	var responses []*pb.Response
	var wg sync.WaitGroup
	for _, peerID := range ln.Peers {
		log.WithFields(log.Fields{
			"peer-id": peerID,
			"method":  method,
		}).Info("Request sent")
		wg.Add(1)
		go func(pid peer.ID) {
			respPb, err := ln.RequestToPeer(pid, method)
			if err != nil {
				log.Warn(err)
				return
			}
			responses = append(responses, respPb)
		}(peerID)
	}
	wg.Wait()
	log.Println(responses)
}
func ( ln * LNode ) Request ( method string ) { var responses [ ] * pb . Response var wg sync . WaitGroup for _ , peerID := range ln . Peers { log . WithFields ( log . Fields { " " : peerID , " " : method , } ) . Info ( " " ) wg . Add ( 1 ) go func ( pid peer . ID ) { respPb , err := ln . RequestToPeer ( pid , method ) if err != nil { log . Warn ( err ) return } responses = append ( responses , respPb ) } ( peerID ) } wg . Wait ( ) log . Println ( responses ) }
Request send a rpc call to connected peers.
Request send a rpc call to connected peers .