Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nodebuilder/p2p): LNs restricted to acting as DHT clients *only* #3590

Merged
merged 1 commit into from
Jul 24, 2024
Merged
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
10 changes: 8 additions & 2 deletions nodebuilder/p2p/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func contentRouting(r routing.PeerRouting) routing.ContentRouting {
// Basically, this provides a way to discover peer addresses by respecting public keys.
func peerRouting(cfg Config, tp node.Type, params routingParams) (routing.PeerRouting, error) {
opts := []dht.Option{
dht.Mode(dht.ModeAuto),
dht.BootstrapPeers(params.Peers...),
dht.ProtocolPrefix(protocol.ID(fmt.Sprintf("/celestia/%s", params.Net))),
dht.Datastore(params.DataStore),
Expand All @@ -36,10 +35,17 @@ func peerRouting(cfg Config, tp node.Type, params routingParams) (routing.PeerRo
)
}

if tp == node.Bridge || tp == node.Full {
switch tp {
case node.Light:
opts = append(opts,
dht.Mode(dht.ModeClient),
)
case node.Bridge, node.Full:
opts = append(opts,
dht.Mode(dht.ModeServer),
)
default:
return nil, fmt.Errorf("unsupported node type: %s", tp)
}

d, err := dht.New(params.Ctx, params.Host, opts...)
Expand Down
Loading