Skip to content

Commit

Permalink
Merge pull request #986 from Foggyx420/masterchk
Browse files Browse the repository at this point in the history
change filter for beacon report to beacon; datatype instead of beacon. note beaconalt
  • Loading branch information
denravonska committed Mar 3, 2018
2 parents 1ff53dd + 5bdbc9e commit e4038ba
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ bool PushGridcoinDiagnostics()
if (!bGlobalcomInitialized) return false;
std::string errors1 = "";
LoadAdminMessages(false,errors1);
std::string cpiddata = GetListOf("beacon");
std::string cpiddata = GetListOf("beacon;");
std::string sWhitelist = GetListOf("project");
int64_t superblock_age = GetAdjustedTime() - mvApplicationCacheTimestamp["superblock;magnitudes"];
double popularity = 0;
Expand Down
64 changes: 34 additions & 30 deletions src/rpcblockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,35 +893,39 @@ std::string GetListOf(std::string datatype)

std::string GetListOfWithConsensus(std::string datatype)
{
std::string rows = "";
std::string row = "";
int64_t iEndTime= (GetAdjustedTime()-CONSENSUS_LOOKBACK) - ( (GetAdjustedTime()-CONSENSUS_LOOKBACK) % BLOCK_GRANULARITY);
int64_t nLookback = 30 * 6 * 86400;
int64_t iStartTime = (iEndTime - nLookback) - ( (iEndTime - nLookback) % BLOCK_GRANULARITY);
printf(" getlistofwithconsensus startime %f , endtime %f, lookback %f \r\n ",(double)iStartTime,(double)iEndTime, (double)nLookback);
for(map<string,string>::iterator ii=mvApplicationCache.begin(); ii!=mvApplicationCache.end(); ++ii)
{
std::string key_name = (*ii).first;
if (key_name.length() > datatype.length())
{
if (key_name.substr(0,datatype.length())==datatype)
{
int64_t iBeaconTimestamp = mvApplicationCacheTimestamp[(*ii).first];
if (iBeaconTimestamp > iStartTime && iBeaconTimestamp < iEndTime)
{
std::string key_value = mvApplicationCache[(*ii).first];
std::string subkey = key_name.substr(datatype.length()+1,key_name.length()-datatype.length()-1);
row = subkey + "<COL>" + key_value;
if (Contains(row,"INVESTOR") && datatype=="beacon") row = "";
if (row != "")
{
rows += row + "<ROW>";
}
}
}
}
}
return rows;
std::string rows = "";
std::string row = "";
int64_t iEndTime= (GetAdjustedTime()-CONSENSUS_LOOKBACK) - ( (GetAdjustedTime()-CONSENSUS_LOOKBACK) % BLOCK_GRANULARITY);
int64_t nLookback = 30 * 6 * 86400;
int64_t iStartTime = (iEndTime - nLookback) - ( (iEndTime - nLookback) % BLOCK_GRANULARITY);
printf(" getlistofwithconsensus startime %f , endtime %f, lookback %f \r\n ",(double)iStartTime,(double)iEndTime, (double)nLookback);
for(map<string,string>::iterator ii=mvApplicationCache.begin(); ii!=mvApplicationCache.end(); ++ii)
{
std::string key_name = (*ii).first;
if (key_name.length() > datatype.length())
{
// Ignore beaconalts here as to not break the neural network
if (key_name.substr(0, datatype.length() + 3) == "beaconalt")
continue;

else if (key_name.substr(0,datatype.length())==datatype)
{
int64_t iBeaconTimestamp = mvApplicationCacheTimestamp[(*ii).first];
if (iBeaconTimestamp > iStartTime && iBeaconTimestamp < iEndTime)
{
std::string key_value = mvApplicationCache[(*ii).first];
std::string subkey = key_name.substr(datatype.length()+1,key_name.length()-datatype.length()-1);
row = subkey + "<COL>" + key_value;
if (Contains(row,"INVESTOR") && datatype=="beacon") row = "";
if (row != "")
{
rows += row + "<ROW>";
}
}
}
}
}
return rows;
}

std::string AddContract(std::string sType, std::string sName, std::string sContract)
Expand Down Expand Up @@ -3577,7 +3581,7 @@ Array GetJSONBeaconReport()
Array results;
Object entry;
entry.push_back(Pair("CPID","GRCAddress"));
std::string datatype="beacon";
std::string datatype="beacon;";
std::string row;
for(const auto& item : AppCacheFilter(datatype))
{
Expand Down

0 comments on commit e4038ba

Please sign in to comment.