Bitcoin ABC
0.31.8
P2P Digital Currency
src
util
chaintype.cpp
Go to the documentation of this file.
1
// Copyright (c) 2023 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#include <
util/chaintype.h
>
6
7
#include <cassert>
8
#include <optional>
9
#include <string>
10
11
std::string
ChainTypeToString
(
ChainType
chain) {
12
switch
(chain) {
13
case
ChainType::MAIN
:
14
return
"main"
;
15
case
ChainType::TESTNET
:
16
return
"test"
;
17
case
ChainType::REGTEST
:
18
return
"regtest"
;
19
}
20
assert
(
false
);
21
}
22
23
std::optional<ChainType>
ChainTypeFromString
(std::string_view chain) {
24
if
(chain ==
"main"
) {
25
return
ChainType::MAIN
;
26
}
else
if
(chain ==
"test"
) {
27
return
ChainType::TESTNET
;
28
}
else
if
(chain ==
"regtest"
) {
29
return
ChainType::REGTEST
;
30
}
else
{
31
return
std::nullopt;
32
}
33
}
ChainTypeFromString
std::optional< ChainType > ChainTypeFromString(std::string_view chain)
Definition:
chaintype.cpp:23
ChainTypeToString
std::string ChainTypeToString(ChainType chain)
Definition:
chaintype.cpp:11
chaintype.h
ChainType
ChainType
Definition:
chaintype.h:11
ChainType::MAIN
@ MAIN
ChainType::TESTNET
@ TESTNET
ChainType::REGTEST
@ REGTEST
assert
assert(!tx.IsCoinBase())
Generated on Thu Jul 17 2025 13:17:51 for Bitcoin ABC by
1.9.4