diff --git a/src/gridcoin/sidestake.cpp b/src/gridcoin/sidestake.cpp index de996ee234..45eea5e7f1 100644 --- a/src/gridcoin/sidestake.cpp +++ b/src/gridcoin/sidestake.cpp @@ -172,6 +172,20 @@ const SideStakeRegistry::SideStakeMap& SideStakeRegistry::SideStakeEntries() con return m_sidestake_entries; } +const std::vector SideStakeRegistry::ActiveSideStakeEntries() const +{ + std::vector sidestakes; + + for (const auto& entry : m_sidestake_entries) + { + if (entry.second->m_status == SideStakeStatus::ACTIVE || entry.second->m_status == SideStakeStatus::MANDATORY) { + sidestakes.push_back(entry.second); + } + } + + return sidestakes; +} + SideStakeOption SideStakeRegistry::Try(const CBitcoinAddressForStorage& key) const { LOCK(cs_lock); diff --git a/src/gridcoin/sidestake.h b/src/gridcoin/sidestake.h index c63b8ab28c..9ac2090236 100644 --- a/src/gridcoin/sidestake.h +++ b/src/gridcoin/sidestake.h @@ -367,6 +367,15 @@ class SideStakeRegistry : public IContractHandler //! const SideStakeMap& SideStakeEntries() const; + //! + //! \brief Get the collection of active sidestake entries. This is presented as a vector of + //! smart pointers to the relevant sidestake entries in the database. The entries included have + //! the status of active (for local sidestakes) and/or mandatory (for contract sidestakes). + //! + //! \return A vector of smart pointers to sidestake entries. + //! + const std::vector ActiveSideStakeEntries() const; + //! //! \brief Get the current sidestake entry for the specified key string. //!