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
This commit is contained in:
MarcoFalke 2020-03-05 13:40:02 -05:00 committed by PastaPastaPasta
parent 70ed624cea
commit 5747337191

View File

@ -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