mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-12 18:44:59 +01:00
versionbits: Expose StateName function
Rather than essentially duplicating StateName in the unit tests, expose it via the impl header.
This commit is contained in:
parent
d00d1ed52c
commit
e74a7049b4
3 changed files with 4 additions and 13 deletions
|
@ -16,18 +16,6 @@
|
|||
/* Define a virtual block time, one block per 10 minutes after Nov 14 2014, 0:55:36am */
|
||||
static int32_t TestTime(int nHeight) { return 1415926536 + 600 * nHeight; }
|
||||
|
||||
static std::string StateName(ThresholdState state)
|
||||
{
|
||||
switch (state) {
|
||||
case ThresholdState::DEFINED: return "DEFINED";
|
||||
case ThresholdState::STARTED: return "STARTED";
|
||||
case ThresholdState::LOCKED_IN: return "LOCKED_IN";
|
||||
case ThresholdState::ACTIVE: return "ACTIVE";
|
||||
case ThresholdState::FAILED: return "FAILED";
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
return "";
|
||||
}
|
||||
|
||||
class TestConditionChecker : public AbstractThresholdConditionChecker
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
using enum ThresholdState;
|
||||
|
||||
static std::string StateName(ThresholdState state)
|
||||
std::string StateName(ThresholdState state)
|
||||
{
|
||||
switch (state) {
|
||||
case DEFINED: return "defined";
|
||||
|
|
|
@ -22,6 +22,9 @@ enum class ThresholdState : uint8_t {
|
|||
FAILED, // For all blocks once the first retarget period after the timeout time is hit, if LOCKED_IN wasn't already reached (final state)
|
||||
};
|
||||
|
||||
/** Get a string with the state name */
|
||||
std::string StateName(ThresholdState state);
|
||||
|
||||
/**
|
||||
* Abstract class that implements BIP9-style threshold logic, and caches results.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue