Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#28379: Refactor: Remove m_is_test_chain
Browse files Browse the repository at this point in the history
78c2707 Refactor: Replace 'isMockableChain' with inline 'ChainType' check for 'submitpackage' (Tim Neubauer)
27b4084 Refactor: Remove m_is_test_chain (Tim Neubauer)

Pull request description:

  Remove the m_is_test_chain bool
  Compiled and run tests locally

  #28376

ACKs for top commit:
  MarcoFalke:
    re-ACK 78c2707
  ajtowns:
    ACK 78c2707

Tree-SHA512: 2eedd855c379dd12b7ff28b0e03414680cc892313f16502f36e09906513df9c222e8cc2cea3ff4d9a4f47c9efdfa00d017f38398021b0c96d4543711206d6ff8
  • Loading branch information
fanquake committed Sep 21, 2023
2 parents 2303fd2 + 78c2707 commit f290914
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/kernel/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ class CMainParams : public CChainParams {
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_main), std::end(chainparams_seed_main));

fDefaultConsistencyChecks = false;
m_is_test_chain = false;
m_is_mockable_chain = false;

checkpointData = {
Expand Down Expand Up @@ -259,7 +258,6 @@ class CTestNetParams : public CChainParams {
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_test), std::end(chainparams_seed_test));

fDefaultConsistencyChecks = false;
m_is_test_chain = true;
m_is_mockable_chain = false;

checkpointData = {
Expand Down Expand Up @@ -381,7 +379,6 @@ class SigNetParams : public CChainParams {
bech32_hrp = "tb";

fDefaultConsistencyChecks = false;
m_is_test_chain = true;
m_is_mockable_chain = false;
}
};
Expand Down Expand Up @@ -472,7 +469,6 @@ class CRegTestParams : public CChainParams
vSeeds.emplace_back("dummySeed.invalid.");

fDefaultConsistencyChecks = true;
m_is_test_chain = true;
m_is_mockable_chain = true;

checkpointData = {
Expand Down
3 changes: 1 addition & 2 deletions src/kernel/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CChainParams
/** Default value for -checkmempool and -checkblockindex argument */
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
/** If this chain is exclusively used for testing */
bool IsTestChain() const { return m_is_test_chain; }
bool IsTestChain() const { return m_chain_type != ChainType::MAIN; }
/** If this chain allows time to be mocked */
bool IsMockableChain() const { return m_is_mockable_chain; }
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
Expand Down Expand Up @@ -167,7 +167,6 @@ class CChainParams
CBlock genesis;
std::vector<uint8_t> vFixedSeeds;
bool fDefaultConsistencyChecks;
bool m_is_test_chain;
bool m_is_mockable_chain;
CCheckpointData checkpointData;
MapAssumeutxo m_assumeutxo_data;
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/mempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ static RPCHelpMan submitpackage()
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
if (!Params().IsMockableChain()) {
if (Params().GetChainType() != ChainType::REGTEST) {
throw std::runtime_error("submitpackage is for regression testing (-regtest mode) only");
}
const UniValue raw_transactions = request.params[0].get_array();
Expand Down

0 comments on commit f290914

Please sign in to comment.