mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-15 14:21:22 +00:00
filter peers by addr/pubkey. closes #244
This commit is contained in:
2
glide.lock
generated
2
glide.lock
generated
@ -70,7 +70,7 @@ imports:
|
|||||||
- name: github.com/tendermint/go-merkle
|
- name: github.com/tendermint/go-merkle
|
||||||
version: 05042c6ab9cad51d12e4cecf717ae68e3b1409a8
|
version: 05042c6ab9cad51d12e4cecf717ae68e3b1409a8
|
||||||
- name: github.com/tendermint/go-p2p
|
- name: github.com/tendermint/go-p2p
|
||||||
version: 929cf433b9c8e987af5f7f3ca3ce717e1e3eda53
|
version: 642901d5aae311368d91ebfb888a4f6877de9614
|
||||||
subpackages:
|
subpackages:
|
||||||
- upnp
|
- upnp
|
||||||
- name: github.com/tendermint/go-rpc
|
- name: github.com/tendermint/go-rpc
|
||||||
|
17
node/node.go
17
node/node.go
@ -112,6 +112,23 @@ func NewNode(config cfg.Config, privValidator *types.PrivValidator) *Node {
|
|||||||
sw.AddReactor("BLOCKCHAIN", bcReactor)
|
sw.AddReactor("BLOCKCHAIN", bcReactor)
|
||||||
sw.AddReactor("CONSENSUS", consensusReactor)
|
sw.AddReactor("CONSENSUS", consensusReactor)
|
||||||
|
|
||||||
|
// filter peers by addr or pubkey
|
||||||
|
// NOTE: query format subject to change
|
||||||
|
sw.SetAddrFilter(func(addr net.Addr) error {
|
||||||
|
res := proxyApp.Query().QuerySync([]byte(Fmt("p2p/filter/addr/%s", addr.String())))
|
||||||
|
if res.IsOK() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
sw.SetPubKeyFilter(func(pubkey crypto.PubKeyEd25519) error {
|
||||||
|
res := proxyApp.Query().QuerySync([]byte(Fmt("p2p/filter/pubkey/%X", pubkey.Bytes())))
|
||||||
|
if res.IsOK() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
|
||||||
// add the event switch to all services
|
// add the event switch to all services
|
||||||
// they should all satisfy events.Eventable
|
// they should all satisfy events.Eventable
|
||||||
SetEventSwitch(eventSwitch, bcReactor, mempoolReactor, consensusReactor)
|
SetEventSwitch(eventSwitch, bcReactor, mempoolReactor, consensusReactor)
|
||||||
|
Reference in New Issue
Block a user