Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
polkadot
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
Martin Pugh
polkadot
Commits
bc6dcc2f
Commit
bc6dcc2f
authored
4 years ago
by
asynchronous rob
Browse files
Options
Downloads
Patches
Plain Diff
start `canonicalize` implementation
parent
9a04615a
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
node/core/approval-voting/src/aux_schema.rs
+34
-2
34 additions, 2 deletions
node/core/approval-voting/src/aux_schema.rs
with
34 additions
and
2 deletions
node/core/approval-voting/src/aux_schema.rs
+
34
−
2
View file @
bc6dcc2f
...
...
@@ -39,7 +39,7 @@ use polkadot_primitives::v1::{
use
sp_consensus_slots
::
SlotNumber
;
use
parity_scale_codec
::{
Encode
,
Decode
};
use
std
::
collections
::
BTreeMap
;
use
std
::
collections
::
{
BTreeMap
,
HashMap
}
;
use
bitvec
::{
vec
::
BitVec
,
order
::
Lsb0
as
BitOrderLsb0
};
use
super
::
Tick
;
...
...
@@ -107,7 +107,39 @@ pub(crate) struct StoredBlockRange(BlockNumber, BlockNumber);
#[derive(Debug,
Clone,
Encode,
Decode)]
pub
(
crate
)
struct
OurAssignment
{
}
/// Clear the aux store of everything related to
/// Canonicalize some particular block, pruning everything before it and
/// pruning any competing branches at the same height.
pub
(
crate
)
fn
canonicalize
(
store
:
&
impl
AuxStore
,
canon_number
:
BlockNumber
,
canon_hash
:
BlockNumber
,
)
->
sp_blockchain
::
Result
<
()
>
{
let
range
=
match
load_stored_blocks
(
store
)
?
{
None
=>
return
Ok
(()),
Some
(
range
)
if
range
.0
>=
canon_number
=>
return
Ok
(())
.
Some
(
range
)
=>
range
,
};
let
mut
visited_height_keys
=
Vec
::
new
();
let
mut
visited_block_keys
=
Vec
::
new
();
let
mut
visited_candidates
=
HashMap
::
new
();
// TODO [now]: finish implementation
for
i
in
range
.0
..
canon_number
{
let
at_height
=
load_blocks_at_height
(
store
,
i
)
?
;
visited_height_keys
.push
(
blocks_at_height_key
(
i
));
}
{
let
at_height
=
load_blocks_at_height
(
store
,
canon_number
)
?
;
visited_height_keys
.push
(
blocks_at_height_key
(
canon_number
));
}
}
/// Clear the aux store of everything.
pub
(
crate
)
fn
clear
(
store
:
&
impl
AuxStore
)
->
sp_blockchain
::
Result
<
()
>
{
...
...
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