Merge bitcoin/bitcoin#28379: Refactor: Remove m_is_test_chain

78c2707b2a Refactor: Replace 'isMockableChain' with inline 'ChainType' check for 'submitpackage' (Tim Neubauer)
27b4084e16 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 78c2707b2a
  ajtowns:
    ACK 78c2707b2a

Tree-SHA512: 2eedd855c379dd12b7ff28b0e03414680cc892313f16502f36e09906513df9c222e8cc2cea3ff4d9a4f47c9efdfa00d017f38398021b0c96d4543711206d6ff8
This commit is contained in:
fanquake 2023-09-21 16:30:57 +00:00
commit f29091410d
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
3 changed files with 2 additions and 7 deletions

View file

@ -152,7 +152,6 @@ public:
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 = {
@ -259,7 +258,6 @@ public:
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 = {
@ -381,7 +379,6 @@ public:
bech32_hrp = "tb";
fDefaultConsistencyChecks = false;
m_is_test_chain = true;
m_is_mockable_chain = false;
}
};
@ -472,7 +469,6 @@ public:
vSeeds.emplace_back("dummySeed.invalid.");
fDefaultConsistencyChecks = true;
m_is_test_chain = true;
m_is_mockable_chain = true;
checkpointData = {

View file

@ -93,7 +93,7 @@ public:
/** 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; }
@ -167,7 +167,6 @@ protected:
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;

View file

@ -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();