mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-30 18:35:54 +02:00
versionbits: Move BIP9 status logic for getblocktemplate to versionbits
Rather than having the RPC code have knowledge about how BIP9 is implemented, create a reporting function in the versionbits code, and limit the RPC code to coverting the result of that into the appropriate output for getblocktemplate.
This commit is contained in:
@@ -66,6 +66,15 @@ struct BIP9Info {
|
||||
std::optional<int> active_since;
|
||||
};
|
||||
|
||||
struct BIP9GBTStatus {
|
||||
struct Info {
|
||||
int bit;
|
||||
uint32_t mask;
|
||||
bool gbt_force;
|
||||
};
|
||||
std::map<std::string, const Info, std::less<>> signalling, locked_in, active;
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstract class that implements BIP9-style threshold logic, and caches results.
|
||||
*/
|
||||
@@ -109,6 +118,8 @@ public:
|
||||
|
||||
BIP9Info Info(const CBlockIndex& block_index, const Consensus::Params& params, Consensus::DeploymentPos id) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex);
|
||||
|
||||
BIP9GBTStatus GBTStatus(const CBlockIndex& block_index, const Consensus::Params& params) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex);
|
||||
|
||||
/** Get the BIP9 state for a given deployment for the block after pindexPrev. */
|
||||
ThresholdState State(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user