aboutsummaryrefslogtreecommitdiff
path: root/src/qt/test/wallettests.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-11-09 09:36:34 -0500
committerMarcoFalke <falke.marco@gmail.com>2018-11-09 10:02:22 -0500
commitcbf00939b5e813937fb21466aa3e229ca81cb6ba (patch)
tree67a52d9df87a82c2f641a427ea089fb8b1bc387b /src/qt/test/wallettests.cpp
parente70a19e7132dac91b7948fcbfac086f86fec3d88 (diff)
parent081accb875412f38718f2e40ed7bbdf15e6f4ef8 (diff)
downloadbitcoin-cbf00939b5e813937fb21466aa3e229ca81cb6ba.tar.xz
Merge #14437: Refactor: Start to separate wallet from node
081accb875 Pass chain locked variables where needed (Russell Yanofsky) 79d579f4e1 Remove uses of cs_main in wallet code (Russell Yanofsky) ea961c3d72 Remove direct node->wallet calls in init.cpp (Russell Yanofsky) 8db11dd0b1 Pass chain and client variables where needed (Russell Yanofsky) 7e2e62cf7c Add skeleton chain and client classes (Russell Yanofsky) Pull request description: This creates an incomplete [`Chain`](https://github.com/ryanofsky/bitcoin/blob/pr/wipc-sep/src/interfaces/chain.h) interface in [`src/interfaces/`](https://github.com/ryanofsky/bitcoin/tree/pr/wipc-sep/src/interfaces) and begins to update wallet code to use it. #10973 builds on this, changing the wallet to use the new interface to access chain state, instead of using CBlockIndex pointers and global variables like `chainActive`. Tree-SHA512: 6ef05a4d8ebf57f2ad71835e4d970c9c59e34057e39e48cee76b887492c2fee907e3f6a74a9861e5a9f97cdc6823f4865ebc41ec556ab371ebca1b664c20dbea
Diffstat (limited to 'src/qt/test/wallettests.cpp')
-rw-r--r--src/qt/test/wallettests.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp
index 12dbf922f1..f02fd8aea7 100644
--- a/src/qt/test/wallettests.cpp
+++ b/src/qt/test/wallettests.cpp
@@ -1,6 +1,7 @@
#include <qt/test/wallettests.h>
#include <qt/test/util.h>
+#include <interfaces/chain.h>
#include <interfaces/node.h>
#include <base58.h>
#include <qt/bitcoinamountfield.h>
@@ -132,7 +133,8 @@ void TestGUI()
for (int i = 0; i < 5; ++i) {
test.CreateAndProcessBlock({}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey()));
}
- std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(WalletLocation(), WalletDatabase::CreateMock());
+ auto chain = interfaces::MakeChain();
+ std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(*chain, WalletLocation(), WalletDatabase::CreateMock());
bool firstRun;
wallet->LoadWallet(firstRun);
{
@@ -141,7 +143,7 @@ void TestGUI()
wallet->AddKeyPubKey(test.coinbaseKey, test.coinbaseKey.GetPubKey());
}
{
- LOCK(cs_main);
+ auto locked_chain = wallet->chain().lock();
WalletRescanReserver reserver(wallet.get());
reserver.reserve();
wallet->ScanForWalletTransactions(chainActive.Genesis(), nullptr, reserver, true);