Skip to content

Commit 781c01f

Browse files
committed
init: Check mempool arguments in AppInitParameterInteractions
This makes the handling more consistent and reports errors sooner.
1 parent 39219fe commit 781c01f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/init.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,13 @@ bool AppInitParameterInteraction(const ArgsManager& args)
10721072
if (!blockman_result) {
10731073
return InitError(util::ErrorString(blockman_result));
10741074
}
1075+
CTxMemPool::Options mempool_opts{
1076+
.check_ratio = chainparams.DefaultConsistencyChecks() ? 1 : 0,
1077+
};
1078+
auto mempool_result{ApplyArgsManOptions(args, chainparams, mempool_opts)};
1079+
if (!mempool_result) {
1080+
return InitError(util::ErrorString(mempool_result));
1081+
}
10751082
}
10761083

10771084
return true;
@@ -1543,10 +1550,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15431550
.check_ratio = chainparams.DefaultConsistencyChecks() ? 1 : 0,
15441551
.signals = &validation_signals,
15451552
};
1546-
auto result{ApplyArgsManOptions(args, chainparams, mempool_opts)};
1547-
if (!result) {
1548-
return InitError(util::ErrorString(result));
1549-
}
1553+
Assert(ApplyArgsManOptions(args, chainparams, mempool_opts)); // no error can happen, already checked in AppInitParameterInteraction
15501554

15511555
bool do_reindex{args.GetBoolArg("-reindex", false)};
15521556
const bool do_reindex_chainstate{args.GetBoolArg("-reindex-chainstate", false)};

0 commit comments

Comments
 (0)