-
Notifications
You must be signed in to change notification settings - Fork 47
/
registry.go
42 lines (38 loc) · 1.17 KB
/
registry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT License was not distributed with this
// file, you can obtain one at https://opensource.org/licenses/MIT.
//
// Copyright (c) DUSK NETWORK. All rights reserved.
package peer
import (
"github.com/dusk-network/dusk-blockchain/pkg/p2p/wire/protocol"
"github.com/dusk-network/dusk-blockchain/pkg/p2p/wire/topics"
)
// TODO: implement light node registry.
var routingRegistry = map[protocol.ServiceFlag]map[topics.Topic]struct{}{
// Full node
protocol.FullNode: {
topics.Tx: {},
topics.Candidate: {},
topics.NewBlock: {},
topics.Reduction: {},
topics.Agreement: {},
topics.AggrAgreement: {},
topics.Ping: {},
topics.Pong: {},
topics.GetData: {},
topics.GetBlocks: {},
topics.Block: {},
topics.MemPool: {},
topics.Inv: {},
topics.GetCandidate: {},
topics.Addr: {},
topics.Challenge: {},
topics.Response: {},
topics.GetAddrs: {},
},
}
func canRoute(services protocol.ServiceFlag, topic topics.Topic) bool {
_, ok := routingRegistry[services][topic]
return ok
}