Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
netcache "github.com/onflow/flow-go/network/cache"
"github.com/onflow/flow-go/network/channels"
"github.com/onflow/flow-go/network/converter"
"github.com/onflow/flow-go/network/message"
"github.com/onflow/flow-go/network/p2p"
p2pbuilder "github.com/onflow/flow-go/network/p2p/builder"
p2pbuilderconfig "github.com/onflow/flow-go/network/p2p/builder/config"
Expand Down Expand Up @@ -691,6 +692,13 @@ func (fnb *FlowNodeBuilder) InitFlowNetworkWithConduitFactory(
SlashingViolationConsumerFactory: func(adapter network.ConduitAdapter) network.ViolationsConsumer {
return slashing.NewSlashingViolationsConsumer(fnb.Logger, fnb.Metrics.Network, adapter)
},
UnicastStreamAuthorizer: func() func(flow.Role, flow.Role) bool {
if fnb.ObserverMode {
// observer mode uses public network where peers are not authorized based on role
return message.AlwaysAuthorizedUnicastSenderRole
}
return nil // use default (IsAuthorizedUnicastSenderRole)
}(),
}, networkOptions...)
if err != nil {
return nil, fmt.Errorf("could not initialize network: %w", err)
Expand Down
Loading