Minimal changes to comply with explicit CMutableTransaction -> CTranaction conversion.

This commit makes the minimal changes necessary to fix compilation once CTransaction(const CMutableTransaction &tx) is made explicit. In each case an explicit call `CTransaction(...)` was added. Shouldn't affect behaviour or performance.
This commit is contained in:
lucash-dev 2018-12-09 22:03:07 -08:00
parent 27f5a295d7
commit faf29dd019
6 changed files with 10 additions and 10 deletions

View file

@ -818,7 +818,7 @@ static int CommandLineRawTx(int argc, char* argv[])
MutateTx(tx, key, value); MutateTx(tx, key, value);
} }
OutputTx(tx); OutputTx(CTransaction(tx));
} }
catch (const std::exception& e) { catch (const std::exception& e) {
strPrint = std::string("error: ") + e.what(); strPrint = std::string("error: ") + e.what();

View file

@ -445,7 +445,7 @@ CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniVal
} }
} }
if (!rbf.isNull() && rawTx.vin.size() > 0 && rbfOptIn != SignalsOptInRBF(rawTx)) { if (!rbf.isNull() && rawTx.vin.size() > 0 && rbfOptIn != SignalsOptInRBF(CTransaction(rawTx))) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter combination: Sequence number(s) contradict replaceable option"); throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter combination: Sequence number(s) contradict replaceable option");
} }
@ -517,7 +517,7 @@ static UniValue createrawtransaction(const JSONRPCRequest& request)
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3]); CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3]);
return EncodeHexTx(rawTx); return EncodeHexTx(CTransaction(rawTx));
} }
static UniValue decoderawtransaction(const JSONRPCRequest& request) static UniValue decoderawtransaction(const JSONRPCRequest& request)
@ -773,7 +773,7 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
UpdateInput(txin, sigdata); UpdateInput(txin, sigdata);
} }
return EncodeHexTx(mergedTx); return EncodeHexTx(CTransaction(mergedTx));
} }
UniValue SignTransaction(interfaces::Chain& chain, CMutableTransaction& mtx, const UniValue& prevTxsUnival, CBasicKeyStore *keystore, bool is_temp_keystore, const UniValue& hashType) UniValue SignTransaction(interfaces::Chain& chain, CMutableTransaction& mtx, const UniValue& prevTxsUnival, CBasicKeyStore *keystore, bool is_temp_keystore, const UniValue& hashType)
@ -906,7 +906,7 @@ UniValue SignTransaction(interfaces::Chain& chain, CMutableTransaction& mtx, con
bool fComplete = vErrors.empty(); bool fComplete = vErrors.empty();
UniValue result(UniValue::VOBJ); UniValue result(UniValue::VOBJ);
result.pushKV("hex", EncodeHexTx(mtx)); result.pushKV("hex", EncodeHexTx(CTransaction(mtx)));
result.pushKV("complete", fComplete); result.pushKV("complete", fComplete);
if (!vErrors.empty()) { if (!vErrors.empty()) {
result.pushKV("errors", vErrors); result.pushKV("errors", vErrors);

View file

@ -509,7 +509,7 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
return false; return false;
} }
PartiallySignedTransaction::PartiallySignedTransaction(const CTransaction& tx) : tx(tx) PartiallySignedTransaction::PartiallySignedTransaction(const CMutableTransaction& tx) : tx(tx)
{ {
inputs.resize(tx.vin.size()); inputs.resize(tx.vin.size());
outputs.resize(tx.vout.size()); outputs.resize(tx.vout.size());

View file

@ -574,7 +574,7 @@ struct PartiallySignedTransaction
bool IsSane() const; bool IsSane() const;
PartiallySignedTransaction() {} PartiallySignedTransaction() {}
PartiallySignedTransaction(const PartiallySignedTransaction& psbt_in) : tx(psbt_in.tx), inputs(psbt_in.inputs), outputs(psbt_in.outputs), unknown(psbt_in.unknown) {} PartiallySignedTransaction(const PartiallySignedTransaction& psbt_in) : tx(psbt_in.tx), inputs(psbt_in.inputs), outputs(psbt_in.outputs), unknown(psbt_in.unknown) {}
explicit PartiallySignedTransaction(const CTransaction& tx); explicit PartiallySignedTransaction(const CMutableTransaction& tx);
// Only checks if they refer to the same transaction // Only checks if they refer to the same transaction
friend bool operator==(const PartiallySignedTransaction& a, const PartiallySignedTransaction &b) friend bool operator==(const PartiallySignedTransaction& a, const PartiallySignedTransaction &b)

View file

@ -3058,7 +3058,7 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
FundTransaction(pwallet, tx, fee, change_position, request.params[1]); FundTransaction(pwallet, tx, fee, change_position, request.params[1]);
UniValue result(UniValue::VOBJ); UniValue result(UniValue::VOBJ);
result.pushKV("hex", EncodeHexTx(tx)); result.pushKV("hex", EncodeHexTx(CTransaction(tx)));
result.pushKV("fee", ValueFromAmount(fee)); result.pushKV("fee", ValueFromAmount(fee));
result.pushKV("changepos", change_position); result.pushKV("changepos", change_position);

View file

@ -1471,7 +1471,7 @@ int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wall
// implies that we can sign for every input. // implies that we can sign for every input.
return -1; return -1;
} }
return GetVirtualTransactionSize(txNew); return GetVirtualTransactionSize(CTransaction(txNew));
} }
int CalculateMaximumSignedInputSize(const CTxOut& txout, const CWallet* wallet, bool use_max_sig) int CalculateMaximumSignedInputSize(const CTxOut& txout, const CWallet* wallet, bool use_max_sig)
@ -2781,7 +2781,7 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std
txNew.vin.push_back(CTxIn(coin.outpoint,CScript())); txNew.vin.push_back(CTxIn(coin.outpoint,CScript()));
} }
nBytes = CalculateMaximumSignedTxSize(txNew, this, coin_control.fAllowWatchOnly); nBytes = CalculateMaximumSignedTxSize(CTransaction(txNew), this, coin_control.fAllowWatchOnly);
if (nBytes < 0) { if (nBytes < 0) {
strFailReason = _("Signing transaction failed"); strFailReason = _("Signing transaction failed");
return false; return false;