Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/coinselector_tests.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | static void add_coin(CWallet &wallet, const Amount nValue, int nAge = 6 * 24, | ||||
tx.vout.resize(nInput + 1); | tx.vout.resize(nInput + 1); | ||||
tx.vout[nInput].nValue = nValue; | tx.vout[nInput].nValue = nValue; | ||||
if (fIsFromMe) { | if (fIsFromMe) { | ||||
// IsFromMe() returns (GetDebit() > 0), and GetDebit() is 0 if | // IsFromMe() returns (GetDebit() > 0), and GetDebit() is 0 if | ||||
// vin.empty(), so stop vin being empty, and cache a non-zero Debit to | // vin.empty(), so stop vin being empty, and cache a non-zero Debit to | ||||
// fake out IsFromMe() | // fake out IsFromMe() | ||||
tx.vin.resize(1); | tx.vin.resize(1); | ||||
} | } | ||||
std::unique_ptr<CWalletTx> wtx( | auto wtx = | ||||
new CWalletTx(&wallet, MakeTransactionRef(std::move(tx)))); | std::make_unique<CWalletTx>(&wallet, MakeTransactionRef(std::move(tx))); | ||||
if (fIsFromMe) { | if (fIsFromMe) { | ||||
wtx->fDebitCached = true; | wtx->fDebitCached = true; | ||||
wtx->nDebitCached = SATOSHI; | wtx->nDebitCached = SATOSHI; | ||||
} | } | ||||
COutput output(wtx.get(), nInput, nAge, true /* spendable */, | COutput output(wtx.get(), nInput, nAge, true /* spendable */, | ||||
true /* solvable */, true /* safe */); | true /* solvable */, true /* safe */); | ||||
vCoins.push_back(output); | vCoins.push_back(output); | ||||
wallet.AddToWallet(*wtx.get()); | wallet.AddToWallet(*wtx.get()); | ||||
▲ Show 20 Lines • Show All 666 Lines • Show Last 20 Lines |