Skip to content

Commit c3f5673

Browse files
committed
Make CWalletTx store a CTransactionRef instead of inheriting
1 parent a188353 commit c3f5673

12 files changed

+128
-123
lines changed

src/bench/coin_selection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static void addCoin(const CAmount& nValue, const CWallet& wallet, vector<COutput
1919
tx.nLockTime = nextLockTime++; // so all transactions get different hashes
2020
tx.vout.resize(nInput + 1);
2121
tx.vout[nInput].nValue = nValue;
22-
CWalletTx* wtx = new CWalletTx(&wallet, tx);
22+
CWalletTx* wtx = new CWalletTx(&wallet, MakeTransactionRef(std::move(tx)));
2323

2424
int nAge = 6 * 24;
2525
COutput output(wtx, nInput, nAge, true, true);

src/qt/coincontroldialog.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,21 +470,21 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
470470
nQuantity++;
471471

472472
// Amount
473-
nAmount += out.tx->vout[out.i].nValue;
473+
nAmount += out.tx->tx->vout[out.i].nValue;
474474

475475
// Priority
476-
dPriorityInputs += (double)out.tx->vout[out.i].nValue * (out.nDepth+1);
476+
dPriorityInputs += (double)out.tx->tx->vout[out.i].nValue * (out.nDepth+1);
477477

478478
// Bytes
479479
CTxDestination address;
480480
int witnessversion = 0;
481481
std::vector<unsigned char> witnessprogram;
482-
if (out.tx->vout[out.i].scriptPubKey.IsWitnessProgram(witnessversion, witnessprogram))
482+
if (out.tx->tx->vout[out.i].scriptPubKey.IsWitnessProgram(witnessversion, witnessprogram))
483483
{
484484
nBytesInputs += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);
485485
fWitness = true;
486486
}
487-
else if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
487+
else if(ExtractDestination(out.tx->tx->vout[out.i].scriptPubKey, address))
488488
{
489489
CPubKey pubkey;
490490
CKeyID *keyid = boost::get<CKeyID>(&address);
@@ -677,7 +677,7 @@ void CoinControlDialog::updateView()
677677
CAmount nSum = 0;
678678
int nChildren = 0;
679679
BOOST_FOREACH(const COutput& out, coins.second) {
680-
nSum += out.tx->vout[out.i].nValue;
680+
nSum += out.tx->tx->vout[out.i].nValue;
681681
nChildren++;
682682

683683
CCoinControlWidgetItem *itemOutput;
@@ -689,7 +689,7 @@ void CoinControlDialog::updateView()
689689
// address
690690
CTxDestination outputAddress;
691691
QString sAddress = "";
692-
if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, outputAddress))
692+
if(ExtractDestination(out.tx->tx->vout[out.i].scriptPubKey, outputAddress))
693693
{
694694
sAddress = QString::fromStdString(CBitcoinAddress(outputAddress).ToString());
695695

@@ -714,8 +714,8 @@ void CoinControlDialog::updateView()
714714
}
715715

716716
// amount
717-
itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->vout[out.i].nValue));
718-
itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.tx->vout[out.i].nValue)); // padding so that sorting works correctly
717+
itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->tx->vout[out.i].nValue));
718+
itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.tx->tx->vout[out.i].nValue)); // padding so that sorting works correctly
719719

720720
// date
721721
itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));

