Pubsub for blocks/messages
This commit is contained in:
@@ -5,9 +5,6 @@ import (
|
||||
"fmt"
|
||||
"github.com/filecoin-project/go-lotus/chain"
|
||||
"github.com/filecoin-project/go-lotus/lib/cborrpc"
|
||||
"github.com/filecoin-project/go-lotus/node/modules/helpers"
|
||||
"go.uber.org/fx"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
@@ -102,20 +99,3 @@ func (hs *Service) SayHello(ctx context.Context, pid peer.ID) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Run(mctx helpers.MetricsCtx, lc fx.Lifecycle, hs *Service, h host.Host) {
|
||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||
h.SetStreamHandler(ProtocolID, hs.HandleStream)
|
||||
|
||||
bundle := inet.NotifyBundle{
|
||||
ConnectedF: func(_ inet.Network, c inet.Conn) {
|
||||
go func() {
|
||||
if err := hs.SayHello(ctx, c.RemotePeer()); err != nil {
|
||||
log.Error("failed to say hello: ", err)
|
||||
return
|
||||
}
|
||||
}()
|
||||
},
|
||||
}
|
||||
h.Network().Notify(&bundle)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user