Added chaintype user-facing string display

Co-authored-by: D++ <82842780+dplusplus1024@users.noreply.github.com>
This commit is contained in:
russeree 2024-09-26 15:25:08 +01:00 committed by Reese Russell
parent fa7c2838a5
commit 366678ffc6
3 changed files with 22 additions and 1 deletions

View file

@ -105,10 +105,12 @@ public:
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
/** Minimum free space (in GB) needed for data directory */
uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
/** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target*/
/** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target */
uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }
/** Whether it is possible to mine blocks on demand (no retargeting) */
bool MineBlocksOnDemand() const { return consensus.fPowNoRetargeting; }
/** Return the chain type as a user-facing string */
std::string GetChainTypeDisplayString() const { return ChainTypeToDisplayString(m_chain_type); }
/** Return the chain type string */
std::string GetChainTypeString() const { return ChainTypeToString(m_chain_type); }
/** Return the chain type */

View file

@ -41,3 +41,20 @@ std::optional<ChainType> ChainTypeFromString(std::string_view chain)
return std::nullopt;
}
}
std::string ChainTypeToDisplayString(ChainType chain)
{
switch (chain) {
case ChainType::MAIN:
return "Bitcoin";
case ChainType::TESTNET:
return "testnet";
case ChainType::TESTNET4:
return "testnet4";
case ChainType::SIGNET:
return "signet";
case ChainType::REGTEST:
return "regtest";
}
assert(false);
}

View file

@ -16,6 +16,8 @@ enum class ChainType {
TESTNET4,
};
std::string ChainTypeToDisplayString(ChainType chain);
std::string ChainTypeToString(ChainType chain);
std::optional<ChainType> ChainTypeFromString(std::string_view chain);