src/qt/transactiondesc.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
2626
AssertLockHeld(cs_main);
2727
if (!CheckFinalTx(wtx))
2828
{
29-
if (wtx.nLockTime < LOCKTIME_THRESHOLD)
30-
return tr("Open for %n more block(s)", "", wtx.nLockTime - chainActive.Height());
29+
if (wtx.tx->nLockTime < LOCKTIME_THRESHOLD)
30+
return tr("Open for %n more block(s)", "", wtx.tx->nLockTime - chainActive.Height());
3131
else
32-
return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime));
32+
return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.tx->nLockTime));
3333
}
3434
else
3535
{
@@ -133,7 +133,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
133133
// Coinbase
134134
//
135135
CAmount nUnmatured = 0;
136-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
136+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
137137
nUnmatured += wallet->GetCredit(txout, ISMINE_ALL);
138138
strHTML += "<b>" + tr("Credit") + ":</b> ";
139139
if (wtx.IsInMainChain())
@@ -152,14 +152,14 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
152152
else
153153
{
154154
isminetype fAllFromMe = ISMINE_SPENDABLE;
155-
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
155+
BOOST_FOREACH(const CTxIn& txin, wtx.tx->vin)
156156
{
157157
isminetype mine = wallet->IsMine(txin);
158158
if(fAllFromMe > mine) fAllFromMe = mine;
159159
}
160160

161161
isminetype fAllToMe = ISMINE_SPENDABLE;
162-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
162+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
163163
{
164164
isminetype mine = wallet->IsMine(txout);
165165
if(fAllToMe > mine) fAllToMe = mine;
@@ -173,7 +173,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
173173
//
174174
// Debit
175175
//
176-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
176+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
177177
{
178178
// Ignore change
179179
isminetype toSelf = wallet->IsMine(txout);
@@ -212,7 +212,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
212212
strHTML += "<b>" + tr("Total credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, nValue) + "<br>";
213213
}
214214

215-
CAmount nTxFee = nDebit - wtx.GetValueOut();
215+
CAmount nTxFee = nDebit - wtx.tx->GetValueOut();
216216
if (nTxFee > 0)
217217
strHTML += "<b>" + tr("Transaction fee") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -nTxFee) + "<br>";
218218
}
@@ -221,10 +221,10 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
221221
//
222222
// Mixed debit transaction
223223
//
224-
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
224+
BOOST_FOREACH(const CTxIn& txin, wtx.tx->vin)
225225
if (wallet->IsMine(txin))
226226
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -wallet->GetDebit(txin, ISMINE_ALL)) + "<br>";
227-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
227+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
228228
if (wallet->IsMine(txout))
229229
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, wallet->GetCredit(txout, ISMINE_ALL)) + "<br>";
230230
}
@@ -241,7 +241,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
241241
strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
242242

243243
strHTML += "<b>" + tr("Transaction ID") + ":</b> " + rec->getTxID() + "<br>";
244-
strHTML += "<b>" + tr("Transaction total size") + ":</b> " + QString::number(wtx.GetTotalSize()) + " bytes<br>";
244+
strHTML += "<b>" + tr("Transaction total size") + ":</b> " + QString::number(wtx.tx->GetTotalSize()) + " bytes<br>";
245245
strHTML += "<b>" + tr("Output index") + ":</b> " + QString::number(rec->getOutputIndex()) + "<br>";
246246

247247
// Message from normal bitcoin:URI (bitcoin:123...?message=example)
@@ -276,20 +276,20 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
276276
if (fDebug)
277277
{
278278
strHTML += "<hr><br>" + tr("Debug information") + "<br><br>";
279-
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
279+
BOOST_FOREACH(const CTxIn& txin, wtx.tx->vin)
280280
if(wallet->IsMine(txin))
281281
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -wallet->GetDebit(txin, ISMINE_ALL)) + "<br>";
282-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
282+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
283283
if(wallet->IsMine(txout))
284284
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, wallet->GetCredit(txout, ISMINE_ALL)) + "<br>";
285285

286286
strHTML += "<br><b>" + tr("Transaction") + ":</b><br>";
287-
strHTML += GUIUtil::HtmlEscape(wtx.ToString(), true);
287+
strHTML += GUIUtil::HtmlEscape(wtx.tx->ToString(), true);
288288

289289
strHTML += "<br><b>" + tr("Inputs") + ":</b>";
290290
strHTML += "<ul>";
291291

