From 5747337191ce02dbd514c01df7a5bda96d49610f Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 5 Mar 2020 13:40:02 -0500 Subject: [PATCH] Merge #18263: rpc: change setmocktime check to use IsMockableChain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/rpc/misc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 1135785d94..fa92165710 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -507,8 +507,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