Skip to content

Commit 2fe6d02

Browse files
committed
Additional changes to scraper from debugging (to be squashed)
1 parent 29d5b0c commit 2fe6d02

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

src/gridcoin/scraper/scraper.cpp

+10-18
Original file line numberDiff line numberDiff line change
@@ -3937,8 +3937,6 @@ ScraperStatsVerifiedBeaconsTotalCredits GetScraperStatsByConvergedManifest(const
39373937
// Enumerate the count of active projects from the dummy converged manifest. One of the parts
39383938
// is the beacon list, is not a project, which is why that should not be included in the count.
39393939
// Populate the verified beacons map, and if it is don't count that either.
3940-
ScraperPendingBeaconMap VerifiedBeaconMap;
3941-
39423940
int exclude_parts_from_count = 1;
39433941

39443942
auto iter = StructConvergedManifest.ConvergedManifestPartPtrsMap.find("VerifiedBeacons");
@@ -3948,7 +3946,7 @@ ScraperStatsVerifiedBeaconsTotalCredits GetScraperStatsByConvergedManifest(const
39483946

39493947
try
39503948
{
3951-
part >> VerifiedBeaconMap;
3949+
part >> stats_verified_beacons_tc.mVerifiedMap;
39523950
}
39533951
catch (const std::exception& e)
39543952
{
@@ -3958,18 +3956,14 @@ ScraperStatsVerifiedBeaconsTotalCredits GetScraperStatsByConvergedManifest(const
39583956
++exclude_parts_from_count;
39593957
}
39603958

3961-
stats_verified_beacons_tc.mVerifiedMap = VerifiedBeaconMap;
3962-
3963-
std::map<std::string, double> projects_all_cpid_total_credits_map;
3964-
39653959
iter = StructConvergedManifest.ConvergedManifestPartPtrsMap.find("ProjectsAllCpidTotalCredits");
39663960
if (iter != StructConvergedManifest.ConvergedManifestPartPtrsMap.end())
39673961
{
39683962
CDataStream part(iter->second->data, SER_NETWORK, 1);
39693963

39703964
try
39713965
{
3972-
part >> projects_all_cpid_total_credits_map;
3966+
part >> stats_verified_beacons_tc.m_total_credit_map;
39733967
}
39743968
catch (const std::exception& e)
39753969
{
@@ -3979,8 +3973,6 @@ ScraperStatsVerifiedBeaconsTotalCredits GetScraperStatsByConvergedManifest(const
39793973
++exclude_parts_from_count;
39803974
}
39813975

3982-
stats_verified_beacons_tc.m_total_credit_map = projects_all_cpid_total_credits_map;
3983-
39843976
unsigned int nActiveProjects = StructConvergedManifest.ConvergedManifestPartPtrsMap.size() - exclude_parts_from_count;
39853977

39863978
// If a project part is greylisted, do not count it as an active project, even though stats have been collected.
@@ -4660,6 +4652,14 @@ EXCLUSIVE_LOCKS_REQUIRED(cs_StructScraperFileManifest, CScraperManifest::cs_mapM
46604652
auto scraper_cmanifest_include_noncurrent_proj_files =
46614653
[]() { LOCK(cs_ScraperGlobals); return SCRAPER_CMANIFEST_INCLUDE_NONCURRENT_PROJ_FILES; };
46624654

4655+
// Populate the all cpid total credit map from current entries only. Keep track of the timestamps and assign
4656+
// the latest manifest file entry timestamp to the total_credit_map_timestamp.
4657+
if (entry.second.current && !entry.second.excludefromcsmanifest) {
4658+
total_credit_map.insert(std::make_pair(entry.first, entry.second.all_cpid_total_credit));
4659+
4660+
total_credit_map_timestamp = std::max(entry.second.timestamp, total_credit_map_timestamp);
4661+
}
4662+
46634663
// If SCRAPER_CMANIFEST_INCLUDE_NONCURRENT_PROJ_FILES is false, only include current files to send across the
46644664
// network. Also continue (exclude) if it is a non-publishable entry (excludefromcsmanifest is true) or
46654665
// if it has no records.
@@ -4668,14 +4668,6 @@ EXCLUSIVE_LOCKS_REQUIRED(cs_StructScraperFileManifest, CScraperManifest::cs_mapM
46684668
continue;
46694669
}
46704670

4671-
// Populate the all cpid total credit map from current entries only. Keep track of the timestamps and assign
4672-
// the latest manifest file entry timestamp to the total_credit_map_timestamp.
4673-
if (entry.second.current) {
4674-
total_credit_map.insert(std::make_pair(entry.first, entry.second.all_cpid_total_credit));
4675-
4676-
total_credit_map_timestamp = std::max(entry.second.timestamp, total_credit_map_timestamp);
4677-
}
4678-
46794671
fs::path inputfile = entry.first;
46804672

46814673
fs::path inputfilewpath = pathScraper / inputfile;

src/gridcoin/scraper/scraper_net.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -881,10 +881,8 @@ UniValue CScraperManifest::ToJson() const EXCLUSIVE_LOCKS_REQUIRED(CSplitBlob::c
881881
if (part.project != "ProjectsAllCpidTotalCredits") {
882882
projects.push_back(part.ToJson());
883883

884-
} else {
885-
CDataStream ss(SER_NETWORK, 1);
886-
887-
ss << vParts[part.part1]->data;
884+
} else if (!vParts[part.part1]->data.empty()) {
885+
CDataStream ss(vParts[part.part1]->data, SER_NETWORK, 1);
888886

889887
ss >> total_credit_map;
890888

0 commit comments

Comments
 (0)