From eb5eb9a4ce6dfc2a05bfd8a2702f52aa1e44a2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Al=D0=B5x=D0=B0nder=20Lysik=D0=BEv?= <alexander.lysikov@demlabs.net> Date: Wed, 30 Oct 2019 20:47:05 +0500 Subject: [PATCH] resolve conflict with master --- dap_chain_net.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/dap_chain_net.c b/dap_chain_net.c index 2e6ae1a..5882be7 100644 --- a/dap_chain_net.c +++ b/dap_chain_net.c @@ -1255,7 +1255,7 @@ int s_net_load(const char * a_net_name) l_node_addr = DAP_NEW_Z(dap_chain_node_addr_t); bool parse_succesfully = false; if ( sscanf(l_node_addr_str, "0x%016llx",&l_node_addr->uint64 ) == 1 ){ - log_it(L_DEBUG, "Parse node address with format 0x%016llx"); + log_it(L_DEBUG, "Parse node address with format 0x016llx"); parse_succesfully = true; } if ( !parse_succesfully && dap_chain_node_addr_from_str(l_node_addr, l_node_addr_str) == 0) { @@ -1362,10 +1362,25 @@ int s_net_load(const char * a_net_name) } break; case NODE_ROLE_CELL_MASTER: case NODE_ROLE_MASTER:{ - // Set to process only plasma chain (id 0x0000000000000001 ) - dap_chain_id_t l_chain_id = { .raw = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x01} }; - dap_chain_t * l_chain = dap_chain_find_by_id(l_net->pub.id, l_chain_id ); - if(l_chain) l_chain->is_datum_pool_proc = true; + uint16_t l_proc_chains_count=0; + char ** l_proc_chains = dap_config_get_array_str(l_cfg,"role-master" , "proc_chains", &l_proc_chains_count ); + for ( size_t i = 0; i< l_proc_chains_count ; i++){ + dap_chain_id_t l_chain_id = {{0}}; + if(dap_sscanf( l_proc_chains[i], "0x%16lX", &l_chain_id.uint64) ==1 || dap_scanf("0x%16lx", &l_chain_id.uint64) == 1){ + dap_chain_t * l_chain = dap_chain_find_by_id(l_net->pub.id, l_chain_id ); + if ( l_chain ){ + l_chain->is_datum_pool_proc = true; + }else{ + log_it( L_WARNING, "Can't find chain id " ); + } + } + DAP_DELETE( l_proc_chains[i]); + l_proc_chains[i] = NULL; + } + if ( l_proc_chains ) + DAP_DELETE (l_proc_chains); + l_proc_chains = NULL; + PVT(l_net)->state_target = NET_STATE_ONLINE; log_it(L_INFO,"Master node role established"); } break; -- GitLab