diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-03-05 13:40:02 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-03-05 13:40:06 -0500 |
commit | 96488e67847997548a532a82001b6cd58dfa1822 (patch) | |
tree | 0f0115374b80b3bbb81ec6f61846df0aa2454e80 | |
parent | a2a77ba34f713d6406c31a4baa991666b13794a0 (diff) | |
parent | 2455aa5d7f54befeade05795ed8f5dd89d01042a (diff) |
Merge #18263: rpc: change setmocktime check to use IsMockableChain
2455aa5d7f54befeade05795ed8f5dd89d01042a [rpc] changed MineBlocksOnDemand to IsMockableChain (Gloria Zhao)
Pull request description:
Change: Update the if statement in `setmocktime` to use `IsMockableChain` chainparams function (aka `m_is_mockable_chain`) instead of `MineBlocksOnDemand`
Rationale: It's a more appropriate check for whether or not chain is in RegTest, as [discussed](https://github.com/bitcoin/bitcoin/pull/18037#discussion_r376509388) in #18037
ACKs for top commit:
MarcoFalke:
ACK 2455aa5d7f54befeade05795ed8f5dd89d01042a 🙇
jonatack:
ACK 2455aa5d7f54befeade05795ed8f5dd89d01042a
Tree-SHA512: 1d8c8b7ff0b3c1bcbf5755194969b6664fe05a35003375ad08d18e34bcefd2df4f64d0e60078a10bbef3c8f469a9b9d07db467089b55c14cf532304bc965bffc
-rw-r--r-- | src/rpc/misc.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index ccfdfe4340..60a3a0dda9 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -351,8 +351,9 @@ static UniValue setmocktime(const JSONRPCRequest& request) RPCExamples{""}, }.Check(request); - if (!Params().MineBlocksOnDemand()) - throw std::runtime_error("setmocktime for regression testing (-regtest mode) only"); + if (!Params().IsMockableChain()) { + throw std::runtime_error("setmocktime is for regression testing (-regtest mode) only"); + } // For now, don't change mocktime if we're in the middle of validation, as // this could have an effect on mempool time-based eviction, as well as |