mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge 03b1db6114 into merged_master (Bitcoin PR #18766)
This commit is contained in:
commit
7a7791e879
15 changed files with 75 additions and 53 deletions
41
src/init.cpp
41
src/init.cpp
|
|
@ -88,7 +88,6 @@
|
|||
#include <zmq/zmqrpc.h>
|
||||
#endif
|
||||
|
||||
static bool fFeeEstimatesInitialized = false;
|
||||
static const bool DEFAULT_PROXYRANDOMIZE = true;
|
||||
static const bool DEFAULT_REST_ENABLE = false;
|
||||
static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
|
||||
|
|
@ -102,8 +101,6 @@ static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
|
|||
#define MIN_CORE_FILEDESCRIPTORS 150
|
||||
#endif
|
||||
|
||||
static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
|
||||
|
||||
static const char* DEFAULT_ASMAP_FILENAME="ip_asn.map";
|
||||
|
||||
/**
|
||||
|
|
@ -244,17 +241,8 @@ void Shutdown(NodeContext& node)
|
|||
DumpMempool(*node.mempool);
|
||||
}
|
||||
|
||||
if (fFeeEstimatesInitialized)
|
||||
{
|
||||
::feeEstimator.FlushUnconfirmed();
|
||||
fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
|
||||
CAutoFile est_fileout(fsbridge::fopen(est_path, "wb"), SER_DISK, CLIENT_VERSION);
|
||||
if (!est_fileout.IsNull())
|
||||
::feeEstimator.Write(est_fileout);
|
||||
else
|
||||
LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, est_path.string());
|
||||
fFeeEstimatesInitialized = false;
|
||||
}
|
||||
// Drop transactions we were still watching, and record fee estimations.
|
||||
if (node.fee_estimator) node.fee_estimator->Flush();
|
||||
|
||||
// FlushStateToDisk generates a ChainStateFlushed callback, which we should avoid missing
|
||||
if (node.chainman) {
|
||||
|
|
@ -312,6 +300,7 @@ void Shutdown(NodeContext& node)
|
|||
globalVerifyHandle.reset();
|
||||
ECC_Stop();
|
||||
node.mempool.reset();
|
||||
node.fee_estimator.reset();
|
||||
node.chainman = nullptr;
|
||||
node.scheduler.reset();
|
||||
node.reverification_scheduler.reset();
|
||||
|
|
@ -1442,14 +1431,24 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
|
|||
// is not yet setup and may end up being set up twice if we
|
||||
// need to reindex later.
|
||||
|
||||
// see Step 2: parameter interactions for more information about these
|
||||
fListen = args.GetBoolArg("-listen", DEFAULT_LISTEN);
|
||||
fDiscover = args.GetBoolArg("-discover", true);
|
||||
g_relay_txes = !args.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
|
||||
|
||||
assert(!node.banman);
|
||||
node.banman = MakeUnique<BanMan>(GetDataDir() / "banlist.dat", &uiInterface, args.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME));
|
||||
assert(!node.connman);
|
||||
node.connman = MakeUnique<CConnman>(GetRand(std::numeric_limits<uint64_t>::max()), GetRand(std::numeric_limits<uint64_t>::max()), args.GetBoolArg("-networkactive", true));
|
||||
|
||||
assert(!node.fee_estimator);
|
||||
// Don't initialize fee estimation with old data if we don't relay transactions,
|
||||
// as they would never get updated.
|
||||
if (g_relay_txes) node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
|
||||
|
||||
assert(!node.mempool);
|
||||
int check_ratio = std::min<int>(std::max<int>(args.GetArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000);
|
||||
node.mempool = MakeUnique<CTxMemPool>(&::feeEstimator, check_ratio);
|
||||
node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator.get(), check_ratio);
|
||||
|
||||
assert(!node.chainman);
|
||||
node.chainman = &g_chainman;
|
||||
|
|
@ -1531,11 +1530,6 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
|
|||
}
|
||||
}
|
||||
|
||||
// see Step 2: parameter interactions for more information about these
|
||||
fListen = args.GetBoolArg("-listen", DEFAULT_LISTEN);
|
||||
fDiscover = args.GetBoolArg("-discover", true);
|
||||
g_relay_txes = !args.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
|
||||
|
||||
for (const std::string& strAddr : args.GetArgs("-externalip")) {
|
||||
CService addrLocal;
|
||||
if (Lookup(strAddr, addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
|
||||
|
|
@ -1843,13 +1837,6 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
|
|||
return false;
|
||||
}
|
||||
|
||||
fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
|
||||
CAutoFile est_filein(fsbridge::fopen(est_path, "rb"), SER_DISK, CLIENT_VERSION);
|
||||
// Allowed to fail as this file IS missing on first startup.
|
||||
if (!est_filein.IsNull())
|
||||
::feeEstimator.Read(est_filein);
|
||||
fFeeEstimatesInitialized = true;
|
||||
|
||||
// ********************************************************* Step 8: start indexers
|
||||
if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) {
|
||||
g_txindex = MakeUnique<TxIndex>(nTxIndexCache, false, fReindex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue