diff options
| author | Pieter Wuille <[email protected]> | 2014-06-22 20:40:53 +0200 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2014-06-22 20:45:30 +0200 |
| commit | d4e4e05435a93a72711120f46ee79482c13fae45 (patch) | |
| tree | aeb3e1ba960864e331b647abbfabe2ecb5a90c45 /src/test/wallet_tests.cpp | |
| parent | Merge pull request #4381 (diff) | |
| parent | Code simplifications after CTransaction::GetHash() caching (diff) | |
| download | discoin-d4e4e05435a93a72711120f46ee79482c13fae45.tar.xz discoin-d4e4e05435a93a72711120f46ee79482c13fae45.zip | |
Merge pull request #4309
d38da59 Code simplifications after CTransaction::GetHash() caching (Pieter Wuille)
4949004 Add CMutableTransaction and make CTransaction immutable. (Pieter Wuille)
Diffstat (limited to 'src/test/wallet_tests.cpp')
| -rw-r--r-- | src/test/wallet_tests.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/wallet_tests.cpp b/src/test/wallet_tests.cpp index 199335882..86a83f516 100644 --- a/src/test/wallet_tests.cpp +++ b/src/test/wallet_tests.cpp @@ -31,16 +31,18 @@ static vector<COutput> vCoins; static void add_coin(int64_t nValue, int nAge = 6*24, bool fIsFromMe = false, int nInput=0) { static int nextLockTime = 0; - CTransaction tx; + CMutableTransaction tx; tx.nLockTime = nextLockTime++; // so all transactions get different hashes tx.vout.resize(nInput+1); tx.vout[nInput].nValue = nValue; + if (fIsFromMe) { + // IsFromMe() returns (GetDebit() > 0), and GetDebit() is 0 if vin.empty(), + // so stop vin being empty, and cache a non-zero Debit to fake out IsFromMe() + tx.vin.resize(1); + } CWalletTx* wtx = new CWalletTx(&wallet, tx); if (fIsFromMe) { - // IsFromMe() returns (GetDebit() > 0), and GetDebit() is 0 if vin.empty(), - // so stop vin being empty, and cache a non-zero Debit to fake out IsFromMe() - wtx->vin.resize(1); wtx->fDebitCached = true; wtx->nDebitCached = 1; } |