292-
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
292+
BOOST_FOREACH(const CTxIn& txin, wtx.tx->vin)
293293
{
294294
COutPoint prevout = txin.prevout;
295295

src/qt/transactionrecord.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
4747
//
4848
// Credit
4949
//
50-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
50+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
5151
{
5252
isminetype mine = wallet->IsMine(txout);
5353
if(mine)
@@ -83,15 +83,15 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
8383
{
8484
bool involvesWatchAddress = false;
8585
isminetype fAllFromMe = ISMINE_SPENDABLE;
86-
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
86+
BOOST_FOREACH(const CTxIn& txin, wtx.tx->vin)
8787
{
8888
isminetype mine = wallet->IsMine(txin);
8989
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
9090
if(fAllFromMe > mine) fAllFromMe = mine;
9191
}
9292

9393
isminetype fAllToMe = ISMINE_SPENDABLE;
94-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
94+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
9595
{
9696
isminetype mine = wallet->IsMine(txout);
9797
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
@@ -112,11 +112,11 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
112112
//
113113
// Debit
114114
//
115-
CAmount nTxFee = nDebit - wtx.GetValueOut();
115+
CAmount nTxFee = nDebit - wtx.tx->GetValueOut();
116116

117-
for (unsigned int nOut = 0; nOut < wtx.vout.size(); nOut++)
117+
for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++)
118118
{
119-
const CTxOut& txout = wtx.vout[nOut];
119+
const CTxOut& txout = wtx.tx->vout[nOut];
120120
TransactionRecord sub(hash, nTime);
121121
sub.idx = parts.size();
122122
sub.involvesWatchAddress = involvesWatchAddress;
@@ -190,15 +190,15 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
190190

191191
if (!CheckFinalTx(wtx))
192192
{
193-
if (wtx.nLockTime < LOCKTIME_THRESHOLD)
193+
if (wtx.tx->nLockTime < LOCKTIME_THRESHOLD)
194194
{
195195
status.status = TransactionStatus::OpenUntilBlock;
196-
status.open_for = wtx.nLockTime - chainActive.Height();
196+
status.open_for = wtx.tx->nLockTime - chainActive.Height();
197197
}
198198
else
199199
{
200200
status.status = TransactionStatus::OpenUntilDate;
201-
status.open_for = wtx.nLockTime;
201+
status.open_for = wtx.tx->nLockTime;
202202
}
203203
}
204204
// For generated transactions, determine maturity

src/qt/walletmodel.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ CAmount WalletModel::getBalance(const CCoinControl *coinControl) const
6767
wallet->AvailableCoins(vCoins, true, coinControl);
6868
BOOST_FOREACH(const COutput& out, vCoins)
6969
if(out.fSpendable)
70-
nBalance += out.tx->vout[out.i].nValue;
70+
nBalance += out.tx->tx->vout[out.i].nValue;
7171

7272
return nBalance;
7373
}
@@ -609,22 +609,22 @@ void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins)
609609
int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
610610
if (nDepth < 0) continue;
611611
COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true, true);
612-
if (outpoint.n < out.tx->vout.size() && wallet->IsMine(out.tx->vout[outpoint.n]) == ISMINE_SPENDABLE)
612+
if (outpoint.n < out.tx->tx->vout.size() && wallet->IsMine(out.tx->tx->vout[outpoint.n]) == ISMINE_SPENDABLE)
613613
vCoins.push_back(out);
614614
}
615615

616616
BOOST_FOREACH(const COutput& out, vCoins)
617617
{
618618
COutput cout = out;
619619

620-
while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0]))
620+
while (wallet->IsChange(cout.tx->tx->vout[cout.i]) && cout.tx->tx->vin.size() > 0 && wallet->IsMine(cout.tx->tx->vin[0]))
621621
{
622-
if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break;
623-
cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0, true, true);
622+
if (!wallet->mapWallet.count(cout.tx->tx->vin[0].prevout.hash)) break;
623+
cout = COutput(&wallet->mapWallet[cout.tx->tx->vin[0].prevout.hash], cout.tx->tx->vin[0].prevout.n, 0, true, true);
624624
}
625625

626626
CTxDestination address;
627-
if(!out.fSpendable || !ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address))
627+
if(!out.fSpendable || !ExtractDestination(cout.tx->tx->vout[cout.i].scriptPubKey, address))
628628
continue;
629629
mapCoins[QString::fromStdString(CBitcoinAddress(address).ToString())].push_back(out);
630630
}

src/qt/walletmodeltransaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet)
6464
if (out.amount() <= 0) continue;
6565
if (i == nChangePosRet)
6666
i++;
67-
subtotal += walletTransaction->vout[i].nValue;
67+
subtotal += walletTransaction->tx->vout[i].nValue;
6868
i++;
6969
}
7070
rcp.amount = subtotal;
@@ -73,7 +73,7 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet)
7373
{
7474
if (i == nChangePosRet)
7575
i++;
76-
rcp.amount = walletTransaction->vout[i].nValue;
76+
rcp.amount = walletTransaction->tx->vout[i].nValue;
7777
i++;
7878
}
7979
}

src/wallet/rpcdump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
271271
if (!DecodeHexTx(tx, request.params[0].get_str()))
272272
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
273273
uint256 hashTx = tx.GetHash();
274-
CWalletTx wtx(pwalletMain,tx);
274+
CWalletTx wtx(pwalletMain, MakeTransactionRef(std::move(tx)));
275275

276276
CDataStream ssMB(ParseHexV(request.params[1], "proof"), SER_NETWORK, PROTOCOL_VERSION);
277277
CMerkleBlock merkleBlock;

src/wallet/rpcwallet.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,10 @@ UniValue getreceivedbyaddress(const JSONRPCRequest& request)
583583
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
584584
{
585585
const CWalletTx& wtx = (*it).second;
586-
if (wtx.IsCoinBase() || !CheckFinalTx(wtx))
586+
if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx))
587587
continue;
588588

589-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
589+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
590590
if (txout.scriptPubKey == scriptPubKey)
591591
if (wtx.GetDepthInMainChain() >= nMinDepth)
592592
nAmount += txout.nValue;
@@ -637,10 +637,10 @@ UniValue getreceivedbyaccount(const JSONRPCRequest& request)
637637
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
638638
{
639639
const CWalletTx& wtx = (*it).second;
640-
if (wtx.IsCoinBase() || !CheckFinalTx(wtx))
640+
if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx))
641641
continue;
642642

643-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
643+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
644644
{
645645
CTxDestination address;
646646
if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*pwalletMain, address) && setAddress.count(address))
@@ -1149,14 +1149,14 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
11491149
{
11501150
const CWalletTx& wtx = (*it).second;
11511151

1152-
if (wtx.IsCoinBase() || !CheckFinalTx(wtx))
1152+
if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx))
11531153
continue;
11541154

11551155
int nDepth = wtx.GetDepthInMainChain();
11561156
if (nDepth < nMinDepth)
11571157
continue;
11581158

1159-
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
1159+
BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout)
11601160
{
11611161
CTxDestination address;
11621162
if (!ExtractDestination(txout.scriptPubKey, address))
@@ -1780,7 +1780,7 @@ UniValue gettransaction(const JSONRPCRequest& request)
17801780
CAmount nCredit = wtx.GetCredit(filter);
17811781
CAmount nDebit = wtx.GetDebit(filter);
17821782
CAmount nNet = nCredit - nDebit;
1783-
CAmount nFee = (wtx.IsFromMe(filter) ? wtx.GetValueOut() - nDebit : 0);
1783+
CAmount nFee = (wtx.IsFromMe(filter) ? wtx.tx->GetValueOut() - nDebit : 0);
17841784

17851785
entry.push_back(Pair("amount", ValueFromAmount(nNet - nFee)));
17861786
if (wtx.IsFromMe(filter))
@@ -2420,7 +2420,7 @@ UniValue listunspent(const JSONRPCRequest& request)
24202420
continue;
24212421

24222422
CTxDestination address;
2423-
const CScript& scriptPubKey = out.tx->vout[out.i].scriptPubKey;
2423+
const CScript& scriptPubKey = out.tx->tx->vout[out.i].scriptPubKey;
24242424
bool fValidAddress = ExtractDestination(scriptPubKey, address);
24252425

24262426
if (setAddress.size() && (!fValidAddress || !setAddress.count(address)))
@@ -2445,7 +2445,7 @@ UniValue listunspent(const JSONRPCRequest& request)
24452445
}
24462446

24472447
entry.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
2448-
entry.push_back(Pair("amount", ValueFromAmount(out.tx->vout[out.i].nValue)));
2448+
entry.push_back(Pair("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue)));
24492449
entry.push_back(Pair("confirmations", out.nDepth));
24502450
entry.push_back(Pair("spendable", out.fSpendable));
24512451
entry.push_back(Pair("solvable", out.fSolvable));

src/wallet/test/accounting_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
8686
{
8787
CMutableTransaction tx(wtx);
8888
--tx.nLockTime; // Just to change the hash :)
89-
*static_cast<CTransaction*>(&wtx) = CTransaction(tx);
89+
wtx.SetTx(MakeTransactionRef(std::move(tx)));
9090
}
9191
pwalletMain->AddToWallet(wtx);
9292
vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetHash()]);
@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
9696
{
9797
CMutableTransaction tx(wtx);
9898
--tx.nLockTime; // Just to change the hash :)
99-
*static_cast<CTransaction*>(&wtx) = CTransaction(tx);
99+
wtx.SetTx(MakeTransactionRef(std::move(tx)));
100100
}
101101
pwalletMain->AddToWallet(wtx);
102102
vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetHash()]);

src/wallet/test/wallet_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void add_coin(const CAmount& nValue, int nAge = 6*24, bool fIsFromMe = fa
4242
// so stop vin being empty, and cache a non-zero Debit to fake out IsFromMe()
4343
tx.vin.resize(1);
4444
}
45-
CWalletTx* wtx = new CWalletTx(&wallet, tx);
45+
CWalletTx* wtx = new CWalletTx(&wallet, MakeTransactionRef(std::move(tx)));
4646
if (fIsFromMe)
4747
{
4848
wtx->fDebitCached = true;

0 commit comments

Comments
 (0)