diff --git a/src/chainparams/params.cpp b/src/chainparams/params.cpp index b876ba18..bf932df6 100644 --- a/src/chainparams/params.cpp +++ b/src/chainparams/params.cpp @@ -165,6 +165,11 @@ void* mc_MultichainParams::GetParam(const char *param,int* size) int mc_MultichainParams::IsParamUpgradeValueInRange(const mc_OneMultichainParam *param,int version,int64_t value) { + if((param->m_Type & MC_PRM_DATA_TYPE_MASK) == MC_PRM_BOOLEAN) + { + return 1; + } + if(value >= param->m_MinIntegerValue) { if(value <= param->m_MaxIntegerValue) @@ -280,6 +285,20 @@ int mc_MultichainParams::CanBeUpgradedByVersion(const char *param,int version,in } } + if( (strcmp(param,"anyonecanconnect") == 0) || + (strcmp(param,"anyonecansend") == 0) || + (strcmp(param,"anyonecanreceive") == 0) || + (strcmp(param,"anyonecanreceiveempty") == 0) || + (strcmp(param,"anyonecancreate") == 0) || + (strcmp(param,"anyonecanissue") == 0) || + (strcmp(param,"anyonecanactivate") == 0) ) + { + if(version >= 20007) + { + return m_lpCoord[2 * index + 1]; + } + } + return 0; diff --git a/src/core/main.cpp b/src/core/main.cpp index 22e24f47..6981476d 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -440,6 +440,41 @@ int SetUpgradedParamValue(const mc_OneMultichainParam *param,int64_t value) MAX_CHUNK_COUNT=value; } + if(strcmp(param->m_Name,"anyonecanconnect") == 0) + { + MCP_ANYONE_CAN_CONNECT=value; + } + + if(strcmp(param->m_Name,"anyonecansend") == 0) + { + MCP_ANYONE_CAN_SEND=value; + } + + if(strcmp(param->m_Name,"anyonecanreceive") == 0) + { + MCP_ANYONE_CAN_RECEIVE=value; + } + + if(strcmp(param->m_Name,"anyonecanreceiveempty") == 0) + { + MCP_ANYONE_CAN_RECEIVE_EMPTY=value; + } + + if(strcmp(param->m_Name,"anyonecancreate") == 0) + { + MCP_ANYONE_CAN_CREATE=value; + } + + if(strcmp(param->m_Name,"anyonecanissue") == 0) + { + MCP_ANYONE_CAN_ISSUE=value; + } + + if(strcmp(param->m_Name,"anyonecanactivate") == 0) + { + MCP_ANYONE_CAN_ACTIVATE=value; + } + return MC_ERR_NOERROR; } diff --git a/src/protocol/multichainblock.cpp b/src/protocol/multichainblock.cpp index 663a1523..86e97d84 100644 --- a/src/protocol/multichainblock.cpp +++ b/src/protocol/multichainblock.cpp @@ -191,33 +191,40 @@ int CreateUpgradeLists(int current_height,vector *vParams, if (it != map_last_upgrade.end()) { take_it=false; - if( ( (param.m_Param->m_Type & MC_PRM_TIME) == 0 ) || - ((*vParams)[it->second].m_Block + MIN_BLOCKS_BETWEEN_UPGRADES <= upgrade.m_AppliedBlock) ) + if(( param.m_Param->m_Type & MC_PRM_DATA_TYPE_MASK) == MC_PRM_BOOLEAN ) { - int64_t old_value=(*vParams)[it->second].m_Value; - if(param.m_Value >= old_value) + take_it=true; + } + else + { + if( ( (param.m_Param->m_Type & MC_PRM_TIME) == 0 ) || + ((*vParams)[it->second].m_Block + MIN_BLOCKS_BETWEEN_UPGRADES <= upgrade.m_AppliedBlock) ) { - if(param_value <= 2*old_value) + int64_t old_value=(*vParams)[it->second].m_Value; + if(param.m_Value >= old_value) { - take_it=true; + if(param_value <= 2*old_value) + { + take_it=true; + } } - } - else - { - if(old_value <= 2*param_value) + else { - take_it=true; - } + if(old_value <= 2*param_value) + { + take_it=true; + } + } + if(!take_it) + { + param.m_Skipped =MC_PSK_DOUBLE_RANGE; + } } - if(!take_it) + else { - param.m_Skipped =MC_PSK_DOUBLE_RANGE; + param.m_Skipped = MC_PSK_FRESH_UPGRADE; } } - else - { - param.m_Skipped = MC_PSK_FRESH_UPGRADE; - } if(take_it) { it->second=(int)vParams->size(); @@ -226,21 +233,28 @@ int CreateUpgradeLists(int current_height,vector *vParams, else { take_it=false; - int64_t old_value=mc_gState->m_NetworkParams->GetInt64Param(param.m_Param->m_Name); - - if(param.m_Value >= old_value) + if(( param.m_Param->m_Type & MC_PRM_DATA_TYPE_MASK) == MC_PRM_BOOLEAN ) { - if(param_value <= 2*old_value) - { - take_it=true; - } + take_it=true; } - else + else { - if(old_value <= 2*param_value) + int64_t old_value=mc_gState->m_NetworkParams->GetInt64Param(param.m_Param->m_Name); + + if(param.m_Value >= old_value) { - take_it=true; - } + if(param_value <= 2*old_value) + { + take_it=true; + } + } + else + { + if(old_value <= 2*param_value) + { + take_it=true; + } + } } if(!take_it) { diff --git a/src/rpc/rpcmisc.cpp b/src/rpc/rpcmisc.cpp index 360fbaae..df827d76 100644 --- a/src/rpc/rpcmisc.cpp +++ b/src/rpc/rpcmisc.cpp @@ -742,8 +742,36 @@ Value getblockchainparams(const json_spirit::Array& params, bool fHelp) { param_value=(int)MAX_CHUNK_COUNT; } + if(strcmp("anyonecanconnect",(mc_gState->m_NetworkParams->m_lpParams+i)->m_Name) == 0) + { + param_value=(MCP_ANYONE_CAN_CONNECT != 0); + } + if(strcmp("anyonecansend",(mc_gState->m_NetworkParams->m_lpParams+i)->m_Name) == 0) + { + param_value=(MCP_ANYONE_CAN_SEND != 0); + } + if(strcmp("anyonecanreceive",(mc_gState->m_NetworkParams->m_lpParams+i)->m_Name) == 0) + { + param_value=(MCP_ANYONE_CAN_RECEIVE != 0); + } + if(strcmp("anyonecanreceiveempty",(mc_gState->m_NetworkParams->m_lpParams+i)->m_Name) == 0) + { + param_value=(MCP_ANYONE_CAN_RECEIVE_EMPTY != 0); + } + if(strcmp("anyonecancreate",(mc_gState->m_NetworkParams->m_lpParams+i)->m_Name) == 0) + { + param_value=(MCP_ANYONE_CAN_CREATE != 0); + } + if(strcmp("anyonecanissue",(mc_gState->m_NetworkParams->m_lpParams+i)->m_Name) == 0) + { + param_value=(MCP_ANYONE_CAN_ISSUE != 0); + } + if(strcmp("anyonecanactivate",(mc_gState->m_NetworkParams->m_lpParams+i)->m_Name) == 0) + { + param_value=(MCP_ANYONE_CAN_ACTIVATE != 0); + } } - + if(!hidden) { obj.push_back(Pair(param_name,param_value));