mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
refactor: deduplicate ignores_incoming_txs
Initialize PeerManager::Options early to avoid reading -blocksonly twice.
This commit is contained in:
parent
5f41afcc46
commit
8a3159728a
1 changed files with 4 additions and 6 deletions
10
src/init.cpp
10
src/init.cpp
|
@ -1168,7 +1168,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
|
||||
fListen = args.GetBoolArg("-listen", DEFAULT_LISTEN);
|
||||
fDiscover = args.GetBoolArg("-discover", true);
|
||||
const bool ignores_incoming_txs{args.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)};
|
||||
|
||||
PeerManager::Options peerman_opts{};
|
||||
ApplyArgsManOptions(args, peerman_opts);
|
||||
|
||||
{
|
||||
|
||||
|
@ -1216,7 +1218,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
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 (!ignores_incoming_txs) {
|
||||
if (!peerman_opts.ignore_incoming_txs) {
|
||||
bool read_stale_estimates = args.GetBoolArg("-acceptstalefeeestimates", DEFAULT_ACCEPT_STALE_FEE_ESTIMATES);
|
||||
if (read_stale_estimates && (chainparams.GetChainType() != ChainType::REGTEST)) {
|
||||
return InitError(strprintf(_("acceptstalefeeestimates is not supported on %s chain."), chainparams.GetChainTypeString()));
|
||||
|
@ -1539,10 +1541,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
|
||||
ChainstateManager& chainman = *Assert(node.chainman);
|
||||
|
||||
|
||||
PeerManager::Options peerman_opts{};
|
||||
ApplyArgsManOptions(args, peerman_opts);
|
||||
|
||||
assert(!node.peerman);
|
||||
node.peerman = PeerManager::make(*node.connman, *node.addrman,
|
||||
node.banman.get(), chainman,
|
||||
|
|
Loading…
Add table
Reference in a new issue