Skip to content

Commit faf29dd

Browse files
committed
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.
1 parent 27f5a29 commit faf29dd

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

src/bitcoin-tx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ static int CommandLineRawTx(int argc, char* argv[])
818818
MutateTx(tx, key, value);
819819
}
820820

821-
OutputTx(tx);
821+
OutputTx(CTransaction(tx));
822822
}
823823
catch (const std::exception& e) {
824824
strPrint = std::string("error: ") + e.what();

src/rpc/rawtransaction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniVal
445445
}
446446
}
447447

448-
if (!rbf.isNull() && rawTx.vin.size() > 0 && rbfOptIn != SignalsOptInRBF(rawTx)) {
448+
if (!rbf.isNull() && rawTx.vin.size() > 0 && rbfOptIn != SignalsOptInRBF(CTransaction(rawTx))) {
449449
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter combination: Sequence number(s) contradict replaceable option");
450450
}
451451

@@ -517,7 +517,7 @@ static UniValue createrawtransaction(const JSONRPCRequest& request)
517517

518518
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3]);
519519

520-
return EncodeHexTx(rawTx);
520+
return EncodeHexTx(CTransaction(rawTx));
521521
}
522522

523523
static UniValue decoderawtransaction(const JSONRPCRequest& request)
@@ -773,7 +773,7 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
773773
UpdateInput(txin, sigdata);
774774
}
775775

776-
return EncodeHexTx(mergedTx);
776+
return EncodeHexTx(CTransaction(mergedTx));
777777
}
778778

779779
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
906906
bool fComplete = vErrors.empty();
907907

908908
UniValue result(UniValue::VOBJ);
909-
result.pushKV("hex", EncodeHexTx(mtx));
909+
result.pushKV("hex", EncodeHexTx(CTransaction(mtx)));
910910
result.pushKV("complete", fComplete);
911911
if (!vErrors.empty()) {
912912
result.pushKV("errors", vErrors);

src/script/sign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
509509
return false;
510510
}
511511

512-
PartiallySignedTransaction::PartiallySignedTransaction(const CTransaction& tx) : tx(tx)
512+
PartiallySignedTransaction::PartiallySignedTransaction(const CMutableTransaction& tx) : tx(tx)
513513
{
514514
inputs.resize(tx.vin.size());
515515
outputs.resize(tx.vout.size());

src/script/sign.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ struct PartiallySignedTransaction
574574
bool IsSane() const;
575575
PartiallySignedTransaction() {}
576576
PartiallySignedTransaction(const PartiallySignedTransaction& psbt_in) : tx(psbt_in.tx), inputs(psbt_in.inputs), outputs(psbt_in.outputs), unknown(psbt_in.unknown) {}
577-
explicit PartiallySignedTransaction(const CTransaction& tx);
577+
explicit PartiallySignedTransaction(const CMutableTransaction& tx);
578578

579579
// Only checks if they refer to the same transaction
580580
friend bool operator==(const PartiallySignedTransaction& a, const PartiallySignedTransaction &b)

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3058,7 +3058,7 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
30583058
FundTransaction(pwallet, tx, fee, change_position, request.params[1]);
30593059

30603060
UniValue result(UniValue::VOBJ);
3061-
result.pushKV("hex", EncodeHexTx(tx));
3061+
result.pushKV("hex", EncodeHexTx(CTransaction(tx)));
30623062
result.pushKV("fee", ValueFromAmount(fee));
30633063
result.pushKV("changepos", change_position);
30643064

src/wallet/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wall
14711471
// implies that we can sign for every input.
14721472
return -1;
14731473
}
1474-
return GetVirtualTransactionSize(txNew);
1474+
return GetVirtualTransactionSize(CTransaction(txNew));
14751475
}
14761476

14771477
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
27812781
txNew.vin.push_back(CTxIn(coin.outpoint,CScript()));
27822782
}
27832783

2784-
nBytes = CalculateMaximumSignedTxSize(txNew, this, coin_control.fAllowWatchOnly);
2784+
nBytes = CalculateMaximumSignedTxSize(CTransaction(txNew), this, coin_control.fAllowWatchOnly);
27852785
if (nBytes < 0) {
27862786
strFailReason = _("Signing transaction failed");
27872787
return false;

0 commit comments

Comments
 (0)