Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
78700767
Unverified
Commit
78700767
authored
May 30, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: Only start peer monitor if banning is enabled.
parent
a5ea097f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
node.go
op-node/p2p/node.go
+8
-4
No files found.
op-node/p2p/node.go
View file @
78700767
...
@@ -35,8 +35,8 @@ type NodeP2P struct {
...
@@ -35,8 +35,8 @@ type NodeP2P struct {
gater
gating
.
BlockingConnectionGater
// p2p gater, to ban/unban peers with, may be nil even with p2p enabled
gater
gating
.
BlockingConnectionGater
// p2p gater, to ban/unban peers with, may be nil even with p2p enabled
scorer
Scorer
// writes score-updates to the peerstore and keeps metrics of score changes
scorer
Scorer
// writes score-updates to the peerstore and keeps metrics of score changes
connMgr
connmgr
.
ConnManager
// p2p conn manager, to keep a reliable number of peers, may be nil even with p2p enabled
connMgr
connmgr
.
ConnManager
// p2p conn manager, to keep a reliable number of peers, may be nil even with p2p enabled
peerMonitor
*
monitor
.
PeerMonitor
// peer monitor to disconnect bad peers, may be nil even with p2p enabled
store
store
.
ExtendedPeerstore
// peerstore of host, with extra bindings for scoring and banning
store
store
.
ExtendedPeerstore
// peerstore of host, with extra bindings for scoring and banning
peerMonitor
*
monitor
.
PeerMonitor
// peer monitor to disconnect bad peers
log
log
.
Logger
log
log
.
Logger
// the below components are all optional, and may be nil. They require the host to not be nil.
// the below components are all optional, and may be nil. They require the host to not be nil.
dv5Local
*
enode
.
LocalNode
// p2p discovery identity
dv5Local
*
enode
.
LocalNode
// p2p discovery identity
...
@@ -126,7 +126,6 @@ func (n *NodeP2P) init(resourcesCtx context.Context, rollupCfg *rollup.Config, l
...
@@ -126,7 +126,6 @@ func (n *NodeP2P) init(resourcesCtx context.Context, rollupCfg *rollup.Config, l
n
.
scorer
.
OnDisconnect
(
conn
.
RemotePeer
())
n
.
scorer
.
OnDisconnect
(
conn
.
RemotePeer
())
},
},
})
})
n
.
peerMonitor
=
monitor
.
NewPeerMonitor
(
resourcesCtx
,
log
,
clock
.
SystemClock
,
n
,
minAcceptedPeerScore
)
// notify of any new connections/streams/etc.
// notify of any new connections/streams/etc.
n
.
host
.
Network
()
.
Notify
(
NewNetworkNotifier
(
log
,
metrics
))
n
.
host
.
Network
()
.
Notify
(
NewNetworkNotifier
(
log
,
metrics
))
// note: the IDDelta functionality was removed from libP2P, and no longer needs to be explicitly disabled.
// note: the IDDelta functionality was removed from libP2P, and no longer needs to be explicitly disabled.
...
@@ -155,7 +154,10 @@ func (n *NodeP2P) init(resourcesCtx context.Context, rollupCfg *rollup.Config, l
...
@@ -155,7 +154,10 @@ func (n *NodeP2P) init(resourcesCtx context.Context, rollupCfg *rollup.Config, l
go
metrics
.
RecordBandwidth
(
resourcesCtx
,
bwc
)
go
metrics
.
RecordBandwidth
(
resourcesCtx
,
bwc
)
}
}
n
.
peerMonitor
.
Start
()
if
setup
.
BanPeers
()
{
n
.
peerMonitor
=
monitor
.
NewPeerMonitor
(
resourcesCtx
,
log
,
clock
.
SystemClock
,
n
,
minAcceptedPeerScore
)
n
.
peerMonitor
.
Start
()
}
}
}
return
nil
return
nil
}
}
...
@@ -247,7 +249,9 @@ func (n *NodeP2P) BanIP(ip net.IP, expiration time.Time) error {
...
@@ -247,7 +249,9 @@ func (n *NodeP2P) BanIP(ip net.IP, expiration time.Time) error {
func
(
n
*
NodeP2P
)
Close
()
error
{
func
(
n
*
NodeP2P
)
Close
()
error
{
var
result
*
multierror
.
Error
var
result
*
multierror
.
Error
n
.
peerMonitor
.
Stop
()
if
n
.
peerMonitor
!=
nil
{
n
.
peerMonitor
.
Stop
()
}
if
n
.
dv5Udp
!=
nil
{
if
n
.
dv5Udp
!=
nil
{
n
.
dv5Udp
.
Close
()
n
.
dv5Udp
.
Close
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment