consensus: Clearly gate active funding stream elements on Canopy
We only use the output of GetActiveFundingStreamElements and GetActiveFundingStreams within Canopy contexts, but this makes it explicit that funding streams are disabled before Canopy activation.
This commit is contained in:
parent
768534a8b9
commit
c595056883
|
@ -53,6 +53,9 @@ std::set<FundingStreamElement> GetActiveFundingStreamElements(
|
|||
const Consensus::Params& params)
|
||||
{
|
||||
std::set<std::pair<FundingStreamAddress, CAmount>> requiredElements;
|
||||
|
||||
// Funding streams are disabled if height < CanopyActivationHeight
|
||||
if (params.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_CANOPY)) {
|
||||
for (uint32_t idx = Consensus::FIRST_FUNDING_STREAM; idx < Consensus::MAX_FUNDING_STREAMS; idx++) {
|
||||
// The following indexed access is safe as Consensus::MAX_FUNDING_STREAMS is used
|
||||
// in the definition of vFundingStreams.
|
||||
|
@ -64,6 +67,8 @@ std::set<FundingStreamElement> GetActiveFundingStreamElements(
|
|||
FundingStreamInfo[idx].Value(blockSubsidy)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return requiredElements;
|
||||
};
|
||||
|
||||
|
@ -72,12 +77,17 @@ std::vector<FSInfo> GetActiveFundingStreams(
|
|||
const Consensus::Params& params)
|
||||
{
|
||||
std::vector<FSInfo> activeStreams;
|
||||
|
||||
// Funding streams are disabled if height < CanopyActivationHeight
|
||||
if (params.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_CANOPY)) {
|
||||
for (uint32_t idx = Consensus::FIRST_FUNDING_STREAM; idx < Consensus::MAX_FUNDING_STREAMS; idx++) {
|
||||
auto fs = params.vFundingStreams[idx];
|
||||
if (fs && nHeight >= fs.get().GetStartHeight() && nHeight < fs.get().GetEndHeight()) {
|
||||
activeStreams.push_back(FundingStreamInfo[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return activeStreams;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@ struct FSInfo {
|
|||
uint64_t valueNumerator;
|
||||
uint64_t valueDenominator;
|
||||
|
||||
/**
|
||||
* Returns the inherent value of this funding stream.
|
||||
*
|
||||
* For the active funding streams at a given height, use
|
||||
* GetActiveFundingStreams() or GetActiveFundingStreamElements().
|
||||
*/
|
||||
CAmount Value(CAmount blockSubsidy) const;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue