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
18
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
f1e3c288
Commit
f1e3c288
authored
8 months ago
by
Roman Khlopkov
🔜
Browse files
Options
Downloads
Patches
Plain Diff
[*] Block last / event last commands segfaults fix
parent
e238d2e0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#41339
passed with stage
Stage: build
in 11 minutes and 27 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/type/blocks/dap_chain_cs_blocks.c
+6
-5
6 additions, 5 deletions
modules/type/blocks/dap_chain_cs_blocks.c
modules/type/dag/dap_chain_cs_dag.c
+9
-8
9 additions, 8 deletions
modules/type/dag/dap_chain_cs_dag.c
with
15 additions
and
13 deletions
modules/type/blocks/dap_chain_cs_blocks.c
+
6
−
5
View file @
f1e3c288
...
@@ -1017,12 +1017,13 @@ static int s_cli_blocks(int a_argc, char ** a_argv, void **a_str_reply)
...
@@ -1017,12 +1017,13 @@ static int s_cli_blocks(int a_argc, char ** a_argv, void **a_str_reply)
json_object
*
json_obj_out
=
json_object_new_object
();
json_object
*
json_obj_out
=
json_object_new_object
();
dap_chain_block_cache_t
*
l_last_block
=
HASH_LAST
(
PVT
(
l_blocks
)
->
blocks
);
dap_chain_block_cache_t
*
l_last_block
=
HASH_LAST
(
PVT
(
l_blocks
)
->
blocks
);
char
l_buf
[
DAP_TIME_STR_SIZE
];
char
l_buf
[
DAP_TIME_STR_SIZE
];
dap_time_to_str_rfc822
(
l_buf
,
DAP_TIME_STR_SIZE
,
l_last_block
->
ts_created
);
if
(
l_last_block
)
json_object_object_add
(
json_obj_out
,
"Last block num"
,
json_object_new_uint64
(
l_last_block
->
block_number
));
dap_time_to_str_rfc822
(
l_buf
,
DAP_TIME_STR_SIZE
,
l_last_block
->
ts_created
);
json_object_object_add
(
json_obj_out
,
"Last block hash"
,
json_object_new_string
(
l_last_block
->
block_hash_str
));
json_object_object_add
(
json_obj_out
,
"Last block num"
,
json_object_new_uint64
(
l_last_block
?
l_last_block
->
block_number
:
0
));
json_object_object_add
(
json_obj_out
,
"ts_create"
,
json_object_new_string
(
l_buf
));
json_object_object_add
(
json_obj_out
,
"Last block hash"
,
json_object_new_string
(
l_last_block
?
l_last_block
->
block_hash_str
:
"empty"
));
json_object_object_add
(
json_obj_out
,
"ts_created"
,
json_object_new_string
(
l_last_block
?
l_buf
:
"never"
));
sprintf
(
l_tmp_buff
,
"%s.%s has blocks
-
"
,
l_net
->
pub
.
name
,
l_chain
->
name
);
sprintf
(
l_tmp_buff
,
"%s.%s has blocks"
,
l_net
->
pub
.
name
,
l_chain
->
name
);
json_object_object_add
(
json_obj_out
,
l_tmp_buff
,
json_object_new_uint64
(
PVT
(
l_blocks
)
->
blocks_count
));
json_object_object_add
(
json_obj_out
,
l_tmp_buff
,
json_object_new_uint64
(
PVT
(
l_blocks
)
->
blocks_count
));
json_object_array_add
(
*
json_arr_reply
,
json_obj_out
);
json_object_array_add
(
*
json_arr_reply
,
json_obj_out
);
}
break
;
}
break
;
...
...
This diff is collapsed.
Click to expand it.
modules/type/dag/dap_chain_cs_dag.c
+
9
−
8
View file @
f1e3c288
...
@@ -1850,19 +1850,20 @@ static int s_cli_dag(int argc, char ** argv, void **a_str_reply)
...
@@ -1850,19 +1850,20 @@ static int s_cli_dag(int argc, char ** argv, void **a_str_reply)
}
break
;
}
break
;
case
SUBCMD_EVENT_LAST
:{
case
SUBCMD_EVENT_LAST
:{
json_object
*
json_obj_out
=
json_object_new_object
();
json_object
*
json_obj_out
=
json_object_new_object
();
char
l_tmp_buff
[
70
]
=
{
0
};
char
l_tmp_buff
[
70
]
=
{
0
};
dap_string_t
*
l_ret_str
=
dap_string_new
(
NULL
);
pthread_mutex_lock
(
&
PVT
(
l_dag
)
->
events_mutex
);
pthread_mutex_lock
(
&
PVT
(
l_dag
)
->
events_mutex
);
dap_chain_cs_dag_event_item_t
*
l_last_
event
=
HASH_LAST
(
PVT
(
l_dag
)
->
events
);
dap_chain_cs_dag_event_item_t
*
l_last_
item
=
HASH_LAST
(
PVT
(
l_dag
)
->
events
);
pthread_mutex_unlock
(
&
PVT
(
l_dag
)
->
events_mutex
);
pthread_mutex_unlock
(
&
PVT
(
l_dag
)
->
events_mutex
);
char
l_buf
[
DAP_TIME_STR_SIZE
];
char
l_buf
[
DAP_TIME_STR_SIZE
];
dap_time_to_str_rfc822
(
l_buf
,
DAP_TIME_STR_SIZE
,
l_last_event
->
event
->
header
.
ts_created
);
if
(
l_last_item
)
dap_time_to_str_rfc822
(
l_buf
,
DAP_TIME_STR_SIZE
,
l_last_item
->
event
->
header
.
ts_created
);
json_object_object_add
(
json_obj_out
,
"Last atom hash in events"
,
json_object_new_string
(
dap_hash_fast_to_str_static
(
&
l_last_event
->
hash
)));
json_object_object_add
(
json_obj_out
,
"Last event num"
,
json_object_new_uint64
(
l_last_item
?
l_last_item
->
event_number
:
0
));
json_object_object_add
(
json_obj_out
,
"ts_create"
,
json_object_new_string
(
l_buf
));
json_object_object_add
(
json_obj_out
,
"Last event hash"
,
json_object_new_string
(
l_last_item
?
dap_hash_fast_to_str_static
(
&
l_last_item
->
hash
)
:
"empty"
));
json_object_object_add
(
json_obj_out
,
"ts_create"
,
l_last_item
?
json_object_new_string
(
l_buf
)
:
"never"
);
size_t
l_event_count
=
HASH_COUNT
(
PVT
(
l_dag
)
->
events
);
size_t
l_event_count
=
HASH_COUNT
(
PVT
(
l_dag
)
->
events
);
sprintf
(
l_tmp_buff
,
"%s.%s has events
-
"
,
l_net
->
pub
.
name
,
l_chain
->
name
);
sprintf
(
l_tmp_buff
,
"%s.%s has events"
,
l_net
->
pub
.
name
,
l_chain
->
name
);
json_object_object_add
(
json_obj_out
,
l_tmp_buff
,
json_object_new_uint64
(
l_event_count
));
json_object_object_add
(
json_obj_out
,
l_tmp_buff
,
json_object_new_uint64
(
l_event_count
));
json_object_array_add
(
*
json_arr_reply
,
json_obj_out
);
json_object_array_add
(
*
json_arr_reply
,
json_obj_out
);
}
break
;
}
break
;
...
...
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