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
16
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
15106c55
Commit
15106c55
authored
4 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into develop
parents
a009d823
88ebe026
No related branches found
No related tags found
2 merge requests
!251
Master
,
!250
Master
Pipeline
#5505
passed with stage
in 30 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/chain/dap_chain_ledger.c
+11
-8
11 additions, 8 deletions
modules/chain/dap_chain_ledger.c
modules/type/dag/dap_chain_cs_dag.c
+11
-8
11 additions, 8 deletions
modules/type/dag/dap_chain_cs_dag.c
with
22 additions
and
16 deletions
modules/chain/dap_chain_ledger.c
+
11
−
8
View file @
15106c55
...
@@ -880,11 +880,11 @@ int dap_chain_ledger_tx_cache_check(dap_ledger_t *a_ledger, dap_chain_datum_tx_t
...
@@ -880,11 +880,11 @@ int dap_chain_ledger_tx_cache_check(dap_ledger_t *a_ledger, dap_chain_datum_tx_t
bool
l_is_blank
=
dap_hash_fast_is_blank
(
&
l_tx_prev_hash
);
bool
l_is_blank
=
dap_hash_fast_is_blank
(
&
l_tx_prev_hash
);
char
l_tx_prev_hash_str
[
70
];
char
l_tx_prev_hash_str
[
70
];
if
(
l_is_blank
){
if
(
l_is_blank
){
//
log_it(L_DEBUG, "Tx check: blank prev hash ");
log_it
(
L_DEBUG
,
"Tx check: blank prev hash "
);
dap_snprintf
(
l_tx_prev_hash_str
,
sizeof
(
l_tx_prev_hash_str
),
"BLANK"
);
dap_snprintf
(
l_tx_prev_hash_str
,
sizeof
(
l_tx_prev_hash_str
),
"BLANK"
);
}
else
{
}
else
{
dap_chain_hash_fast_to_str
(
&
l_tx_prev_hash
,
l_tx_prev_hash_str
,
sizeof
(
l_tx_prev_hash_str
));
dap_chain_hash_fast_to_str
(
&
l_tx_prev_hash
,
l_tx_prev_hash_str
,
sizeof
(
l_tx_prev_hash_str
));
//
log_it(L_DEBUG, "Tx check: tx prev hash %s",l_tx_prev_hash_str);
log_it
(
L_DEBUG
,
"Tx check: tx prev hash %s"
,
l_tx_prev_hash_str
);
}
}
if
(
l_is_blank
||
l_is_first_transaction
)
{
if
(
l_is_blank
||
l_is_first_transaction
)
{
...
@@ -1214,23 +1214,26 @@ int dap_chain_ledger_balance_cache_update(dap_ledger_t *a_ledger, dap_ledger_wal
...
@@ -1214,23 +1214,26 @@ int dap_chain_ledger_balance_cache_update(dap_ledger_t *a_ledger, dap_ledger_wal
*/
*/
int
dap_chain_ledger_tx_add
(
dap_ledger_t
*
a_ledger
,
dap_chain_datum_tx_t
*
a_tx
)
int
dap_chain_ledger_tx_add
(
dap_ledger_t
*
a_ledger
,
dap_chain_datum_tx_t
*
a_tx
)
{
{
if
(
!
a_tx
)
if
(
!
a_tx
){
log_it
(
L_ERROR
,
"NULL tx detected"
);
return
-
1
;
return
-
1
;
}
int
ret
=
1
;
int
ret
=
1
;
dap_ledger_private_t
*
l_ledger_priv
=
PVT
(
a_ledger
);
dap_ledger_private_t
*
l_ledger_priv
=
PVT
(
a_ledger
);
dap_list_t
*
l_list_bound_items
=
NULL
;
dap_list_t
*
l_list_bound_items
=
NULL
;
dap_list_t
*
l_list_tx_out
=
NULL
;
dap_list_t
*
l_list_tx_out
=
NULL
;
dap_chain_hash_fast_t
*
l_tx_hash
=
dap_chain_node_datum_tx_calc_hash
(
a_tx
);
char
l_tx_hash_str
[
70
];
dap_chain_hash_fast_to_str
(
l_tx_hash
,
l_tx_hash_str
,
sizeof
(
l_tx_hash_str
));
int
l_ret_check
;
int
l_ret_check
;
if
(
(
l_ret_check
=
dap_chain_ledger_tx_cache_check
(
if
(
(
l_ret_check
=
dap_chain_ledger_tx_cache_check
(
a_ledger
,
a_tx
,
&
l_list_bound_items
,
&
l_list_tx_out
))
<
0
){
a_ledger
,
a_tx
,
&
l_list_bound_items
,
&
l_list_tx_out
))
<
0
){
log_it
(
L_
DEBU
G
,
"dap_chain_ledger_tx_add() tx not passed the check: code %d "
,
l_ret_check
);
log_it
(
L_
WARNIN
G
,
"dap_chain_ledger_tx_add() tx
%s
not passed the check: code %d "
,
l_tx_hash_str
,
l_ret_check
);
return
-
1
;
return
-
1
;
}
}
dap_chain_hash_fast_t
*
l_tx_hash
=
dap_chain_node_datum_tx_calc_hash
(
a_tx
);
log_it
(
L_DEBUG
,
"dap_chain_ledger_tx_add() check passed for tx %s"
,
l_tx_hash_str
);
char
l_tx_hash_str
[
70
];
dap_chain_hash_fast_to_str
(
l_tx_hash
,
l_tx_hash_str
,
sizeof
(
l_tx_hash_str
));
//log_it ( L_INFO, "dap_chain_ledger_tx_add() check passed for tx %s",l_tx_hash_str);
char
*
l_token_ticker
=
NULL
,
*
l_token_ticker_old
=
NULL
;
char
*
l_token_ticker
=
NULL
,
*
l_token_ticker_old
=
NULL
;
...
...
This diff is collapsed.
Click to expand it.
modules/type/dag/dap_chain_cs_dag.c
+
11
−
8
View file @
15106c55
...
@@ -302,6 +302,7 @@ static int s_dap_chain_add_atom_to_ledger(dap_chain_cs_dag_t * a_dag, dap_ledger
...
@@ -302,6 +302,7 @@ static int s_dap_chain_add_atom_to_ledger(dap_chain_cs_dag_t * a_dag, dap_ledger
l_tx_event
->
event_size
=
a_event_item
->
event_size
;
l_tx_event
->
event_size
=
a_event_item
->
event_size
;
memcpy
(
&
l_tx_event
->
hash
,
&
a_event_item
->
hash
,
sizeof
(
l_tx_event
->
hash
)
);
memcpy
(
&
l_tx_event
->
hash
,
&
a_event_item
->
hash
,
sizeof
(
l_tx_event
->
hash
)
);
HASH_ADD
(
hh
,
PVT
(
a_dag
)
->
tx_events
,
hash
,
sizeof
(
l_tx_event
->
hash
),
l_tx_event
);
HASH_ADD
(
hh
,
PVT
(
a_dag
)
->
tx_events
,
hash
,
sizeof
(
l_tx_event
->
hash
),
l_tx_event
);
// don't save bad transactions to base
// don't save bad transactions to base
...
@@ -319,22 +320,24 @@ static int s_dap_chain_add_atom_to_ledger(dap_chain_cs_dag_t * a_dag, dap_ledger
...
@@ -319,22 +320,24 @@ static int s_dap_chain_add_atom_to_ledger(dap_chain_cs_dag_t * a_dag, dap_ledger
static
int
s_dap_chain_add_atom_to_events_table
(
dap_chain_cs_dag_t
*
a_dag
,
dap_ledger_t
*
a_ledger
,
dap_chain_cs_dag_event_item_t
*
a_event_item
){
static
int
s_dap_chain_add_atom_to_events_table
(
dap_chain_cs_dag_t
*
a_dag
,
dap_ledger_t
*
a_ledger
,
dap_chain_cs_dag_event_item_t
*
a_event_item
){
int
res
=
a_dag
->
callback_cs_verify
(
a_dag
,
a_event_item
->
event
,
a_event_item
->
event_size
);
int
res
=
a_dag
->
callback_cs_verify
(
a_dag
,
a_event_item
->
event
,
a_event_item
->
event_size
);
if
(
res
!=
0
)
{
if
(
memcmp
(
&
a_event_item
->
hash
,
&
a_dag
->
static_genesis_event_hash
,
sizeof
(
a_event_item
->
hash
)
)
==
0
){
res
=
0
;
}
}
if
(
res
==
0
){
if
(
res
==
0
){
char
l_buf_hash
[
128
];
char
l_buf_hash
[
128
];
dap_chain_hash_fast_to_str
(
&
a_event_item
->
hash
,
l_buf_hash
,
sizeof
(
l_buf_hash
)
-
1
);
dap_chain_hash_fast_to_str
(
&
a_event_item
->
hash
,
l_buf_hash
,
sizeof
(
l_buf_hash
)
-
1
);
log_it
(
L_DEBUG
,
"Dag event %s checked, add it to ledger"
,
l_buf_hash
);
log_it
(
L_DEBUG
,
"Dag event %s checked, add it to ledger"
,
l_buf_hash
);
res
=
s_dap_chain_add_atom_to_ledger
(
a_dag
,
a_ledger
,
a_event_item
);
s_dap_chain_add_atom_to_ledger
(
a_dag
,
a_ledger
,
a_event_item
);
//All correct, no matter for result
//All correct, no matter for result
HASH_ADD
(
hh
,
PVT
(
a_dag
)
->
events
,
hash
,
sizeof
(
a_event_item
->
hash
),
a_event_item
);
HASH_ADD
(
hh
,
PVT
(
a_dag
)
->
events
,
hash
,
sizeof
(
a_event_item
->
hash
),
a_event_item
);
s_dag_events_lasts_process_new_last_event
(
a_dag
,
a_event_item
);
s_dag_events_lasts_process_new_last_event
(
a_dag
,
a_event_item
);
}
else
{
}
else
{
if
(
memcmp
(
&
a_event_item
->
hash
,
&
a_dag
->
static_genesis_event_hash
,
sizeof
(
a_event_item
->
hash
)
)
==
0
){
char
l_buf_hash
[
128
];
res
=
0
;
dap_chain_hash_fast_to_str
(
&
a_event_item
->
hash
,
l_buf_hash
,
sizeof
(
l_buf_hash
)
-
1
);
}
else
{
log_it
(
L_WARNING
,
"Dag event %s check failed: code %d"
,
l_buf_hash
,
res
);
char
l_buf_hash
[
128
];
dap_chain_hash_fast_to_str
(
&
a_event_item
->
hash
,
l_buf_hash
,
sizeof
(
l_buf_hash
)
-
1
);
log_it
(
L_WARNING
,
"Dag event %s check failed: code %d"
,
l_buf_hash
,
res
);
}
}
}
return
res
;
return
res
;
}
}
...
...
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