Skip to content

Commit

Permalink
Add expiry check for pending beacon to hasPendingBeacon method
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Aug 20, 2023
1 parent de42859 commit 9ddf712
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/qt/researcher/researchermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,17 @@ bool ResearcherModel::hasActiveBeacon() const

bool ResearcherModel::hasPendingBeacon() const
{
return m_pending_beacon.operator bool();
if (!m_pending_beacon.operator bool()) {
return false;
}

// If here, a pending beacon is present. Determine if expired
// while pending. No need to actually clean the pending entry
// up. It will be eventually cleaned by the contract handler via
// the ActivatePending call.
GRC::PendingBeacon pending_beacon(*m_pending_beacon);

return !pending_beacon.PendingExpired(GetAdjustedTime());
}

bool ResearcherModel::hasRenewableBeacon() const
Expand Down
5 changes: 5 additions & 0 deletions src/qt/researcher/researchermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ class ResearcherModel : public QObject
bool hasEligibleProjects() const;
bool hasPoolProjects() const;
bool hasActiveBeacon() const;

//!
//! \brief hasPendingBeacon returns true if m_pending_beacon is not null and also not expired while pending.
//! \return boolean
//!
bool hasPendingBeacon() const;
bool hasRenewableBeacon() const;
bool beaconExpired() const;
Expand Down

0 comments on commit 9ddf712

Please sign in to comment.