mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
UPSTREAM MERGE BROKEN: Merge commit 'f617e05c38' into master
This commit is contained in:
commit
7f894ae00b
393 changed files with 7992 additions and 3340 deletions
81
src/init.cpp
81
src/init.cpp
|
|
@ -19,6 +19,7 @@
|
|||
#include <fs.h>
|
||||
#include <httpserver.h>
|
||||
#include <httprpc.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <index/txindex.h>
|
||||
#include <key.h>
|
||||
#include <mainchainrpc.h>
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
#include <rpc/server.h>
|
||||
#include <rpc/register.h>
|
||||
#include <rpc/blockchain.h>
|
||||
#include <rpc/util.h>
|
||||
#include <script/standard.h>
|
||||
#include <script/sigcache.h>
|
||||
#include <scheduler.h>
|
||||
|
|
@ -41,8 +43,8 @@
|
|||
#include <txmempool.h>
|
||||
#include <torcontrol.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util.h>
|
||||
#include <utilmoneystr.h>
|
||||
#include <util/system.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <utilstrencodings.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
|
|
@ -68,6 +70,7 @@
|
|||
#include <pegins.h>
|
||||
|
||||
#if ENABLE_ZMQ
|
||||
#include <zmq/zmqabstractnotifier.h>
|
||||
#include <zmq/zmqnotificationinterface.h>
|
||||
#include <zmq/zmqrpc.h>
|
||||
#endif
|
||||
|
|
@ -162,7 +165,7 @@ void Interrupt()
|
|||
}
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
void Shutdown(InitInterfaces& interfaces)
|
||||
{
|
||||
LogPrintf("%s: In progress...\n", __func__);
|
||||
static CCriticalSection cs_Shutdown;
|
||||
|
|
@ -181,7 +184,9 @@ void Shutdown()
|
|||
StopREST();
|
||||
StopRPC();
|
||||
StopHTTPServer();
|
||||
g_wallet_init_interface.Flush();
|
||||
for (const auto& client : interfaces.chain_clients) {
|
||||
client->flush();
|
||||
}
|
||||
StopMapPort();
|
||||
|
||||
// Because these depend on each-other, we make sure that neither can be
|
||||
|
|
@ -244,7 +249,9 @@ void Shutdown()
|
|||
pcoinsdbview.reset();
|
||||
pblocktree.reset();
|
||||
}
|
||||
g_wallet_init_interface.Stop();
|
||||
for (const auto& client : interfaces.chain_clients) {
|
||||
client->stop();
|
||||
}
|
||||
|
||||
#if ENABLE_ZMQ
|
||||
if (g_zmq_notification_interface) {
|
||||
|
|
@ -264,7 +271,7 @@ void Shutdown()
|
|||
UnregisterAllValidationInterfaces();
|
||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||
GetMainSignals().UnregisterWithMempoolSignals(mempool);
|
||||
g_wallet_init_interface.Close();
|
||||
interfaces.chain_clients.clear();
|
||||
globalVerifyHandle.reset();
|
||||
ECC_Stop();
|
||||
LogPrintf("%s: done\n", __func__);
|
||||
|
|
@ -328,8 +335,8 @@ void SetupServerArgs()
|
|||
const auto regtestChainParams = CreateChainParams(CBaseChainParams::REGTEST);
|
||||
|
||||
// Hidden Options
|
||||
std::vector<std::string> hidden_args = {"-rpcssl", "-benchmark", "-h", "-help", "-socks", "-tor", "-debugnet", "-whitelistalwaysrelay",
|
||||
"-prematurewitness", "-walletprematurewitness", "-promiscuousmempoolflags", "-blockminsize", "-dbcrashratio", "-forcecompactdb", "-usehd",
|
||||
std::vector<std::string> hidden_args = {"-h", "-help",
|
||||
"-dbcrashratio", "-forcecompactdb",
|
||||
// GUI args. These will be overwritten by SetupUIArgs for the GUI
|
||||
"-allowselfsignedrootcertificates", "-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-rootcertificates=<file>", "-splash", "-uiplatform"};
|
||||
|
||||
|
|
@ -424,11 +431,19 @@ void SetupServerArgs()
|
|||
gArgs.AddArg("-zmqpubhashtx=<address>", "Enable publish hash transaction in <address>", false, OptionsCategory::ZMQ);
|
||||
gArgs.AddArg("-zmqpubrawblock=<address>", "Enable publish raw block in <address>", false, OptionsCategory::ZMQ);
|
||||
gArgs.AddArg("-zmqpubrawtx=<address>", "Enable publish raw transaction in <address>", false, OptionsCategory::ZMQ);
|
||||
gArgs.AddArg("-zmqpubhashblockhwm=<n>", strprintf("Set publish hash block outbound message high water mark (default: %d)", CZMQAbstractNotifier::DEFAULT_ZMQ_SNDHWM), false, OptionsCategory::ZMQ);
|
||||
gArgs.AddArg("-zmqpubhashtxhwm=<n>", strprintf("Set publish hash transaction outbound message high water mark (default: %d)", CZMQAbstractNotifier::DEFAULT_ZMQ_SNDHWM), false, OptionsCategory::ZMQ);
|
||||
gArgs.AddArg("-zmqpubrawblockhwm=<n>", strprintf("Set publish raw block outbound message high water mark (default: %d)", CZMQAbstractNotifier::DEFAULT_ZMQ_SNDHWM), false, OptionsCategory::ZMQ);
|
||||
gArgs.AddArg("-zmqpubrawtxhwm=<n>", strprintf("Set publish raw transaction outbound message high water mark (default: %d)", CZMQAbstractNotifier::DEFAULT_ZMQ_SNDHWM), false, OptionsCategory::ZMQ);
|
||||
#else
|
||||
hidden_args.emplace_back("-zmqpubhashblock=<address>");
|
||||
hidden_args.emplace_back("-zmqpubhashtx=<address>");
|
||||
hidden_args.emplace_back("-zmqpubrawblock=<address>");
|
||||
hidden_args.emplace_back("-zmqpubrawtx=<address>");
|
||||
hidden_args.emplace_back("-zmqpubhashblockhwm=<n>");
|
||||
hidden_args.emplace_back("-zmqpubhashtxhwm=<n>");
|
||||
hidden_args.emplace_back("-zmqpubrawblockhwm=<n>");
|
||||
hidden_args.emplace_back("-zmqpubrawtxhwm=<n>");
|
||||
#endif
|
||||
|
||||
gArgs.AddArg("-checkblocks=<n>", strprintf("How many blocks to check at startup (default: %u, 0 = all)", DEFAULT_CHECKBLOCKS), true, OptionsCategory::DEBUG_TEST);
|
||||
|
|
@ -738,7 +753,7 @@ static void ThreadImport(std::vector<fs::path> vImportFiles)
|
|||
* Ensure that Bitcoin is running in a usable environment with all
|
||||
* necessary library support.
|
||||
*/
|
||||
static bool InitSanityCheck(void)
|
||||
static bool InitSanityCheck()
|
||||
{
|
||||
if(!ECC_InitSanityCheck()) {
|
||||
InitError("Elliptic curve cryptography sanity check failure. Aborting.");
|
||||
|
|
@ -1008,25 +1023,6 @@ bool AppInitParameterInteraction()
|
|||
}
|
||||
}
|
||||
|
||||
// Check for -debugnet
|
||||
if (gArgs.GetBoolArg("-debugnet", false))
|
||||
InitWarning(_("Unsupported argument -debugnet ignored, use -debug=net."));
|
||||
// Check for -socks - as this is a privacy risk to continue, exit here
|
||||
if (gArgs.IsArgSet("-socks"))
|
||||
return InitError(_("Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported."));
|
||||
// Check for -tor - as this is a privacy risk to continue, exit here
|
||||
if (gArgs.GetBoolArg("-tor", false))
|
||||
return InitError(_("Unsupported argument -tor found, use -onion."));
|
||||
|
||||
if (gArgs.GetBoolArg("-benchmark", false))
|
||||
InitWarning(_("Unsupported argument -benchmark ignored, use -debug=bench."));
|
||||
|
||||
if (gArgs.GetBoolArg("-whitelistalwaysrelay", false))
|
||||
InitWarning(_("Unsupported argument -whitelistalwaysrelay ignored, use -whitelistrelay and/or -whitelistforcerelay."));
|
||||
|
||||
if (gArgs.IsArgSet("-blockminsize"))
|
||||
InitWarning("Unsupported argument -blockminsize ignored.");
|
||||
|
||||
// Checkmempool and checkblockindex default to true in regtest mode
|
||||
int ratio = std::min<int>(std::max<int>(gArgs.GetArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000);
|
||||
if (ratio != 0) {
|
||||
|
|
@ -1231,7 +1227,7 @@ bool AppInitLockDataDirectory()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AppInitMain()
|
||||
bool AppInitMain(InitInterfaces& interfaces)
|
||||
{
|
||||
const CChainParams& chainparams = Params();
|
||||
// ********************************************************* Step 4a: application initialization
|
||||
|
|
@ -1297,11 +1293,20 @@ bool AppInitMain()
|
|||
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
|
||||
GetMainSignals().RegisterWithMempoolSignals(mempool);
|
||||
|
||||
// Create client interfaces for wallets that are supposed to be loaded
|
||||
// according to -wallet and -disablewallet options. This only constructs
|
||||
// the interfaces, it doesn't load wallet data. Wallets actually get loaded
|
||||
// when load() and start() interface methods are called below.
|
||||
g_wallet_init_interface.Construct(interfaces);
|
||||
|
||||
/* Register RPC commands regardless of -server setting so they will be
|
||||
* available in the GUI RPC console even if external calls are disabled.
|
||||
*/
|
||||
RegisterAllCoreRPCCommands(tableRPC);
|
||||
g_wallet_init_interface.RegisterRPC(tableRPC);
|
||||
for (const auto& client : interfaces.chain_clients) {
|
||||
client->registerRpcs();
|
||||
}
|
||||
g_rpc_interfaces = &interfaces;
|
||||
#if ENABLE_ZMQ
|
||||
RegisterZMQRPCCommands(tableRPC);
|
||||
#endif
|
||||
|
|
@ -1322,7 +1327,11 @@ bool AppInitMain()
|
|||
}
|
||||
|
||||
// ********************************************************* Step 5: verify wallet database integrity
|
||||
if (!g_wallet_init_interface.Verify()) return false;
|
||||
for (const auto& client : interfaces.chain_clients) {
|
||||
if (!client->verify()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************* Step 6: network initialization
|
||||
// Note that we absolutely cannot open any actual connections
|
||||
|
|
@ -1641,7 +1650,11 @@ bool AppInitMain()
|
|||
}
|
||||
|
||||
// ********************************************************* Step 9: load wallet
|
||||
if (!g_wallet_init_interface.Open()) return false;
|
||||
for (const auto& client : interfaces.chain_clients) {
|
||||
if (!client->load()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************* Step 10: data directory maintenance
|
||||
|
||||
|
|
@ -1880,7 +1893,9 @@ bool AppInitMain()
|
|||
|
||||
uiInterface.InitMessage(_("Done loading"));
|
||||
|
||||
g_wallet_init_interface.Start(scheduler);
|
||||
for (const auto& client : interfaces.chain_clients) {
|
||||
client->start(scheduler);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue