Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Commits
0ad42d9e
Commit
0ad42d9e
authored
5 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[fix] bc: allow block v12
parent
f1e6e70e
No related branches found
No related tags found
1 merge request
!260
[fix] bc: allow block v12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/blockchain/blockchain/src/dubp/check/local.rs
+7
-4
7 additions, 4 deletions
lib/modules/blockchain/blockchain/src/dubp/check/local.rs
with
7 additions
and
4 deletions
lib/modules/blockchain/blockchain/src/dubp/check/local.rs
+
7
−
4
View file @
0ad42d9e
...
...
@@ -30,12 +30,15 @@ use dubp_common_doc::traits::Document;
use
dubp_common_doc
::
BlockNumber
;
use
dubp_currency_params
::
CurrencyParameters
;
const
COUNT_ALLOWED_BLOCK_VERSIONS
:
usize
=
3
;
static
ALLOWED_BLOCK_VERSIONS
:
[
usize
;
COUNT_ALLOWED_BLOCK_VERSIONS
]
=
[
10
,
11
,
12
];
#[derive(Debug,
PartialEq)]
/// Local verification of a block error
pub
enum
LocalVerifyBlockError
{
/// Wrong block version
Version
{
expected_version
:
Vec
<
usize
>
,
expected_version
:
[
usize
;
COUNT_ALLOWED_BLOCK_VERSIONS
]
,
actual_version
:
u32
,
},
/// Genesis block specific rules
...
...
@@ -105,9 +108,9 @@ pub fn verify_local_validity_block_v10(
block
:
&
BlockDocumentV10
,
)
->
Result
<
(),
LocalVerifyBlockError
>
{
// Version
if
!
(
block
.version
==
10
||
block
.version
==
11
)
{
if
!
ALLOWED_BLOCK_VERSIONS
.contains
(
&
(
block
.version
as
usize
)
)
{
return
Err
(
LocalVerifyBlockError
::
Version
{
expected_version
:
vec!
[
10
,
11
]
,
expected_version
:
ALLOWED_BLOCK_VERSIONS
,
actual_version
:
block
.version
,
});
}
...
...
@@ -181,7 +184,7 @@ mod tests {
block
.version
=
14
;
let
expected
=
Err
(
LocalVerifyBlockError
::
Version
{
expected_version
:
vec!
[
10
,
11
]
,
expected_version
:
ALLOWED_BLOCK_VERSIONS
,
actual_version
:
14
,
});
let
actual
=
verify_local_validity_block
(
&
BlockDocument
::
V10
(
block
),
Some
(
currency_params
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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