aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test/wallet_tests.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-03-13 19:07:49 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-03-13 19:16:39 -0700
commit6acd8700bc0ee1d10207a362c1e07372ba274041 (patch)
tree27ab248388e4a316ce41d750098e215ba7288f44 /src/wallet/test/wallet_tests.cpp
parent18462960c0f13bd07d8f52b61e7d7bc17e991eea (diff)
parentb4bc32a451720167000f59dd73ab07990f9c6b92 (diff)
downloadbitcoin-6acd8700bc0ee1d10207a362c1e07372ba274041.tar.xz
Merge #9680: Unify CWalletTx construction
b4bc32a451 [wallet] Get rid of CWalletTx default constructor (Russell Yanofsky) a128bdc9e1 [wallet] Construct CWalletTx objects in CommitTransaction (Russell Yanofsky) Pull request description: Two commits: - `Construct CWalletTx objects in CommitTransaction` moves a bunch of CWalletTx initialization into CWallet::CommitTransaction to dedup some code and avoid future inconsistencies in how wallet transactions are created. - `Get rid of CWalletTx default constructor` does what is described and eliminates the possibility of empty transaction entries being inadvertently created by mapWallet[hash] accesses. Both of these changes were originally part of #9381 Tree-SHA512: af3841c4f0539e0662d81b33c5369fc70aa06ddde1c59cb00fb21c9e4c7d9ff47f1edc5040cb463af1333838802c56b3ef875b939e2b804ee45b8e0294a4371c
Diffstat (limited to 'src/wallet/test/wallet_tests.cpp')
-rw-r--r--src/wallet/test/wallet_tests.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index 6e20f8170d..3373b51f2a 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -627,23 +627,23 @@ public:
CWalletTx& AddTx(CRecipient recipient)
{
- CWalletTx wtx;
+ CTransactionRef tx;
CReserveKey reservekey(wallet.get());
CAmount fee;
int changePos = -1;
std::string error;
CCoinControl dummy;
- BOOST_CHECK(wallet->CreateTransaction({recipient}, wtx, reservekey, fee, changePos, error, dummy));
+ BOOST_CHECK(wallet->CreateTransaction({recipient}, tx, reservekey, fee, changePos, error, dummy));
CValidationState state;
- BOOST_CHECK(wallet->CommitTransaction(wtx, reservekey, nullptr, state));
+ BOOST_CHECK(wallet->CommitTransaction(tx, {}, {}, {}, reservekey, nullptr, state));
CMutableTransaction blocktx;
{
LOCK(wallet->cs_wallet);
- blocktx = CMutableTransaction(*wallet->mapWallet.at(wtx.GetHash()).tx);
+ blocktx = CMutableTransaction(*wallet->mapWallet.at(tx->GetHash()).tx);
}
CreateAndProcessBlock({CMutableTransaction(blocktx)}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
LOCK(wallet->cs_wallet);
- auto it = wallet->mapWallet.find(wtx.GetHash());
+ auto it = wallet->mapWallet.find(tx->GetHash());
BOOST_CHECK(it != wallet->mapWallet.end());
it->second.SetMerkleBranch(chainActive.Tip(), 1);
return it->second;