mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-27 11:43:26 -03:00
Added chaintype user-facing string display
Co-authored-by: D++ <82842780+dplusplus1024@users.noreply.github.com>
This commit is contained in:
parent
fa7c2838a5
commit
366678ffc6
3 changed files with 22 additions and 1 deletions
|
@ -105,10 +105,12 @@ public:
|
||||||
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
||||||
/** Minimum free space (in GB) needed for data directory */
|
/** Minimum free space (in GB) needed for data directory */
|
||||||
uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
|
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; }
|
uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }
|
||||||
/** Whether it is possible to mine blocks on demand (no retargeting) */
|
/** Whether it is possible to mine blocks on demand (no retargeting) */
|
||||||
bool MineBlocksOnDemand() const { return consensus.fPowNoRetargeting; }
|
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 */
|
/** Return the chain type string */
|
||||||
std::string GetChainTypeString() const { return ChainTypeToString(m_chain_type); }
|
std::string GetChainTypeString() const { return ChainTypeToString(m_chain_type); }
|
||||||
/** Return the chain type */
|
/** Return the chain type */
|
||||||
|
|
|
@ -41,3 +41,20 @@ std::optional<ChainType> ChainTypeFromString(std::string_view chain)
|
||||||
return std::nullopt;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@ enum class ChainType {
|
||||||
TESTNET4,
|
TESTNET4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string ChainTypeToDisplayString(ChainType chain);
|
||||||
|
|
||||||
std::string ChainTypeToString(ChainType chain);
|
std::string ChainTypeToString(ChainType chain);
|
||||||
|
|
||||||
std::optional<ChainType> ChainTypeFromString(std::string_view chain);
|
std::optional<ChainType> ChainTypeFromString(std::string_view chain);
|
||||||
|
|
Loading…
Add table
Reference in a new issue