Change from floodsub to gossipsub pubsub algorithm in pubsub route

This commit is contained in:
ChronosX88 2020-10-22 18:36:15 +04:00
parent ed675a6b75
commit d717318e71
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -7,7 +7,6 @@ import (
"github.com/Secured-Finance/dione/models" "github.com/Secured-Finance/dione/models"
host "github.com/libp2p/go-libp2p-core/host" host "github.com/libp2p/go-libp2p-core/host"
peer "github.com/libp2p/go-libp2p-core/peer" peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -31,9 +30,9 @@ func NewPubSubRouter(h host.Host, oracleTopic string) *PubSubRouter {
handlers: make(map[string][]Handler), handlers: make(map[string][]Handler),
} }
pb, err := pubsub.NewFloodsubWithProtocols( pb, err := pubsub.NewGossipSub(
context.TODO(), context.TODO(),
psr.node, []protocol.ID{"/dione/1.0.0"}, //pubsub.WithMessageSigning(true), psr.node, //pubsub.WithMessageSigning(true),
//pubsub.WithStrictSignatureVerification(true), //pubsub.WithStrictSignatureVerification(true),
) )
if err != nil { if err != nil {