Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
20
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Show more breadcrumbs
cellframe
cellframe-sdk
Commits
bed1799f
Commit
bed1799f
authored
2 years ago
by
roman.padenkov
Committed by
Roman Khlopkov
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Hotfix 7820
parent
f1a81d08
No related branches found
No related tags found
1 merge request
!1033
Hotfix 7820
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/type/blocks/dap_chain_cs_blocks.c
+18
-2
18 additions, 2 deletions
modules/type/blocks/dap_chain_cs_blocks.c
with
18 additions
and
2 deletions
modules/type/blocks/dap_chain_cs_blocks.c
+
18
−
2
View file @
bed1799f
...
...
@@ -66,6 +66,7 @@ typedef struct dap_chain_cs_blocks_pvt
dap_chain_block_cache_t
*
block_cache_first
;
// Mapped area start
dap_chain_block_cache_t
*
block_cache_last
;
// Last block in mapped area
dap_chain_hash_fast_t
genesis_block_hash
;
dap_chain_hash_fast_t
static_genesis_block_hash
;
uint64_t
blocks_count
;
uint64_t
difficulty
;
...
...
@@ -244,7 +245,13 @@ int dap_chain_cs_blocks_new(dap_chain_t * a_chain, dap_config_t * a_chain_config
}
}
l_cs_blocks_pvt
->
is_celled
=
dap_config_get_item_bool_default
(
a_chain_config
,
"blocks"
,
"is_celled"
,
false
);
const
char
*
l_static_genesis_blocks_hash_str
=
dap_config_get_item_str_default
(
a_chain_config
,
"blocks"
,
"static_genesis_block"
,
NULL
);
if
(
l_static_genesis_blocks_hash_str
){
int
lhr
;
if
(
(
lhr
=
dap_chain_hash_fast_from_str
(
l_static_genesis_blocks_hash_str
,
&
l_cs_blocks_pvt
->
static_genesis_block_hash
)
)
!=
0
){
log_it
(
L_ERROR
,
"Can't read hash from static_genesis_block
\"
%s
\"
, ret code %d "
,
l_static_genesis_blocks_hash_str
,
lhr
);
}
}
l_cs_blocks_pvt
->
chunks
=
dap_chain_block_chunks_create
(
l_cs_blocks
);
l_cs_blocks_pvt
->
fill_timeout
=
dap_config_get_item_uint64_default
(
a_chain_config
,
"blocks"
,
"fill_timeout"
,
60
)
*
1000
;
// 1 min
...
...
@@ -1093,6 +1100,8 @@ static dap_chain_atom_verify_res_t s_callback_atom_verify(dap_chain_t * a_chain,
dap_chain_hash_fast_t
l_block_anchor_hash
=
{
0
};
uint64_t
l_nonce
=
0
;
uint64_t
l_nonce2
=
0
;
dap_chain_hash_fast_t
l_block_hash
;
dap_chain_block_meta_extract
(
l_meta
,
l_meta_count
,
&
l_block_prev_hash
,
&
l_block_anchor_hash
,
...
...
@@ -1112,10 +1121,17 @@ static dap_chain_atom_verify_res_t s_callback_atom_verify(dap_chain_t * a_chain,
// genesis or seed mode
if
(
l_is_genesis
)
{
if
(
!
l_blocks_pvt
->
blocks
)
{
dap_hash_fast
(
l_block
,
a_atom_size
,
&
l_block_hash
);
if
(
s_seed_mode
)
log_it
(
L_NOTICE
,
"Accepting new genesis block"
);
else
else
if
(
dap_hash_fast_compare
(
&
l_block_hash
,
&
l_blocks_pvt
->
static_genesis_block_hash
)
&&!
dap_hash_fast_is_blank
(
&
l_block_hash
))
log_it
(
L_NOTICE
,
"Accepting static genesis block"
);
else
{
log_it
(
L_WARNING
,
"Cant accept genesis block: seed mode not enabled or hash mismatch with static genesis block in configuration"
);
return
ATOM_REJECT
;
}
}
else
{
log_it
(
L_WARNING
,
"Cant accept genesis block: already present data in blockchain"
);
return
ATOM_REJECT
;
...
...
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