mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 03:01:09 +02:00
versionbits: Use std::array instead of C-style arrays
This commit is contained in:
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -104,7 +105,7 @@ struct Params {
|
|||||||
*/
|
*/
|
||||||
uint32_t nRuleChangeActivationThreshold;
|
uint32_t nRuleChangeActivationThreshold;
|
||||||
uint32_t nMinerConfirmationWindow;
|
uint32_t nMinerConfirmationWindow;
|
||||||
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS];
|
std::array<BIP9Deployment,MAX_VERSION_BITS_DEPLOYMENTS> vDeployments;
|
||||||
/** Proof of work parameters */
|
/** Proof of work parameters */
|
||||||
uint256 powLimit;
|
uint256 powLimit;
|
||||||
bool fPowAllowMinDifficultyBlocks;
|
bool fPowAllowMinDifficultyBlocks;
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
|
const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo{
|
||||||
{
|
VBDeploymentInfo{
|
||||||
/*.name =*/ "testdummy",
|
.name = "testdummy",
|
||||||
/*.gbt_force =*/ true,
|
.gbt_force = true,
|
||||||
},
|
},
|
||||||
{
|
VBDeploymentInfo{
|
||||||
/*.name =*/ "taproot",
|
.name = "taproot",
|
||||||
/*.gbt_force =*/ true,
|
.gbt_force = true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <consensus/params.h>
|
#include <consensus/params.h>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ struct VBDeploymentInfo {
|
|||||||
bool gbt_force;
|
bool gbt_force;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS];
|
extern const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo;
|
||||||
|
|
||||||
std::string DeploymentName(Consensus::BuriedDeployment dep);
|
std::string DeploymentName(Consensus::BuriedDeployment dep);
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <chain.h>
|
#include <chain.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
/** What block version to use for new blocks (pre versionbits) */
|
/** What block version to use for new blocks (pre versionbits) */
|
||||||
@ -81,7 +82,7 @@ class VersionBitsCache
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Mutex m_mutex;
|
Mutex m_mutex;
|
||||||
ThresholdConditionCache m_caches[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] GUARDED_BY(m_mutex);
|
std::array<ThresholdConditionCache,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> m_caches GUARDED_BY(m_mutex);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Get the numerical statistics for a given deployment for the signalling period that includes pindex.
|
/** Get the numerical statistics for a given deployment for the signalling period that includes pindex.
|
||||||
|
Reference in New Issue
Block a user