From 3ba2840e7ee81341b0748c0121aedc2e9305041a Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 10 Mar 2021 17:28:08 +0800 Subject: [PATCH 1/2] scripted-diff: remove MakeUnique() -BEGIN VERIFY SCRIPT- git rm src/util/memory.h sed -i -e 's/MakeUnique/std::make_unique/g' $(git grep -l MakeUnique src) sed -i -e '/#include /d' $(git grep -l '#include ' src) sed -i -e '/util\/memory.h \\/d' src/Makefile.am -END VERIFY SCRIPT- --- src/Makefile.am | 1 - src/bench/coin_selection.cpp | 4 +-- src/chainparamsbase.cpp | 9 +++-- src/httprpc.cpp | 2 +- src/index/blockfilterindex.cpp | 4 +-- src/index/txindex.cpp | 2 +- src/init.cpp | 8 ++--- src/interfaces/handler.cpp | 5 ++- src/net.cpp | 12 +++---- src/node/interfaces.cpp | 8 ++--- src/qt/sendcoinsdialog.cpp | 2 +- src/script/descriptor.cpp | 46 +++++++++++++------------- src/test/allocator_tests.cpp | 3 +- src/test/checkqueue_tests.cpp | 15 ++++----- src/test/dbwrapper_tests.cpp | 5 ++- src/test/denialofservice_tests.cpp | 13 ++++---- src/test/fuzz/descriptor_parse.cpp | 1 - src/test/fuzz/eval_script.cpp | 1 - src/test/fuzz/key.cpp | 1 - src/test/fuzz/parse_univalue.cpp | 1 - src/test/fuzz/process_message.cpp | 1 - src/test/fuzz/process_messages.cpp | 1 - src/test/fuzz/psbt.cpp | 1 - src/test/fuzz/script.cpp | 1 - src/test/fuzz/script_flags.cpp | 1 - src/test/fuzz/signature_checker.cpp | 3 +- src/test/net_tests.cpp | 11 +++--- src/test/util/logging.cpp | 1 - src/test/util/setup_common.cpp | 7 ++-- src/test/util_tests.cpp | 2 +- src/txdb.cpp | 5 ++- src/txrequest.cpp | 3 +- src/util/memory.h | 20 ----------- src/util/system.cpp | 2 +- src/util/system.h | 1 - src/validation.cpp | 6 ++-- src/wallet/bdb.cpp | 8 ++--- src/wallet/db.h | 3 +- src/wallet/interfaces.cpp | 4 +-- src/wallet/rpcdump.cpp | 4 +-- src/wallet/salvage.cpp | 2 +- src/wallet/scriptpubkeyman.cpp | 18 +++++----- src/wallet/sqlite.cpp | 5 ++- src/wallet/test/coinselector_tests.cpp | 2 +- src/wallet/test/wallet_tests.cpp | 2 +- src/wallet/walletdb.cpp | 6 ++-- src/zmq/zmqabstractnotifier.h | 3 +- 47 files changed, 110 insertions(+), 156 deletions(-) delete mode 100644 src/util/memory.h diff --git a/src/Makefile.am b/src/Makefile.am index 56f561a172..17b2a7982d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -240,7 +240,6 @@ BITCOIN_CORE_H = \ util/golombrice.h \ util/hasher.h \ util/macros.h \ - util/memory.h \ util/message.h \ util/moneystr.h \ util/rbf.h \ diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index 3abfbfd784..376e70ffba 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -17,7 +17,7 @@ static void addCoin(const CAmount& nValue, const CWallet& wallet, std::vector(&wallet, MakeTransactionRef(std::move(tx)))); + wtxs.push_back(std::make_unique(&wallet, MakeTransactionRef(std::move(tx)))); } // Simple benchmark for wallet coin selection. Note that it maybe be necessary @@ -73,7 +73,7 @@ static void add_coin(const CAmount& nValue, int nInput, std::vector CMutableTransaction tx; tx.vout.resize(nInput + 1); tx.vout[nInput].nValue = nValue; - std::unique_ptr wtx = MakeUnique(&testWallet, MakeTransactionRef(std::move(tx))); + std::unique_ptr wtx = std::make_unique(&testWallet, MakeTransactionRef(std::move(tx))); set.emplace_back(); set.back().Insert(COutput(wtx.get(), nInput, 0, true, true, true).GetInputCoin(), 0, true, 0, 0, false); wtxn.emplace_back(std::move(wtx)); diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 2c517b58f8..1631176477 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -7,7 +7,6 @@ #include #include -#include #include @@ -44,13 +43,13 @@ const CBaseChainParams& BaseParams() std::unique_ptr CreateBaseChainParams(const std::string& chain) { if (chain == CBaseChainParams::MAIN) { - return MakeUnique("", 8332, 8334); + return std::make_unique("", 8332, 8334); } else if (chain == CBaseChainParams::TESTNET) { - return MakeUnique("testnet3", 18332, 18334); + return std::make_unique("testnet3", 18332, 18334); } else if (chain == CBaseChainParams::SIGNET) { - return MakeUnique("signet", 38332, 38334); + return std::make_unique("signet", 38332, 38334); } else if (chain == CBaseChainParams::REGTEST) { - return MakeUnique("regtest", 18443, 18445); + return std::make_unique("regtest", 18443, 18445); } throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain)); } diff --git a/src/httprpc.cpp b/src/httprpc.cpp index cb8b220895..867ddb090e 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -301,7 +301,7 @@ bool StartHTTPRPC(const util::Ref& context) } struct event_base* eventBase = EventBase(); assert(eventBase); - httpRPCTimerInterface = MakeUnique(eventBase); + httpRPCTimerInterface = std::make_unique(eventBase); RPCSetTimerInterface(httpRPCTimerInterface.get()); return true; } diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp index 4f61bbeabd..32271fb7ab 100644 --- a/src/index/blockfilterindex.cpp +++ b/src/index/blockfilterindex.cpp @@ -102,8 +102,8 @@ BlockFilterIndex::BlockFilterIndex(BlockFilterType filter_type, fs::create_directories(path); m_name = filter_name + " block filter index"; - m_db = MakeUnique(path / "db", n_cache_size, f_memory, f_wipe); - m_filter_fileseq = MakeUnique(std::move(path), "fltr", FLTR_FILE_CHUNK_SIZE); + m_db = std::make_unique(path / "db", n_cache_size, f_memory, f_wipe); + m_filter_fileseq = std::make_unique(std::move(path), "fltr", FLTR_FILE_CHUNK_SIZE); } bool BlockFilterIndex::Init() diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index 6398b7edc8..f41985c344 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -192,7 +192,7 @@ bool TxIndex::DB::MigrateData(CBlockTreeDB& block_tree_db, const CBlockLocator& } TxIndex::TxIndex(size_t n_cache_size, bool f_memory, bool f_wipe) - : m_db(MakeUnique(n_cache_size, f_memory, f_wipe)) + : m_db(std::make_unique(n_cache_size, f_memory, f_wipe)) {} TxIndex::~TxIndex() {} diff --git a/src/init.cpp b/src/init.cpp index 8aa80eacca..dfa848c8c2 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1349,7 +1349,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA } assert(!node.scheduler); - node.scheduler = MakeUnique(); + node.scheduler = std::make_unique(); // Start the lightweight task scheduler thread node.scheduler->m_service_thread = std::thread([&] { TraceThread("scheduler", [&] { node.scheduler->serviceQueue(); }); }); @@ -1401,9 +1401,9 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA const bool ignores_incoming_txs{args.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)}; assert(!node.banman); - node.banman = MakeUnique(GetDataDir() / "banlist.dat", &uiInterface, args.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME)); + node.banman = std::make_unique(GetDataDir() / "banlist.dat", &uiInterface, args.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME)); assert(!node.connman); - node.connman = MakeUnique(GetRand(std::numeric_limits::max()), GetRand(std::numeric_limits::max()), args.GetBoolArg("-networkactive", true)); + node.connman = std::make_unique(GetRand(std::numeric_limits::max()), GetRand(std::numeric_limits::max()), args.GetBoolArg("-networkactive", true)); assert(!node.fee_estimator); // Don't initialize fee estimation with old data if we don't relay transactions, @@ -1799,7 +1799,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA // ********************************************************* Step 8: start indexers if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) { - g_txindex = MakeUnique(nTxIndexCache, false, fReindex); + g_txindex = std::make_unique(nTxIndexCache, false, fReindex); g_txindex->Start(); } diff --git a/src/interfaces/handler.cpp b/src/interfaces/handler.cpp index 4134a4527f..c6bbbed445 100644 --- a/src/interfaces/handler.cpp +++ b/src/interfaces/handler.cpp @@ -4,7 +4,6 @@ #include -#include #include #include @@ -35,12 +34,12 @@ public: std::unique_ptr MakeHandler(boost::signals2::connection connection) { - return MakeUnique(std::move(connection)); + return std::make_unique(std::move(connection)); } std::unique_ptr MakeHandler(std::function cleanup) { - return MakeUnique(std::move(cleanup)); + return std::make_unique(std::move(cleanup)); } } // namespace interfaces diff --git a/src/net.cpp b/src/net.cpp index cf7d3e50ba..1e4a6a9aa7 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2466,11 +2466,11 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions) if (semOutbound == nullptr) { // initialize semaphore - semOutbound = MakeUnique(std::min(m_max_outbound, nMaxConnections)); + semOutbound = std::make_unique(std::min(m_max_outbound, nMaxConnections)); } if (semAddnode == nullptr) { // initialize semaphore - semAddnode = MakeUnique(nMaxAddnode); + semAddnode = std::make_unique(nMaxAddnode); } // @@ -2906,11 +2906,11 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, SOCKET hSocketIn, const hSocket = hSocketIn; addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; if (conn_type_in != ConnectionType::BLOCK_RELAY) { - m_tx_relay = MakeUnique(); + m_tx_relay = std::make_unique(); } if (RelayAddrsWithConn()) { - m_addr_known = MakeUnique(5000, 0.001); + m_addr_known = std::make_unique(5000, 0.001); } for (const std::string &msg : getAllNetMessageTypes()) @@ -2923,8 +2923,8 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, SOCKET hSocketIn, const LogPrint(BCLog::NET, "Added connection peer=%d\n", id); } - m_deserializer = MakeUnique(V1TransportDeserializer(Params(), GetId(), SER_NETWORK, INIT_PROTO_VERSION)); - m_serializer = MakeUnique(V1TransportSerializer()); + m_deserializer = std::make_unique(V1TransportDeserializer(Params(), GetId(), SER_NETWORK, INIT_PROTO_VERSION)); + m_serializer = std::make_unique(V1TransportSerializer()); } CNode::~CNode() diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 62ef72ef38..8611989d01 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -613,7 +613,7 @@ public: } std::unique_ptr handleNotifications(std::shared_ptr notifications) override { - return MakeUnique(std::move(notifications)); + return std::make_unique(std::move(notifications)); } void waitForNotificationsIfTipChanged(const uint256& old_tip) override { @@ -626,7 +626,7 @@ public: } std::unique_ptr handleRpc(const CRPCCommand& command) override { - return MakeUnique(command); + return std::make_unique(command); } bool rpcEnableDeprecated(const std::string& method) override { return IsDeprecatedRPCEnabled(method); } void rpcRunLater(const std::string& name, std::function fn, int64_t seconds) override @@ -669,6 +669,6 @@ public: } // namespace node namespace interfaces { -std::unique_ptr MakeNode(NodeContext* context) { return MakeUnique(context); } -std::unique_ptr MakeChain(NodeContext& context) { return MakeUnique(context); } +std::unique_ptr MakeNode(NodeContext* context) { return std::make_unique(context); } +std::unique_ptr MakeChain(NodeContext& context) { return std::make_unique(context); } } // namespace interfaces diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 611f3584c3..d722e0346e 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -266,7 +266,7 @@ bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informa } // prepare transaction for getting txFee earlier - m_current_transaction = MakeUnique(recipients); + m_current_transaction = std::make_unique(recipients); WalletModel::SendCoinsReturn prepareStatus; updateCoinControlState(*m_coin_control); diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 6ab01882ac..889cb4f06e 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -853,7 +853,7 @@ std::unique_ptr ParsePubkeyInner(uint32_t key_exp_index, const S CPubKey pubkey(data); if (pubkey.IsFullyValid()) { if (permit_uncompressed || pubkey.IsCompressed()) { - return MakeUnique(key_exp_index, pubkey); + return std::make_unique(key_exp_index, pubkey); } else { error = "Uncompressed keys are not allowed"; return nullptr; @@ -867,7 +867,7 @@ std::unique_ptr ParsePubkeyInner(uint32_t key_exp_index, const S if (permit_uncompressed || key.IsCompressed()) { CPubKey pubkey = key.GetPubKey(); out.keys.emplace(pubkey.GetID(), key); - return MakeUnique(key_exp_index, pubkey); + return std::make_unique(key_exp_index, pubkey); } else { error = "Uncompressed keys are not allowed"; return nullptr; @@ -894,7 +894,7 @@ std::unique_ptr ParsePubkeyInner(uint32_t key_exp_index, const S extpubkey = extkey.Neuter(); out.keys.emplace(extpubkey.pubkey.GetID(), extkey.key); } - return MakeUnique(key_exp_index, extpubkey, std::move(path), type); + return std::make_unique(key_exp_index, extpubkey, std::move(path), type); } /** Parse a public key including origin information (if enabled). */ @@ -931,7 +931,7 @@ std::unique_ptr ParsePubkey(uint32_t key_exp_index, const Span(key_exp_index, std::move(info), std::move(provider)); + return std::make_unique(key_exp_index, std::move(info), std::move(provider)); } /** Parse a script in a particular context. */ @@ -944,17 +944,17 @@ std::unique_ptr ParseScript(uint32_t key_exp_index, Span(std::move(pubkey)); + return std::make_unique(std::move(pubkey)); } if (Func("pkh", expr)) { auto pubkey = ParsePubkey(key_exp_index, expr, ctx != ParseScriptContext::P2WSH, out, error); if (!pubkey) return nullptr; - return MakeUnique(std::move(pubkey)); + return std::make_unique(std::move(pubkey)); } if (ctx == ParseScriptContext::TOP && Func("combo", expr)) { auto pubkey = ParsePubkey(key_exp_index, expr, true, out, error); if (!pubkey) return nullptr; - return MakeUnique(std::move(pubkey)); + return std::make_unique(std::move(pubkey)); } else if (ctx != ParseScriptContext::TOP && Func("combo", expr)) { error = "Cannot have combo in non-top level"; return nullptr; @@ -1002,12 +1002,12 @@ std::unique_ptr ParseScript(uint32_t key_exp_index, Span(thres, std::move(providers), sorted_multi); + return std::make_unique(thres, std::move(providers), sorted_multi); } if (ctx != ParseScriptContext::P2WSH && Func("wpkh", expr)) { auto pubkey = ParsePubkey(key_exp_index, expr, false, out, error); if (!pubkey) return nullptr; - return MakeUnique(std::move(pubkey)); + return std::make_unique(std::move(pubkey)); } else if (ctx == ParseScriptContext::P2WSH && Func("wpkh", expr)) { error = "Cannot have wpkh within wsh"; return nullptr; @@ -1015,7 +1015,7 @@ std::unique_ptr ParseScript(uint32_t key_exp_index, Span(std::move(desc)); + return std::make_unique(std::move(desc)); } else if (ctx != ParseScriptContext::TOP && Func("sh", expr)) { error = "Cannot have sh in non-top level"; return nullptr; @@ -1023,7 +1023,7 @@ std::unique_ptr ParseScript(uint32_t key_exp_index, Span(std::move(desc)); + return std::make_unique(std::move(desc)); } else if (ctx == ParseScriptContext::P2WSH && Func("wsh", expr)) { error = "Cannot have wsh within wsh"; return nullptr; @@ -1034,7 +1034,7 @@ std::unique_ptr ParseScript(uint32_t key_exp_index, Span(std::move(dest)); + return std::make_unique(std::move(dest)); } if (ctx == ParseScriptContext::TOP && Func("raw", expr)) { std::string str(expr.begin(), expr.end()); @@ -1043,7 +1043,7 @@ std::unique_ptr ParseScript(uint32_t key_exp_index, Span(CScript(bytes.begin(), bytes.end())); + return std::make_unique(CScript(bytes.begin(), bytes.end())); } if (ctx == ParseScriptContext::P2SH) { error = "A function is needed within P2SH"; @@ -1058,10 +1058,10 @@ std::unique_ptr ParseScript(uint32_t key_exp_index, Span InferPubkey(const CPubKey& pubkey, ParseScriptContext, const SigningProvider& provider) { - std::unique_ptr key_provider = MakeUnique(0, pubkey); + std::unique_ptr key_provider = std::make_unique(0, pubkey); KeyOriginInfo info; if (provider.GetKeyOrigin(pubkey.GetID(), info)) { - return MakeUnique(0, std::move(info), std::move(key_provider)); + return std::make_unique(0, std::move(info), std::move(key_provider)); } return key_provider; } @@ -1074,7 +1074,7 @@ std::unique_ptr InferScript(const CScript& script, ParseScriptCo if (txntype == TxoutType::PUBKEY) { CPubKey pubkey(data[0].begin(), data[0].end()); if (pubkey.IsValid()) { - return MakeUnique(InferPubkey(pubkey, ctx, provider)); + return std::make_unique(InferPubkey(pubkey, ctx, provider)); } } if (txntype == TxoutType::PUBKEYHASH) { @@ -1082,7 +1082,7 @@ std::unique_ptr InferScript(const CScript& script, ParseScriptCo CKeyID keyid(hash); CPubKey pubkey; if (provider.GetPubKey(keyid, pubkey)) { - return MakeUnique(InferPubkey(pubkey, ctx, provider)); + return std::make_unique(InferPubkey(pubkey, ctx, provider)); } } if (txntype == TxoutType::WITNESS_V0_KEYHASH && ctx != ParseScriptContext::P2WSH) { @@ -1090,7 +1090,7 @@ std::unique_ptr InferScript(const CScript& script, ParseScriptCo CKeyID keyid(hash); CPubKey pubkey; if (provider.GetPubKey(keyid, pubkey)) { - return MakeUnique(InferPubkey(pubkey, ctx, provider)); + return std::make_unique(InferPubkey(pubkey, ctx, provider)); } } if (txntype == TxoutType::MULTISIG) { @@ -1099,7 +1099,7 @@ std::unique_ptr InferScript(const CScript& script, ParseScriptCo CPubKey pubkey(data[i].begin(), data[i].end()); providers.push_back(InferPubkey(pubkey, ctx, provider)); } - return MakeUnique((int)data[0][0], std::move(providers)); + return std::make_unique((int)data[0][0], std::move(providers)); } if (txntype == TxoutType::SCRIPTHASH && ctx == ParseScriptContext::TOP) { uint160 hash(data[0]); @@ -1107,7 +1107,7 @@ std::unique_ptr InferScript(const CScript& script, ParseScriptCo CScript subscript; if (provider.GetCScript(scriptid, subscript)) { auto sub = InferScript(subscript, ParseScriptContext::P2SH, provider); - if (sub) return MakeUnique(std::move(sub)); + if (sub) return std::make_unique(std::move(sub)); } } if (txntype == TxoutType::WITNESS_V0_SCRIPTHASH && ctx != ParseScriptContext::P2WSH) { @@ -1116,18 +1116,18 @@ std::unique_ptr InferScript(const CScript& script, ParseScriptCo CScript subscript; if (provider.GetCScript(scriptid, subscript)) { auto sub = InferScript(subscript, ParseScriptContext::P2WSH, provider); - if (sub) return MakeUnique(std::move(sub)); + if (sub) return std::make_unique(std::move(sub)); } } CTxDestination dest; if (ExtractDestination(script, dest)) { if (GetScriptForDestination(dest) == script) { - return MakeUnique(std::move(dest)); + return std::make_unique(std::move(dest)); } } - return MakeUnique(script); + return std::make_unique(script); } diff --git a/src/test/allocator_tests.cpp b/src/test/allocator_tests.cpp index d33d668a04..b523173a45 100644 --- a/src/test/allocator_tests.cpp +++ b/src/test/allocator_tests.cpp @@ -2,7 +2,6 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include #include #include @@ -163,7 +162,7 @@ private: BOOST_AUTO_TEST_CASE(lockedpool_tests_mock) { // Test over three virtual arenas, of which one will succeed being locked - std::unique_ptr x = MakeUnique(3, 1); + std::unique_ptr x = std::make_unique(3, 1); LockedPool pool(std::move(x)); BOOST_CHECK(pool.stats().total == 0); BOOST_CHECK(pool.stats().locked == 0); diff --git a/src/test/checkqueue_tests.cpp b/src/test/checkqueue_tests.cpp index 21921375b3..64c6d7f634 100644 --- a/src/test/checkqueue_tests.cpp +++ b/src/test/checkqueue_tests.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -146,7 +145,7 @@ typedef CCheckQueue FrozenCleanup_Queue; */ static void Correct_Queue_range(std::vector range) { - auto small_queue = MakeUnique(QUEUE_BATCH_SIZE); + auto small_queue = std::make_unique(QUEUE_BATCH_SIZE); small_queue->StartWorkerThreads(SCRIPT_CHECK_THREADS); // Make vChecks here to save on malloc (this test can be slow...) std::vector vChecks; @@ -206,7 +205,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Correct_Random) /** Test that failing checks are caught */ BOOST_AUTO_TEST_CASE(test_CheckQueue_Catches_Failure) { - auto fail_queue = MakeUnique(QUEUE_BATCH_SIZE); + auto fail_queue = std::make_unique(QUEUE_BATCH_SIZE); fail_queue->StartWorkerThreads(SCRIPT_CHECK_THREADS); for (size_t i = 0; i < 1001; ++i) { @@ -234,7 +233,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Catches_Failure) // future blocks, ie, the bad state is cleared. BOOST_AUTO_TEST_CASE(test_CheckQueue_Recovers_From_Failure) { - auto fail_queue = MakeUnique(QUEUE_BATCH_SIZE); + auto fail_queue = std::make_unique(QUEUE_BATCH_SIZE); fail_queue->StartWorkerThreads(SCRIPT_CHECK_THREADS); for (auto times = 0; times < 10; ++times) { @@ -258,7 +257,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Recovers_From_Failure) // more than once as well BOOST_AUTO_TEST_CASE(test_CheckQueue_UniqueCheck) { - auto queue = MakeUnique(QUEUE_BATCH_SIZE); + auto queue = std::make_unique(QUEUE_BATCH_SIZE); queue->StartWorkerThreads(SCRIPT_CHECK_THREADS); size_t COUNT = 100000; @@ -293,7 +292,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_UniqueCheck) // time could leave the data hanging across a sequence of blocks. BOOST_AUTO_TEST_CASE(test_CheckQueue_Memory) { - auto queue = MakeUnique(QUEUE_BATCH_SIZE); + auto queue = std::make_unique(QUEUE_BATCH_SIZE); queue->StartWorkerThreads(SCRIPT_CHECK_THREADS); for (size_t i = 0; i < 1000; ++i) { size_t total = i; @@ -320,7 +319,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Memory) // have been destructed BOOST_AUTO_TEST_CASE(test_CheckQueue_FrozenCleanup) { - auto queue = MakeUnique(QUEUE_BATCH_SIZE); + auto queue = std::make_unique(QUEUE_BATCH_SIZE); bool fails = false; queue->StartWorkerThreads(SCRIPT_CHECK_THREADS); std::thread t0([&]() { @@ -360,7 +359,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_FrozenCleanup) /** Test that CCheckQueueControl is threadsafe */ BOOST_AUTO_TEST_CASE(test_CheckQueueControl_Locks) { - auto queue = MakeUnique(QUEUE_BATCH_SIZE); + auto queue = std::make_unique(QUEUE_BATCH_SIZE); { std::vector tg; std::atomic nThreads {0}; diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp index 3d802cbeb3..a6080ad3dd 100644 --- a/src/test/dbwrapper_tests.cpp +++ b/src/test/dbwrapper_tests.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include @@ -207,7 +206,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate) create_directories(ph); // Set up a non-obfuscated wrapper to write some initial data. - std::unique_ptr dbw = MakeUnique(ph, (1 << 10), false, false, false); + std::unique_ptr dbw = std::make_unique(ph, (1 << 10), false, false, false); char key = 'k'; uint256 in = InsecureRand256(); uint256 res; @@ -248,7 +247,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex) create_directories(ph); // Set up a non-obfuscated wrapper to write some initial data. - std::unique_ptr dbw = MakeUnique(ph, (1 << 10), false, false, false); + std::unique_ptr dbw = std::make_unique(ph, (1 << 10), false, false, false); char key = 'k'; uint256 in = InsecureRand256(); uint256 res; diff --git a/src/test/denialofservice_tests.cpp b/src/test/denialofservice_tests.cpp index 5906913b58..e75982bc6f 100644 --- a/src/test/denialofservice_tests.cpp +++ b/src/test/denialofservice_tests.cpp @@ -15,7 +15,6 @@ #include