message: Reduce unnecessary hashing in signrawtransaction
  Coming from btc@bd0f41387783ee91623d7fac15e89e57db37df82
diff: @@ -734,6 +734,9 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
  // Script verification errors
  UniValue vErrors(UniValue::VARR);
  + // Use CTransaction for the constant parts of the
  + // transaction to avoid rehashing.
  + const CTransaction txConst(mergedTx);
  // Sign what we can:
  for (unsigned int i = 0; i < mergedTx.vin.size(); i++) {
  CTxIn& txin = mergedTx.vin[i];
  @@ -767,10 +770,10 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
  // ... and merge in other signatures:
  for (const CMutableTransaction& txv : txVariants) {
  - txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
  + txin.scriptSig = CombineSignatures(prevPubKey, txConst, i, txin.scriptSig, txv.vin[i].scriptSig);
  }
  ScriptError serror = SCRIPT_ERR_OK;
  - if (!VerifyScript(txin.scriptSig, prevPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker(&mergedTx, i), &serror)) {
  + if (!VerifyScript(txin.scriptSig, prevPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&txConst, i), &serror)) {
  TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror));
  }
  }
  