From e62fdfeeab13ff65bcedac30f08a3216f3b29255 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Thu, 14 Jun 2018 10:26:27 +0000 Subject: Drop unused init.h includes These were entirely unused, as based on successful compilation and a grep for: \bStartShutdown\(\)|\bShutdownRequested\(\)|\bInterrupt\(\)|\bShutdown\(\)|\bInitLogging\(\)|\bInitParameterInteraction\(\)|\bAppInitBasicSetup\(\)|\bAppInitParameterInteraction\(\)|\bAppInitSanityChecks\(\)|\bAppInitLockDataDirectory\(\)|\bAppInitMain\(\)|\bSetupServerArgs\(\)|\bLicenseInfo\(\)|g_wallet_init_interface|init.h --- src/net_processing.cpp | 1 - src/qt/bitcoin.cpp | 1 - src/qt/bitcoingui.cpp | 1 - src/qt/signverifymessagedialog.cpp | 1 - src/qt/splashscreen.cpp | 1 - src/rpc/misc.cpp | 1 - src/rpc/rawtransaction.cpp | 1 - src/validationinterface.cpp | 1 - 8 files changed, 8 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index de456e87f4..17ae6a82db 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index e3d1c746b1..3454d3421e 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -26,7 +26,6 @@ #include #endif -#include #include #include #include diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index b3c8f57deb..14a47aab31 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -29,7 +29,6 @@ #endif #include -#include #include #include #include diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index c8e694e658..223b39dc86 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include // For strMessageMagic #include diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 4d972b431c..831ef68cab 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include #include diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 6772784d3d..2d8bed85b6 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 3b3f43edea..623a26a20b 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index f328d2d14b..55aa5c2cdf 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -5,7 +5,6 @@ #include -#include #include #include #include -- cgit v1.2.3 From 1fabd59e7e870fae73bfbcfb227dd7452de94726 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Wed, 16 May 2018 19:17:40 +0000 Subject: Break circular dependency: init -> * -> init by extracting shutdown.h Most includers just wanted to react to pending shutdown. This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `AbortShutdown` for setting it to `false`. Note I originally called `AbortShutdown` `CancelShutdown` but that name was already taken by winuser.h https://travis-ci.org/bitcoin/bitcoin/jobs/386913329 This change also triggered a build error in bench. Fixing it required moving LIBBITCOIN_SERVER after LIBBITCOIN_WALLET in bench_bench_bitcoin_LDADD To make server definitions in src/net.cpp available to wallet methods in src/wallet/wallet.cpp. Specifically, solving: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): In function `CWalletTx::RelayWalletTransaction(CConnman*)': wallet.cpp:(.text+0x3f0e): undefined reference to `CConnman::NodeFullyConnected(CNode const*)' collect2: error: ld returned 1 exit status https://travis-ci.org/bitcoin/bitcoin/jobs/392133581 Need for remaining init.h includes confirmed via a thorough search with a more specific regex: \bInterrupt\(\)|\bShutdown\(\)|\bInitLogging\(\)|\bInitParameterInteraction\(\)|\bAppInitBasicSetup\(\)|\bAppInitParameterInteraction\(\)|\bAppInitSanityChecks\(\)|\bAppInitLockDataDirectory\(\)|\bAppInitMain\(\)|\bSetupServerArgs\(\)|\bLicenseInfo\(\)|g_wallet_init_interface|init.h --- src/Makefile.am | 2 ++ src/Makefile.bench.include | 2 +- src/bitcoind.cpp | 3 ++- src/index/base.cpp | 2 +- src/index/txindex.cpp | 2 +- src/init.cpp | 35 ++++++++++++----------------------- src/init.h | 4 +--- src/interfaces/node.cpp | 1 + src/qt/bitcoingui.h | 2 +- src/qt/winshutdownmonitor.cpp | 2 +- src/rpc/mining.cpp | 4 ++-- src/rpc/server.cpp | 4 ++-- src/shutdown.cpp | 23 +++++++++++++++++++++++ src/shutdown.h | 13 +++++++++++++ src/txdb.cpp | 4 ++-- src/validation.cpp | 4 ++-- src/wallet/rpcwallet.cpp | 5 ++--- src/wallet/wallet.cpp | 2 +- 18 files changed, 70 insertions(+), 44 deletions(-) create mode 100644 src/shutdown.cpp create mode 100644 src/shutdown.h diff --git a/src/Makefile.am b/src/Makefile.am index a2599d33e1..4286ee990d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -157,6 +157,7 @@ BITCOIN_CORE_H = \ script/sigcache.h \ script/sign.h \ script/standard.h \ + shutdown.h \ streams.h \ support/allocators/secure.h \ support/allocators/zeroafterfree.h \ @@ -237,6 +238,7 @@ libbitcoin_server_a_SOURCES = \ rpc/server.cpp \ rpc/util.cpp \ script/sigcache.cpp \ + shutdown.cpp \ timedata.cpp \ torcontrol.cpp \ txdb.cpp \ diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include index d70df3c9e8..7b32b72bd1 100644 --- a/src/Makefile.bench.include +++ b/src/Makefile.bench.include @@ -34,8 +34,8 @@ nodist_bench_bench_bitcoin_SOURCES = $(GENERATED_BENCH_FILES) bench_bench_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CLFAGS) $(EVENT_PTHREADS_CFLAGS) -I$(builddir)/bench/ bench_bench_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) bench_bench_bitcoin_LDADD = \ - $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_WALLET) \ + $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_UTIL) \ $(LIBBITCOIN_CONSENSUS) \ diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 4b9abb2a1b..494a925a79 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2017 The Bitcoin Core developers +// Copyright (c) 2009-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/src/index/base.cpp b/src/index/base.cpp index 738166dc94..788f7adccd 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index e106b9b420..c85030e18e 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -3,7 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include -#include +#include #include #include #include diff --git a/src/init.cpp b/src/init.cpp index 1b5507703c..e8a5bd2f21 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2017 The Bitcoin Core developers +// Copyright (c) 2009-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -35,6 +35,7 @@ #include