Change temporarily pubsub engine to FloodSub

This commit is contained in:
ChronosX88 2021-07-29 00:47:09 +03:00
parent 1670a6b287
commit cd671e6165
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A
2 changed files with 15 additions and 11 deletions

View File

@ -28,8 +28,13 @@ func ValidateGetTransaction(task *types.DioneTask) error {
return validation.VerifyExactMatching(task) return validation.VerifyExactMatching(task)
} }
func ValidateGetBlock(task *types.DioneTask) error {
return validation.VerifyExactMatching(task)
}
func init() { func init() {
validation.RegisterValidation(rtypes.RPCTypeFilecoin, map[string]func(*types.DioneTask) error{ validation.RegisterValidation(rtypes.RPCTypeFilecoin, map[string]func(*types.DioneTask) error{
"getTransaction": ValidateGetTransaction, "getTransaction": ValidateGetTransaction,
"getBlock": ValidateGetBlock,
}) })
} }

View File

@ -2,7 +2,6 @@ package pubsub
import ( import (
"context" "context"
"time"
"github.com/fxamacker/cbor/v2" "github.com/fxamacker/cbor/v2"
@ -40,19 +39,19 @@ func NewPubSubRouter(h host.Host, oracleTopic string, isBootstrap bool) *PubSubR
if isBootstrap { if isBootstrap {
// turn off the mesh in bootstrappers -- only do gossip and PX // turn off the mesh in bootstrappers -- only do gossip and PX
pubsub.GossipSubD = 0 //pubsub.GossipSubD = 0
pubsub.GossipSubDscore = 0 //pubsub.GossipSubDscore = 0
pubsub.GossipSubDlo = 0 //pubsub.GossipSubDlo = 0
pubsub.GossipSubDhi = 0 //pubsub.GossipSubDhi = 0
pubsub.GossipSubDout = 0 //pubsub.GossipSubDout = 0
pubsub.GossipSubDlazy = 64 //pubsub.GossipSubDlazy = 64
pubsub.GossipSubGossipFactor = 0.25 //pubsub.GossipSubGossipFactor = 0.25
pubsub.GossipSubPruneBackoff = 5 * time.Minute //pubsub.GossipSubPruneBackoff = 5 * time.Minute
// turn on PX // turn on PX
pbOptions = append(pbOptions, pubsub.WithPeerExchange(true)) //pbOptions = append(pbOptions, pubsub.WithPeerExchange(true))
} }
pb, err := pubsub.NewGossipSub( pb, err := pubsub.NewFloodSub(
context.TODO(), context.TODO(),
psr.node, psr.node,
pbOptions..., pbOptions...,