@@ -826,9 +826,6 @@ static RPCHelpMan getblocktemplate()
826826 UpdateTime (&block, consensusParams, pindexPrev);
827827 block.nNonce = 0 ;
828828
829- // NOTE: If at some point we support pre-segwit miners post-segwit-activation, this needs to take segwit support into consideration
830- const bool fPreSegWit = !DeploymentActiveAfter (pindexPrev, chainman, Consensus::DEPLOYMENT_SEGWIT);
831-
832829 UniValue aCaps (UniValue::VARR); aCaps.push_back (" proposal" );
833830
834831 UniValue transactions (UniValue::VARR);
@@ -862,10 +859,6 @@ static RPCHelpMan getblocktemplate()
862859 int index_in_template = i - 1 ;
863860 entry.pushKV (" fee" , tx_fees.at (index_in_template));
864861 int64_t nTxSigOps{tx_sigops.at (index_in_template)};
865- if (fPreSegWit ) {
866- CHECK_NONFATAL (nTxSigOps % WITNESS_SCALE_FACTOR == 0 );
867- nTxSigOps /= WITNESS_SCALE_FACTOR;
868- }
869862 entry.pushKV (" sigops" , nTxSigOps);
870863 entry.pushKV (" weight" , GetTransactionWeight (tx));
871864
@@ -889,10 +882,9 @@ static RPCHelpMan getblocktemplate()
889882 // ! indicates a more subtle change to the block structure or generation transaction
890883 // Otherwise clients may assume the rule will not impact usage of the template as-is.
891884 aRules.push_back (" csv" );
892- if (!fPreSegWit ) {
893- aRules.push_back (" !segwit" );
894- aRules.push_back (" taproot" );
895- }
885+ // BIP 145: the '!' rule prefix MUST be enabled on the "segwit" rule for templates including transactions with witness data.
886+ aRules.push_back (" !segwit" );
887+ aRules.push_back (" taproot" );
896888 if (consensusParams.signet_blocks ) {
897889 // indicate to miner that they must understand signet rules
898890 // when attempting to mine with this template
@@ -955,17 +947,9 @@ static RPCHelpMan getblocktemplate()
955947 result.pushKV (" noncerange" , " 00000000ffffffff" );
956948 int64_t nSigOpLimit = MAX_BLOCK_SIGOPS_COST;
957949 int64_t nSizeLimit = MAX_BLOCK_SERIALIZED_SIZE;
958- if (fPreSegWit ) {
959- CHECK_NONFATAL (nSigOpLimit % WITNESS_SCALE_FACTOR == 0 );
960- nSigOpLimit /= WITNESS_SCALE_FACTOR;
961- CHECK_NONFATAL (nSizeLimit % WITNESS_SCALE_FACTOR == 0 );
962- nSizeLimit /= WITNESS_SCALE_FACTOR;
963- }
964950 result.pushKV (" sigoplimit" , nSigOpLimit);
965951 result.pushKV (" sizelimit" , nSizeLimit);
966- if (!fPreSegWit ) {
967- result.pushKV (" weightlimit" , (int64_t )MAX_BLOCK_WEIGHT);
968- }
952+ result.pushKV (" weightlimit" , (int64_t )MAX_BLOCK_WEIGHT);
969953 result.pushKV (" curtime" , block.GetBlockTime ());
970954 result.pushKV (" bits" , strprintf (" %08x" , block.nBits ));
971955 result.pushKV (" height" , (int64_t )(pindexPrev->nHeight +1 ));
0 commit comments