Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
shasper
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository 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
parity
shasper
Commits
1ee4a0d9
Commit
1ee4a0d9
authored
6 years ago
by
Wei Tang
Browse files
Options
Downloads
Patches
Plain Diff
Add block vote cache
parent
0d8b2332
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
runtime/src/state.rs
+6
-0
6 additions, 0 deletions
runtime/src/state.rs
runtime/src/system.rs
+2
-1
2 additions, 1 deletion
runtime/src/system.rs
with
8 additions
and
1 deletion
runtime/src/state.rs
+
6
−
0
View file @
1ee4a0d9
...
...
@@ -22,6 +22,12 @@ pub struct ActiveState {
pub
recent_block_hashes
:
Vec
<
H256
>
,
}
#[derive(Encode,
Decode)]
pub
struct
BlockVoteInfo
{
pub
voter_indices
:
Vec
<
usize
>
,
pub
total_voter_deposits
:
u128
,
}
impl
ActiveState
{
pub
fn
block_hash
(
&
self
,
current_slot
:
u64
,
target_slot
:
u64
)
->
H256
{
let
current_slot
=
current_slot
as
usize
;
...
...
This diff is collapsed.
Click to expand it.
runtime/src/system.rs
+
2
−
1
View file @
1ee4a0d9
...
...
@@ -4,7 +4,7 @@ use rstd::prelude::*;
use
super
::{
BlockNumber
,
Hash
,
Block
};
use
header
::
Header
;
use
state
::{
ActiveState
,
CrystallizedState
};
use
state
::{
ActiveState
,
CrystallizedState
,
BlockVoteInfo
};
storage_items!
{
Number
:
b"sys:num"
=>
required
BlockNumber
;
...
...
@@ -15,6 +15,7 @@ storage_items! {
JustifiedBlockHashes
:
b"sys:justifiedblockhashes"
=>
required
map
[
u64
=>
H256
];
Active
:
b"sys:active"
=>
required
ActiveState
;
Crystallized
:
b"sys:crystallized"
=>
required
CrystallizedState
;
BlockVoteCache
:
b"sys:blockvotecache"
=>
required
map
[
H256
=>
BlockVoteInfo
];
}
pub
fn
initialise_block
(
header
:
Header
)
{
...
...
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