From 2f601720329eef827d00a4f608a46367101c0b5d Mon Sep 17 00:00:00 2001 From: Aleksey Feoktistov <aleksey@synestproject.com> Date: Mon, 28 Mar 2022 12:47:29 +0500 Subject: [PATCH 1/7] [+] add param round_start_multiple_of --- modules/consensus/block-ton/dap_chain_cs_block_ton.c | 8 +++++--- .../consensus/block-ton/include/dap_chain_cs_block_ton.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/consensus/block-ton/dap_chain_cs_block_ton.c b/modules/consensus/block-ton/dap_chain_cs_block_ton.c index 0e18767c0..acbed286f 100644 --- a/modules/consensus/block-ton/dap_chain_cs_block_ton.c +++ b/modules/consensus/block-ton/dap_chain_cs_block_ton.c @@ -61,6 +61,7 @@ typedef struct dap_chain_cs_block_ton_pvt bool debug; bool validators_list_by_stake; uint16_t round_start_sync_timeout; + uint16_t round_start_multiple_of; uint32_t allowed_clock_offset; uint32_t session_idle_min; uint16_t round_candidates_max; @@ -114,6 +115,7 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) { l_ton_pvt->validators_list_by_stake = dap_config_get_item_bool_default(a_chain_cfg,"block-ton","validators_list_by_stake", false); l_ton_pvt->round_start_sync_timeout = dap_config_get_item_uint16_default(a_chain_cfg,"block-ton", "round_start_sync_timeout", 10); + l_ton_pvt->round_start_multiple_of = dap_config_get_item_uint16_default(a_chain_cfg,"block-ton", "round_start_multiple_of", 30); l_ton_pvt->allowed_clock_offset = dap_config_get_item_uint32_default(a_chain_cfg,"block-ton", "allowed_clock_offset", 5); l_ton_pvt->session_idle_min = dap_config_get_item_uint32_default(a_chain_cfg,"block-ton", "session_idle_min", 15); l_ton_pvt->round_candidates_max = dap_config_get_item_uint16_default(a_chain_cfg,"block-ton", "round_candidates_max", 3); @@ -235,7 +237,7 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf l_session->debug = l_ton_pvt->debug; l_session->round_start_sync_timeout = l_ton_pvt->round_start_sync_timeout; - l_session->consensus_start_period = 20; // hint: if((time()/10) % consensus_start)==0 + l_session->round_start_multiple_of = l_ton_pvt->round_start_multiple_of; // hint: if((time()/10) % consensus_start)==0 l_session->allowed_clock_offset = l_ton_pvt->allowed_clock_offset; l_session->session_idle_min = l_ton_pvt->session_idle_min; l_session->round_candidates_max = l_ton_pvt->round_candidates_max; @@ -264,7 +266,7 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf dap_chain_time_t l_time = (dap_chain_time_t)time(NULL); while (true) { l_time++; - if ( (l_time % l_session->consensus_start_period) == 0) { + if ( (l_time % l_session->round_start_multiple_of) == 0) { l_session->ts_round_sync_start = l_time; break; } @@ -349,7 +351,7 @@ static bool s_session_timer() { l_session->time_proc_lock = true; // lock - skip check by reasons: prev check is not finish switch (l_session->state) { case DAP_STREAM_CH_CHAIN_SESSION_STATE_IDLE: { - if ( (((l_time/10)*10) % l_session->consensus_start_period) == 0 + if ( (((l_time/10)*10) % l_session->round_start_multiple_of) == 0 && (l_time - ((l_time/10)*10)) <= 3 && l_time > l_session->ts_round_finish && (l_time-l_session->ts_round_finish) >= l_session->session_idle_min) { diff --git a/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h b/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h index b5b762e02..8d5730425 100644 --- a/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h +++ b/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h @@ -72,7 +72,7 @@ typedef struct dap_chain_cs_block_ton_items { bool debug; uint16_t round_start_sync_timeout; - uint16_t consensus_start_period; + uint16_t round_start_multiple_of; uint32_t allowed_clock_offset; uint32_t session_idle_min; uint16_t round_candidates_max; -- GitLab From 8c2fb004aae7227456a1910bafb877b8a985842d Mon Sep 17 00:00:00 2001 From: Aleksey Feoktistov <aleksey@synestproject.com> Date: Mon, 28 Mar 2022 20:28:09 +0500 Subject: [PATCH 2/7] [+] add seed nodes addrs from cfg & fix --- .../block-ton/dap_chain_cs_block_ton.c | 41 ++++++++++++++----- .../include/dap_chain_cs_block_ton.h | 1 + .../service/stake/dap_chain_net_srv_stake.c | 3 ++ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/modules/consensus/block-ton/dap_chain_cs_block_ton.c b/modules/consensus/block-ton/dap_chain_cs_block_ton.c index acbed286f..5a37187a0 100644 --- a/modules/consensus/block-ton/dap_chain_cs_block_ton.c +++ b/modules/consensus/block-ton/dap_chain_cs_block_ton.c @@ -28,7 +28,7 @@ static void s_message_chain_add(dap_chain_cs_block_ton_items_t * a_session, dap_ dap_chain_cs_block_ton_message_t * a_message, size_t a_message_size, dap_chain_hash_fast_t *a_message_hash); static void s_session_round_start(dap_chain_cs_block_ton_items_t *a_session); -static void s_session_block_new_delete(dap_chain_cs_block_ton_items_t *a_sessio); +static void s_session_block_new_delete(dap_chain_cs_block_ton_items_t *a_session); static bool s_session_round_finish(dap_chain_cs_block_ton_items_t *a_session); static dap_chain_node_addr_t * s_session_get_validator_by_addr( @@ -41,7 +41,7 @@ static int s_callback_block_verify(dap_chain_cs_blocks_t *a_blocks, dap_chain_bl static int s_compare_validators_list_stake(const void * a_item1, const void * a_item2, void *a_unused); static int s_compare_validators_list_addr(const void * a_item1, const void * a_item2, void *a_unused); -static dap_list_t *s_get_validators_addr_list(dap_chain_t *a_chain); +static dap_list_t *s_get_validators_addr_list(dap_chain_cs_block_ton_items_t *a_session); //(dap_chain_t *a_chain); static bool s_hash_is_null(dap_chain_hash_fast_t *a_hash); @@ -179,9 +179,9 @@ static int s_compare_validators_list_addr(const void * a_item1, const void * a_i return -1; } -static dap_list_t *s_get_validators_addr_list(dap_chain_t *a_chain) { +static dap_list_t *s_get_validators_addr_list(dap_chain_cs_block_ton_items_t *a_session) {//(dap_chain_t *a_chain) { - dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(a_chain); + dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(a_session->chain); dap_chain_cs_block_ton_t *l_ton = DAP_CHAIN_CS_BLOCK_TON(l_blocks); dap_chain_cs_block_ton_pvt_t *l_ton_pvt = PVT(l_ton); dap_list_t *l_ret = NULL; @@ -203,8 +203,15 @@ static dap_list_t *s_get_validators_addr_list(dap_chain_t *a_chain) { dap_list_free(l_list); } else { - dap_chain_net_t *l_net = dap_chain_net_by_id(a_chain->net_id); - l_ret = dap_chain_net_get_node_list(l_net); + dap_chain_net_t *l_net = dap_chain_net_by_id(a_session->chain->net_id); + dap_list_t *l_list = dap_list_first(a_session->seed_nodes_addrs); + while (l_list) { + dap_chain_node_addr_t *l_addr = + (dap_chain_node_addr_t *)DAP_DUP_SIZE( + l_list->data, sizeof(dap_chain_node_addr_t)); + l_ret = dap_list_append(l_ret, l_addr); + l_list = l_list->next; + } l_ret = dap_list_sort(l_ret, s_compare_validators_list_addr); } return l_ret; @@ -231,9 +238,23 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf log_it(L_ERROR, "No sign certificate provided, can't sign any blocks"); } - dap_chain_cs_block_ton_items_t *l_session = DAP_NEW_Z(dap_chain_cs_block_ton_items_t); dap_chain_net_t *l_net = dap_chain_net_by_id(a_chain->net_id); + dap_chain_cs_block_ton_items_t *l_session = DAP_NEW_Z(dap_chain_cs_block_ton_items_t); + l_session->chain = a_chain; + l_session->seed_nodes_addrs = NULL; + + uint16_t seed_aliases_count; + char **l_seed_aliases = dap_config_get_array_str(a_chain_net_cfg, "general", "seed_nodes_aliases", &seed_aliases_count); + // l_net_pvt->seed_aliases = l_net_pvt->seed_aliases_count>0 ? + // (char **)DAP_NEW_SIZE(char**, sizeof(char*)*PVT(l_net)->seed_aliases_count) : NULL; + for(size_t i = 0; i < seed_aliases_count; i++) { + // l_net_pvt->seed_aliases[i] = dap_strdup(l_seed_aliases[i]); + dap_chain_node_addr_t *l_seed_node_addr = dap_chain_node_alias_find(l_net, l_seed_aliases[i] ); + if (l_seed_node_addr) { + l_session->seed_nodes_addrs = dap_list_append(l_session->seed_nodes_addrs, l_seed_node_addr); + } + } l_session->debug = l_ton_pvt->debug; l_session->round_start_sync_timeout = l_ton_pvt->round_start_sync_timeout; @@ -246,7 +267,7 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf l_session->round_attempt_duration = l_ton_pvt->round_attempt_duration; l_session->first_message_delay = l_ton_pvt->first_message_delay; - l_session->cur_round.validators_list = s_get_validators_addr_list(a_chain); + l_session->cur_round.validators_list = s_get_validators_addr_list(l_session); l_session->cur_round.validators_count = dap_list_length(l_session->cur_round.validators_list); l_session->my_addr = DAP_NEW(dap_chain_node_addr_t); @@ -258,7 +279,6 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf a_chain->net_name, a_chain->name); l_session->gdb_group_message = dap_strdup_printf("local.ton.%s.%s.message", a_chain->net_name, a_chain->name); - l_session->chain = a_chain; l_session->state = DAP_STREAM_CH_CHAIN_SESSION_STATE_IDLE; l_session->blocks_sign_key = PVT(l_ton)->blocks_sign_key; l_session->time_proc_lock = false; @@ -360,7 +380,8 @@ static bool s_session_timer() { l_session->state = DAP_STREAM_CH_CHAIN_SESSION_STATE_WAIT_START; s_session_round_start(l_session); - l_session->cur_round.validators_list = s_get_validators_addr_list(l_session->chain); + dap_list_free_full(l_session->cur_round.validators_list, free); + l_session->cur_round.validators_list = s_get_validators_addr_list(l_session); l_session->cur_round.validators_count = dap_list_length(l_session->cur_round.validators_list); dap_timerfd_start(l_session->first_message_delay*1000, diff --git a/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h b/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h index 8d5730425..dffbdf2f9 100644 --- a/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h +++ b/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h @@ -47,6 +47,7 @@ typedef struct dap_chain_cs_block_ton_items { dap_chain_t *chain; dap_chain_node_addr_t *my_addr; + dap_list_t *seed_nodes_addrs; // dap_chain_node_addr_t uint8_t state; // session state dap_chain_cs_block_ton_round_t cur_round; diff --git a/modules/service/stake/dap_chain_net_srv_stake.c b/modules/service/stake/dap_chain_net_srv_stake.c index e5b5c0dbe..ac71d863c 100644 --- a/modules/service/stake/dap_chain_net_srv_stake.c +++ b/modules/service/stake/dap_chain_net_srv_stake.c @@ -263,6 +263,9 @@ bool dap_chain_net_srv_stake_key_delegated(dap_chain_addr_t *a_addr) dap_list_t *dap_chain_net_srv_stake_get_validators() { dap_list_t *l_ret = NULL; + if (!s_srv_stake || !s_srv_stake->itemlist) { + return l_ret; + } dap_chain_net_srv_stake_item_t *l_stake, *l_tmp; HASH_ITER(hh, s_srv_stake->itemlist, l_stake, l_tmp) { if (l_stake->is_active) -- GitLab From 886ab8e5c9b0f8b954b73e028102784a44b40beb Mon Sep 17 00:00:00 2001 From: Aleksey Feoktistov <aleksey@synestproject.com> Date: Tue, 29 Mar 2022 17:35:30 +0500 Subject: [PATCH 3/7] [*] fix --- modules/channel/chain/dap_stream_ch_chain.c | 2 +- modules/consensus/block-ton/dap_chain_cs_block_ton.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/channel/chain/dap_stream_ch_chain.c b/modules/channel/chain/dap_stream_ch_chain.c index 60c735dee..39134af5b 100644 --- a/modules/channel/chain/dap_stream_ch_chain.c +++ b/modules/channel/chain/dap_stream_ch_chain.c @@ -1067,7 +1067,7 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) } break; // first packet of data with source node address case DAP_STREAM_CH_CHAIN_PKT_TYPE_FIRST_GLOBAL_DB: { - if(l_chain_pkt_data_size == sizeof(dap_chain_node_addr_t)){ + if(l_chain_pkt_data_size == (size_t)sizeof(dap_chain_node_addr_t)){ memcpy(&l_ch_chain->request.node_addr, l_chain_pkt->data, l_chain_pkt_data_size); l_ch_chain->stats_request_gdb_processed = 0; log_it(L_INFO, "In: FIRST_GLOBAL_DB data_size=%zu net 0x%016"DAP_UINT64_FORMAT_x" chain 0x%016"DAP_UINT64_FORMAT_x" cell 0x%016"DAP_UINT64_FORMAT_x diff --git a/modules/consensus/block-ton/dap_chain_cs_block_ton.c b/modules/consensus/block-ton/dap_chain_cs_block_ton.c index 5a37187a0..968758a52 100644 --- a/modules/consensus/block-ton/dap_chain_cs_block_ton.c +++ b/modules/consensus/block-ton/dap_chain_cs_block_ton.c @@ -246,10 +246,7 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf uint16_t seed_aliases_count; char **l_seed_aliases = dap_config_get_array_str(a_chain_net_cfg, "general", "seed_nodes_aliases", &seed_aliases_count); - // l_net_pvt->seed_aliases = l_net_pvt->seed_aliases_count>0 ? - // (char **)DAP_NEW_SIZE(char**, sizeof(char*)*PVT(l_net)->seed_aliases_count) : NULL; for(size_t i = 0; i < seed_aliases_count; i++) { - // l_net_pvt->seed_aliases[i] = dap_strdup(l_seed_aliases[i]); dap_chain_node_addr_t *l_seed_node_addr = dap_chain_node_alias_find(l_net, l_seed_aliases[i] ); if (l_seed_node_addr) { l_session->seed_nodes_addrs = dap_list_append(l_session->seed_nodes_addrs, l_seed_node_addr); @@ -258,7 +255,7 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf l_session->debug = l_ton_pvt->debug; l_session->round_start_sync_timeout = l_ton_pvt->round_start_sync_timeout; - l_session->round_start_multiple_of = l_ton_pvt->round_start_multiple_of; // hint: if((time()/10) % consensus_start)==0 + l_session->round_start_multiple_of = l_ton_pvt->round_start_multiple_of; // hint: if((time()/30) % consensus_start)==0 l_session->allowed_clock_offset = l_ton_pvt->allowed_clock_offset; l_session->session_idle_min = l_ton_pvt->session_idle_min; l_session->round_candidates_max = l_ton_pvt->round_candidates_max; @@ -684,7 +681,8 @@ static int s_session_datums_validation(dap_chain_cs_blocks_t *a_blocks, dap_chai } } } - return 0; + // it's temporary (reject other datums type) + return -3; } static void s_session_block_new_delete(dap_chain_cs_block_ton_items_t *a_session) { @@ -1768,6 +1766,7 @@ static size_t s_callback_block_sign(dap_chain_cs_blocks_t *a_blocks, dap_chain_b return dap_chain_block_sign_add(a_block_ptr, a_block_size, l_ton_pvt->blocks_sign_key); } +// not used static int s_callback_block_verify(dap_chain_cs_blocks_t *a_blocks, dap_chain_block_t *a_block, size_t a_block_size) { dap_chain_cs_block_ton_t *l_ton = DAP_CHAIN_CS_BLOCK_TON(a_blocks); -- GitLab From 6718720722ef14a1636ef035cfb847a33ced980e Mon Sep 17 00:00:00 2001 From: Aleksey Feoktistov <aleksey@synestproject.com> Date: Tue, 29 Mar 2022 21:42:52 +0500 Subject: [PATCH 4/7] [*] fix gdb sync --- modules/channel/chain/dap_stream_ch_chain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/channel/chain/dap_stream_ch_chain.c b/modules/channel/chain/dap_stream_ch_chain.c index 39134af5b..c16db6665 100644 --- a/modules/channel/chain/dap_stream_ch_chain.c +++ b/modules/channel/chain/dap_stream_ch_chain.c @@ -363,7 +363,7 @@ static void s_sync_out_gdb_last_worker_callback(dap_worker_t *a_worker, void *a_ if (s_debug_more ) log_it(L_INFO,"Out: DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_GLOBAL_DB"); - dap_stream_ch_chain_pkt_write_unsafe(DAP_STREAM_CH(l_ch_chain), DAP_STREAM_CH_CHAIN_PKT_TYPE_FIRST_GLOBAL_DB, + dap_stream_ch_chain_pkt_write_unsafe(DAP_STREAM_CH(l_ch_chain), DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_GLOBAL_DB, l_ch_chain->request_hdr.net_id.uint64, l_ch_chain->request_hdr.chain_id.uint64, l_ch_chain->request_hdr.cell_id.uint64, NULL, 0); l_ch_chain->state = CHAIN_STATE_IDLE; @@ -940,7 +940,7 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) } log_it(L_INFO, "In: UPDATE_GLOBAL_DB_REQ pkt: net 0x%016"DAP_UINT64_FORMAT_x" chain 0x%016"DAP_UINT64_FORMAT_x" cell 0x%016"DAP_UINT64_FORMAT_x, l_chain_pkt->hdr.net_id.uint64, l_chain_pkt->hdr.chain_id.uint64, l_chain_pkt->hdr.cell_id.uint64); - if (l_chain_pkt_data_size == sizeof(dap_stream_ch_chain_sync_request_t)) + if (l_chain_pkt_data_size == (size_t)sizeof(dap_stream_ch_chain_sync_request_t)) memcpy(&l_ch_chain->request, l_chain_pkt->data, sizeof(dap_stream_ch_chain_sync_request_t)); dap_chain_node_client_t *l_client = (dap_chain_node_client_t *)l_ch_chain->callback_notify_arg; if (l_client && l_client->resync_gdb) @@ -1302,7 +1302,7 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) } break; // first packet of data with source node address case DAP_STREAM_CH_CHAIN_PKT_TYPE_FIRST_CHAIN: { - if(l_chain_pkt_data_size == sizeof(dap_chain_node_addr_t)){ + if(l_chain_pkt_data_size == (size_t)sizeof(dap_chain_node_addr_t)){ memcpy(&l_ch_chain->request_hdr, &l_chain_pkt->hdr, sizeof(dap_stream_ch_chain_pkt_hdr_t)); memcpy(&l_ch_chain->request.node_addr, l_chain_pkt->data, sizeof(dap_chain_node_addr_t)); log_it(L_INFO, "From "NODE_ADDR_FP_STR": FIRST_CHAIN data_size=%zu net 0x%016"DAP_UINT64_FORMAT_x" chain 0x%016"DAP_UINT64_FORMAT_x" cell 0x%016"DAP_UINT64_FORMAT_x, -- GitLab From 23926743e2d98d484d6a6e9abf98937d013d37c4 Mon Sep 17 00:00:00 2001 From: Aleksey Feoktistov <aleksey@synestproject.com> Date: Wed, 30 Mar 2022 11:28:14 +0500 Subject: [PATCH 5/7] [*] ton --- modules/consensus/block-ton/dap_chain_cs_block_ton.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/consensus/block-ton/dap_chain_cs_block_ton.c b/modules/consensus/block-ton/dap_chain_cs_block_ton.c index 968758a52..2448d3fb1 100644 --- a/modules/consensus/block-ton/dap_chain_cs_block_ton.c +++ b/modules/consensus/block-ton/dap_chain_cs_block_ton.c @@ -681,8 +681,7 @@ static int s_session_datums_validation(dap_chain_cs_blocks_t *a_blocks, dap_chai } } } - // it's temporary (reject other datums type) - return -3; + return 0; } static void s_session_block_new_delete(dap_chain_cs_block_ton_items_t *a_session) { -- GitLab From 916bd66382b657a243aad783fca95e0d810c2a21 Mon Sep 17 00:00:00 2001 From: Aleksey Feoktistov <aleksey@synestproject.com> Date: Wed, 30 Mar 2022 20:06:40 +0500 Subject: [PATCH 6/7] [*] gdb sync fix --- modules/channel/chain/dap_stream_ch_chain.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/channel/chain/dap_stream_ch_chain.c b/modules/channel/chain/dap_stream_ch_chain.c index 9fdd7c08f..6799edd03 100644 --- a/modules/channel/chain/dap_stream_ch_chain.c +++ b/modules/channel/chain/dap_stream_ch_chain.c @@ -773,15 +773,16 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg) (dap_chain_datum_t** restrict) &l_store_obj_value, 1, l_store_obj[i].group); } - } else { - // save data to global_db - if(!dap_chain_global_db_obj_save(l_obj, 1)) { - struct sync_request *l_sync_req_err = DAP_DUP(l_sync_request); - dap_proc_thread_worker_exec_callback(a_thread, l_sync_request->worker->id, - s_gdb_in_pkt_error_worker_callback, l_sync_req_err); - } else { - if (s_debug_more) - log_it(L_DEBUG, "Added new GLOBAL_DB synchronization record"); + else { + // save data to global_db + if(!dap_chain_global_db_obj_save(l_obj, 1)) { + struct sync_request *l_sync_req_err = DAP_DUP(l_sync_request); + dap_proc_thread_worker_exec_callback(a_thread, l_sync_request->worker->id, + s_gdb_in_pkt_error_worker_callback, l_sync_req_err); + } else { + if (s_debug_more) + log_it(L_DEBUG, "Added new GLOBAL_DB synchronization record"); + } } } -- GitLab From 747adb6ec9f7f1496bb69b322254ee20c7dbcc10 Mon Sep 17 00:00:00 2001 From: Aleksey Feoktistov <aleksey@synestproject.com> Date: Wed, 30 Mar 2022 20:42:29 +0500 Subject: [PATCH 7/7] [*] gdb sync fix --- modules/channel/chain/dap_stream_ch_chain.c | 22 ++++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/modules/channel/chain/dap_stream_ch_chain.c b/modules/channel/chain/dap_stream_ch_chain.c index 6799edd03..71cf06830 100644 --- a/modules/channel/chain/dap_stream_ch_chain.c +++ b/modules/channel/chain/dap_stream_ch_chain.c @@ -773,19 +773,17 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg) (dap_chain_datum_t** restrict) &l_store_obj_value, 1, l_store_obj[i].group); } - else { - // save data to global_db - if(!dap_chain_global_db_obj_save(l_obj, 1)) { - struct sync_request *l_sync_req_err = DAP_DUP(l_sync_request); - dap_proc_thread_worker_exec_callback(a_thread, l_sync_request->worker->id, - s_gdb_in_pkt_error_worker_callback, l_sync_req_err); - } else { - if (s_debug_more) - log_it(L_DEBUG, "Added new GLOBAL_DB synchronization record"); - } - } } - + // save data to global_db + if(!dap_chain_global_db_obj_save(l_obj, 1)) { + struct sync_request *l_sync_req_err = DAP_DUP(l_sync_request); + dap_proc_thread_worker_exec_callback(a_thread, l_sync_request->worker->id, + s_gdb_in_pkt_error_worker_callback, l_sync_req_err); + } + else { + if (s_debug_more) + log_it(L_DEBUG, "Added new GLOBAL_DB synchronization record"); + } } if(l_store_obj) { dap_store_obj_free(l_store_obj, l_data_obj_count); -- GitLab