Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diag: fix researcher mode check #2725

Merged
merged 2 commits into from
Dec 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/wallet/diagnose.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Diagnose

m_hasEligibleProjects = researcher->Id().Which() == GRC::MiningId::Kind::CPID;
m_hasPoolProjects = researcher->Projects().ContainsPool();
m_researcher_mode = !(configured_for_investor_mode || (!m_hasEligibleProjects && m_hasPoolProjects));
m_researcher_mode = !(configured_for_investor_mode || (!m_hasEligibleProjects && !m_hasPoolProjects));
}

/**
Expand Down Expand Up @@ -532,15 +532,16 @@ class VerifyCPIDHasRAC : public Diagnose
*/

const GRC::BeaconRegistry& beacons = GRC::GetBeaconRegistry();
const GRC::CpidOption cpid = GRC::Researcher::Get()->Id().TryCpid();
if (const GRC::BeaconOption beacon = beacons.Try(*cpid)) {
if (!beacon->Expired(GetAdjustedTime())) {
return true;
}
for (const auto& beacon_ptr : beacons.FindPending(*cpid)) {
if (!beacon_ptr->Expired(GetAdjustedTime())) {
if (const GRC::CpidOption cpid = GRC::Researcher::Get()->Id().TryCpid()) {
if (const GRC::BeaconOption beacon = beacons.Try(*cpid)) {
if (!beacon->Expired(GetAdjustedTime())) {
return true;
}
for (const auto& beacon_ptr : beacons.FindPending(*cpid)) {
if (!beacon_ptr->Expired(GetAdjustedTime())) {
return true;
}
}
}
}
return false;
Expand Down