message: rpc: update getblocktemplate with signet rule, include signet_challenge
diff: @@ -715,6 +715,13 @@ static RPCHelpMan getblocktemplate()
  // TODO: Maybe recheck connections/IBD and (if something wrong) send an expires-immediately template to stop miners?
  }
  + const Consensus::Params& consensusParams = Params().GetConsensus();
  +
  + // GBT must be called with 'signet' set in the rules for signet chains
  + if (consensusParams.signet_blocks && setClientRules.count("signet") != 1) {
  + throw JSONRPCError(RPC_INVALID_PARAMETER, "getblocktemplate must be called with the signet rule set (call with {\"rules\": [\"segwit\", \"signet\"]})");
  + }
  +
  // GBT must be called with 'segwit' set in the rules
  if (setClientRules.count("segwit") != 1) {
  throw JSONRPCError(RPC_INVALID_PARAMETER, "getblocktemplate must be called with the segwit rule set (call with {\"rules\": [\"segwit\"]})");
  @@ -809,6 +816,12 @@ static RPCHelpMan getblocktemplate()
  UniValue aRules(UniValue::VARR);
  aRules.push_back("csv");
  if (!fPreSegWit) aRules.push_back("!segwit");
  + if (consensusParams.signet_blocks) {
  + // indicate to miner that they must understand signet rules
  + // when attempting to mine with this template
  + aRules.push_back("!signet");
  + }
  +
  result.pushKV("version", pblock->nVersion);
  result.pushKV("rules", aRules);
  @@ -844,6 +857,10 @@ static RPCHelpMan getblocktemplate()
  result.pushKV("bits", strprintf("%08x", pblock->nBits));
  result.pushKV("height", (int64_t)(pindexPrev->nHeight+1));
  + if (consensusParams.signet_blocks) {
  + result.pushKV("signet_challenge", HexStr(consensusParams.signet_challenge));
  + }
  +
  if (!pblocktemplate->vchCoinbaseCommitment.empty()) {
  result.pushKV("default_witness_commitment", HexStr(pblocktemplate->vchCoinbaseCommitment));
  }
  