mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
init: don't create a CBlockPolicyEstimator if we don't relay transactions
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
parent
86ff2cf202
commit
e8ea6ad9c1
14
src/init.cpp
14
src/init.cpp
@ -1384,13 +1384,20 @@ 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);
|
||||
node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
|
||||
// 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);
|
||||
@ -1476,11 +1483,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())
|
||||
|
@ -13,6 +13,7 @@ from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_greater_than,
|
||||
assert_greater_than_or_equal,
|
||||
assert_raises_rpc_error,
|
||||
satoshi_round,
|
||||
)
|
||||
|
||||
@ -262,6 +263,11 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||
self.log.info("Final estimates after emptying mempools")
|
||||
check_estimates(self.nodes[1], self.fees_per_kb)
|
||||
|
||||
self.log.info("Testing that fee estimation is disabled in blocksonly.")
|
||||
self.restart_node(0, ["-blocksonly"])
|
||||
assert_raises_rpc_error(-32603, "Fee estimation disabled",
|
||||
self.nodes[0].estimatesmartfee, 2)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
EstimateFeeTest().main()
|
||||
|
Loading…
Reference in New Issue
Block a user