diff --git a/src/coinjoin/client.cpp b/src/coinjoin/client.cpp index 25c776f5d9..15b3b38d7c 100644 --- a/src/coinjoin/client.cpp +++ b/src/coinjoin/client.cpp @@ -491,7 +491,7 @@ bool CCoinJoinClientSession::SendDenominate(const std::vector pwalletIn, con dummyBatch.TxnAbort(); dummyScript = ::GetScriptForDestination(dummyPubkey.GetID()); // Calculate required bytes for the dummy signed tx with tallyItem's inputs only - nBytesBase = CalculateMaximumSignedTxSize(dummyTx, pwallet.get(), false); + nBytesBase = CalculateMaximumSignedTxSize(CTransaction(dummyTx), pwallet.get(), false); } // Calculate the output size nBytesOutput = ::GetSerializeSize(CTxOut(0, dummyScript), SER_NETWORK, PROTOCOL_VERSION); diff --git a/src/dash-tx.cpp b/src/dash-tx.cpp index 335aa420dc..2d1ac13ded 100644 --- a/src/dash-tx.cpp +++ b/src/dash-tx.cpp @@ -772,7 +772,7 @@ static int CommandLineRawTx(int argc, char* argv[]) MutateTx(tx, key, value); } - OutputTx(tx); + OutputTx(CTransaction(tx)); } catch (const std::exception& e) { strPrint = std::string("error: ") + e.what(); diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index e28f479c17..6a27096327 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -211,7 +211,7 @@ public: CTransaction(); /** Convert a CMutableTransaction into a CTransaction. */ - CTransaction(const CMutableTransaction &tx); + explicit CTransaction(const CMutableTransaction &tx); CTransaction(CMutableTransaction &&tx); template diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 8e654b5061..a4108794b3 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -543,7 +543,7 @@ static UniValue createrawtransaction(const JSONRPCRequest& request) CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2]); - return EncodeHexTx(rawTx); + return EncodeHexTx(CTransaction(rawTx)); } static UniValue decoderawtransaction(const JSONRPCRequest& request) @@ -765,7 +765,7 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request) UpdateInput(txin, sigdata); } - return EncodeHexTx(mergedTx); + return EncodeHexTx(CTransaction(mergedTx)); } UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival, CBasicKeyStore *keystore, bool is_temp_keystore, const UniValue& hashType) @@ -891,7 +891,7 @@ UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival bool fComplete = vErrors.empty(); UniValue result(UniValue::VOBJ); - result.pushKV("hex", EncodeHexTx(mtx)); + result.pushKV("hex", EncodeHexTx(CTransaction(mtx))); result.pushKV("complete", fComplete); if (!vErrors.empty()) { result.pushKV("errors", vErrors); diff --git a/src/rpc/rpcevo.cpp b/src/rpc/rpcevo.cpp index f5724142be..9e11c128bf 100644 --- a/src/rpc/rpcevo.cpp +++ b/src/rpc/rpcevo.cpp @@ -234,7 +234,7 @@ static void FundSpecialTx(CWallet* pwallet, CMutableTransaction& tx, const Speci template static void UpdateSpecialTxInputsHash(const CMutableTransaction& tx, SpecialTxPayload& payload) { - payload.inputsHash = CalcTxInputsHash(tx); + payload.inputsHash = CalcTxInputsHash(CTransaction(tx)); } template @@ -276,7 +276,7 @@ static std::string SignAndSendSpecialTx(const CMutableTransaction& tx, bool fSub LOCK(cs_main); CValidationState state; - if (!CheckSpecialTx(tx, chainActive.Tip(), state, *pcoinsTip.get())) { + if (!CheckSpecialTx(CTransaction(tx), chainActive.Tip(), state, *pcoinsTip.get())) { throw std::runtime_error(FormatStateMessage(state)); } } // cs_main @@ -549,7 +549,7 @@ static UniValue protx_register(const JSONRPCRequest& request) SetTxPayload(tx, ptx); UniValue ret(UniValue::VOBJ); - ret.pushKV("tx", EncodeHexTx(tx)); + ret.pushKV("tx", EncodeHexTx(CTransaction(tx))); ret.pushKV("collateralAddress", EncodeDestination(txDest)); ret.pushKV("signMessage", ptx.MakeSignString()); return ret; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e8a6f7fcee..1fabb83fa0 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3326,7 +3326,7 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request) FundTransaction(pwallet, tx, fee, change_position, request.params[1]); UniValue result(UniValue::VOBJ); - result.pushKV("hex", EncodeHexTx(tx)); + result.pushKV("hex", EncodeHexTx(CTransaction(tx))); result.pushKV("fee", ValueFromAmount(fee)); result.pushKV("changepos", change_position); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a45d240b7e..0431eecf99 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3681,7 +3681,7 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CTransac auto calculateFee = [&](CAmount& nFee) -> bool { AssertLockHeld(cs_wallet); - nBytes = CalculateMaximumSignedTxSize(txNew, this, coin_control.fAllowWatchOnly); + nBytes = CalculateMaximumSignedTxSize(CTransaction(txNew), this, coin_control.fAllowWatchOnly); if (nBytes < 0) { strFailReason = _("Signing transaction failed"); return false;