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
Merge requests
!189
[ref+tests] crypto: improve error handling & improve test coverage
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[ref+tests] crypto: improve error handling & improve test coverage
elois/crypto
into
dev
Overview
0
Commits
1
Pipelines
0
Changes
27
Merged
Éloïs
requested to merge
elois/crypto
into
dev
5 years ago
Overview
0
Commits
1
Pipelines
0
Changes
27
Expand
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
5bead625
1 commit,
5 years ago
27 files
+
1206
−
276
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
27
Search (e.g. *.vue) (Ctrl+P)
lib/modules/blockchain/blockchain/src/dubp/check/hashs.rs
+
14
−
20
Options
@@ -15,31 +15,25 @@
@@ -15,31 +15,25 @@
//! Verify block inner hash and block hash
//! Verify block inner hash and block hash
use
crate
::
VerifyBlockHashsError
;
use
dubp_documents
::
documents
::
block
::{
BlockDocument
,
BlockDocumentTrait
,
VerifyBlockHashError
};
use
dubp_documents
::
documents
::
block
::{
BlockDocument
,
BlockDocumentTrait
};
/// Verify block hashs
/// Verify block hashs
pub
fn
verify_block_hashs
(
block_doc
:
&
BlockDocument
)
->
Result
<
(),
VerifyBlockHash
s
Error
>
{
pub
fn
verify_block_hashs
(
block_doc
:
&
BlockDocument
)
->
Result
<
(),
VerifyBlockHashError
>
{
trace!
(
"complete_block #{}..."
,
block_doc
.number
());
trace!
(
"complete_block #{}..."
,
block_doc
.number
());
if
block_doc
.verify_inner_hash
()
{
match
block_doc
.verify_inner_hash
()
{
if
block_doc
.verify_hash
()
{
Ok
(())
=>
block_doc
.verify_hash
()
.map_err
(|
e
|
{
trace!
(
"Succes to verify_block_hashs #{}"
,
block_doc
.number
()
.0
);
Ok
(())
}
else
{
warn!
(
"BlockchainModule : Refuse Bloc : invalid hash !"
);
warn!
(
"BlockchainModule : Refuse Bloc : invalid hash !"
);
Err
(
VerifyBlockHashsError
::
InvalidHash
(
e
block_doc
.number
(),
}),
block_doc
.hash
(),
Err
(
e
)
=>
{
))
warn!
(
"BlockchainModule : Refuse Bloc : invalid inner hash !"
);
warn!
(
"BlockDocument=
\"
{:?}
\"
"
,
block_doc
);
warn!
(
"BlockInnerFormat=
\"
{}
\"
"
,
block_doc
.generate_compact_inner_text
()
);
Err
(
e
)
}
}
}
else
{
warn!
(
"BlockchainModule : Refuse Bloc : invalid inner hash !"
);
warn!
(
"BlockDocument=
\"
{:?}
\"
"
,
block_doc
);
warn!
(
"BlockInnerFormat=
\"
{}
\"
"
,
block_doc
.generate_compact_inner_text
()
);
Err
(
VerifyBlockHashsError
::
InvalidInnerHash
())
}
}
}
}
Loading