12
12
#include " rpc/server.h"
13
13
#include " rpcconsole.h"
14
14
#include " test/testutil.h"
15
+ #include " test/test_bitcoin.h"
15
16
#include " univalue.h"
16
17
#include " util.h"
17
18
@@ -35,24 +36,15 @@ void RPCNestedTests::rpcNestedTests()
35
36
{
36
37
// do some test setup
37
38
// could be moved to a more generic place when we add more tests on QT level
38
- const CChainParams& chainparams = Params ();
39
- RegisterAllCoreRPCCommands (tableRPC);
40
39
tableRPC.appendCommand (" rpcNestedTest" , &vRPCCommands[0 ]);
41
40
ClearDatadirCache ();
42
41
std::string path = QDir::tempPath ().toStdString () + " /" + strprintf (" test_bitcoin_qt_%lu_%i" , (unsigned long )GetTime (), (int )(GetRand (100000 )));
43
42
QDir dir (QString::fromStdString (path));
44
43
dir.mkpath (" ." );
45
44
ForceSetArg (" -datadir" , path);
46
45
// mempool.setSanityCheck(1.0);
47
- pblocktree = new CBlockTreeDB (1 << 20 , true );
48
- pcoinsdbview = new CCoinsViewDB (1 << 23 , true );
49
- pcoinsTip = new CCoinsViewCache (pcoinsdbview);
50
- InitBlockIndex (chainparams);
51
- {
52
- CValidationState state;
53
- bool ok = ActivateBestChain (state, chainparams);
54
- QVERIFY (ok);
55
- }
46
+
47
+ TestingSetup test;
56
48
57
49
SetRPCWarmupFinished ();
58
50
@@ -145,13 +137,5 @@ void RPCNestedTests::rpcNestedTests()
145
137
QVERIFY_EXCEPTION_THROWN (RPCConsole::RPCExecuteCommandLine (result, " rpcNestedTest(abc,,)" ), std::runtime_error); // don't tollerate empty arguments when using ,
146
138
#endif
147
139
148
- UnloadBlockIndex ();
149
- delete pcoinsTip;
150
- pcoinsTip = nullptr ;
151
- delete pcoinsdbview;
152
- pcoinsdbview = nullptr ;
153
- delete pblocktree;
154
- pblocktree = nullptr ;
155
-
156
140
fs::remove_all (fs::path (path));
157
141
}
0 commit comments