Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
substrate
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Denis_P
substrate
Commits
48e36ffe
Unverified
Commit
48e36ffe
authored
5 years ago
by
Michael Müller
Browse files
Options
Downloads
Patches
Plain Diff
Generalize authority_id()
parent
773bc1b0
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/finality-grandpa/src/lib.rs
+11
-8
11 additions, 8 deletions
core/finality-grandpa/src/lib.rs
with
11 additions
and
8 deletions
core/finality-grandpa/src/lib.rs
+
11
−
8
View file @
48e36ffe
...
...
@@ -528,8 +528,11 @@ pub fn run_grandpa_voter<B, E, Block: BlockT<Hash=H256>, N, RA, SC, X>(
let
authorities
=
persistent_data
.authority_set
.clone
();
let
events
=
telemetry_on_connect
.for_each
(
move
|
_
|
{
let
maybe_authority_id
=
authority_id
(
&
authorities
.current_authorities
(),
&
conf
.keystore
)
let
curr
=
authorities
.current_authorities
();
let
mut
auths
=
curr
.voters
()
.into_iter
()
.map
(|(
p
,
_
)|
p
);
let
maybe_authority_id
=
authority_id
(
&
mut
auths
,
&
conf
.keystore
)
.unwrap_or
(
Default
::
default
());
telemetry!
(
CONSENSUS_INFO
;
"afg.authority_set"
;
"authority_id"
=>
maybe_authority_id
.to_string
(),
"authority_set_id"
=>
?
authorities
.set_id
(),
...
...
@@ -846,16 +849,16 @@ fn is_voter(
}
/// Returns the authority id of this node, if available.
fn
authority_id
(
voters
:
&
VoterSet
<
AuthorityId
>
,
fn
authority_id
<
'a
,
I
>
(
authorities
:
&
mut
I
,
keystore
:
&
Option
<
KeyStorePtr
>
,
)
->
Option
<
AuthorityId
>
{
)
->
Option
<
AuthorityId
>
where
I
:
Iterator
<
Item
=
&
'a
AuthorityId
>
,
{
match
keystore
{
Some
(
keystore
)
=>
{
voters
.voters
()
.iter
()
.find_map
(|(
p
,
_
)|
{
authorities
.find_map
(|
p
|
{
keystore
.read
()
.key_pair
::
<
AuthorityPair
>
(
&
p
)
.ok
()
.map
(|
ap
|
ap
.public
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment