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
d4e99790
Commit
d4e99790
authored
May 26, 2023
by
Felipe Andrade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reset listeners, doc typos
parent
599e6528
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
consensus_poller.go
proxyd/consensus_poller.go
+8
-4
consensus_test.go
proxyd/integration_tests/consensus_test.go
+1
-0
No files found.
proxyd/consensus_poller.go
View file @
d4e99790
...
...
@@ -177,6 +177,10 @@ func (cp *ConsensusPoller) AddListener(listener OnConsensusBroken) {
cp
.
listeners
=
append
(
cp
.
listeners
,
listener
)
}
func
(
cp
*
ConsensusPoller
)
ClearListeners
()
{
cp
.
listeners
=
[]
OnConsensusBroken
{}
}
func
WithBanPeriod
(
banPeriod
time
.
Duration
)
ConsensusOpt
{
return
func
(
cp
*
ConsensusPoller
)
{
cp
.
banPeriod
=
banPeriod
...
...
@@ -524,7 +528,7 @@ func (cp *ConsensusPoller) Ban(be *Backend) {
bs
.
finalizedBlockNumber
=
0
}
// Unban remove any bans from the backends
// Unban remove
s
any bans from the backends
func
(
cp
*
ConsensusPoller
)
Unban
(
be
*
Backend
)
{
bs
:=
cp
.
backendState
[
be
]
defer
bs
.
backendStateMux
.
Unlock
()
...
...
@@ -532,14 +536,14 @@ func (cp *ConsensusPoller) Unban(be *Backend) {
bs
.
bannedUntil
=
time
.
Now
()
.
Add
(
-
10
*
time
.
Hour
)
}
// Reset re
move any bans from the backends and reset their
states
// Reset re
set all backend
states
func
(
cp
*
ConsensusPoller
)
Reset
()
{
for
_
,
be
:=
range
cp
.
backendGroup
.
Backends
{
cp
.
backendState
[
be
]
=
&
backendState
{}
}
}
// fetchBlock
C
onvenient wrapper to make a request to get a block directly from the backend
// fetchBlock
is a c
onvenient wrapper to make a request to get a block directly from the backend
func
(
cp
*
ConsensusPoller
)
fetchBlock
(
ctx
context
.
Context
,
be
*
Backend
,
block
string
)
(
blockNumber
hexutil
.
Uint64
,
blockHash
string
,
err
error
)
{
var
rpcRes
RPCRes
err
=
be
.
ForwardRPC
(
ctx
,
&
rpcRes
,
"67"
,
"eth_getBlockByNumber"
,
block
,
false
)
...
...
@@ -557,7 +561,7 @@ func (cp *ConsensusPoller) fetchBlock(ctx context.Context, be *Backend, block st
return
}
// getPeerCount
C
onvenient wrapper to retrieve the current peer count from the backend
// getPeerCount
is a c
onvenient wrapper to retrieve the current peer count from the backend
func
(
cp
*
ConsensusPoller
)
getPeerCount
(
ctx
context
.
Context
,
be
*
Backend
)
(
count
uint64
,
err
error
)
{
var
rpcRes
RPCRes
err
=
be
.
ForwardRPC
(
ctx
,
&
rpcRes
,
"67"
,
"net_peerCount"
)
...
...
proxyd/integration_tests/consensus_test.go
View file @
d4e99790
...
...
@@ -80,6 +80,7 @@ func TestConsensus(t *testing.T) {
node
.
handler
.
ResetOverrides
()
node
.
mockBackend
.
Reset
()
}
bg
.
Consensus
.
ClearListeners
()
bg
.
Consensus
.
Reset
()
}
...
...
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