Skip to content

Commit 8a31597

Browse files
committed
refactor: deduplicate ignores_incoming_txs
Initialize PeerManager::Options early to avoid reading -blocksonly twice.
1 parent 5f41afc commit 8a31597

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/init.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
11681168

11691169
fListen = args.GetBoolArg("-listen", DEFAULT_LISTEN);
11701170
fDiscover = args.GetBoolArg("-discover", true);
1171-
const bool ignores_incoming_txs{args.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)};
1171+
1172+
PeerManager::Options peerman_opts{};
1173+
ApplyArgsManOptions(args, peerman_opts);
11721174

11731175
{
11741176

@@ -1216,7 +1218,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
12161218
assert(!node.fee_estimator);
12171219
// Don't initialize fee estimation with old data if we don't relay transactions,
12181220
// as they would never get updated.
1219-
if (!ignores_incoming_txs) {
1221+
if (!peerman_opts.ignore_incoming_txs) {
12201222
bool read_stale_estimates = args.GetBoolArg("-acceptstalefeeestimates", DEFAULT_ACCEPT_STALE_FEE_ESTIMATES);
12211223
if (read_stale_estimates && (chainparams.GetChainType() != ChainType::REGTEST)) {
12221224
return InitError(strprintf(_("acceptstalefeeestimates is not supported on %s chain."), chainparams.GetChainTypeString()));
@@ -1539,10 +1541,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15391541

15401542
ChainstateManager& chainman = *Assert(node.chainman);
15411543

1542-
1543-
PeerManager::Options peerman_opts{};
1544-
ApplyArgsManOptions(args, peerman_opts);
1545-
15461544
assert(!node.peerman);
15471545
node.peerman = PeerManager::make(*node.connman, *node.addrman,
15481546
node.banman.get(), chainman,

0 commit comments

Comments
 (0)