mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
refactor: Remove unused EnsureChainman
This commit is contained in:
parent
fa34587f1c
commit
fab80fef61
3 changed files with 7 additions and 9 deletions
|
@ -50,6 +50,7 @@
|
|||
#include <txmempool.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/asmap.h>
|
||||
#include <util/check.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/string.h>
|
||||
#include <util/system.h>
|
||||
|
@ -1377,9 +1378,9 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
|
|||
node.mempool = &::mempool;
|
||||
assert(!node.chainman);
|
||||
node.chainman = &g_chainman;
|
||||
ChainstateManager& chainman = EnsureChainman(node);
|
||||
ChainstateManager& chainman = *Assert(node.chainman);
|
||||
|
||||
node.peer_logic.reset(new PeerLogicValidation(node.connman.get(), node.banman.get(), *node.scheduler, *node.chainman, *node.mempool));
|
||||
node.peer_logic.reset(new PeerLogicValidation(node.connman.get(), node.banman.get(), *node.scheduler, chainman, *node.mempool));
|
||||
RegisterValidationInterface(node.peer_logic.get());
|
||||
|
||||
// sanitize comments per BIP-0014, format user agent and check total size
|
||||
|
|
|
@ -49,10 +49,4 @@ struct NodeContext {
|
|||
~NodeContext();
|
||||
};
|
||||
|
||||
inline ChainstateManager& EnsureChainman(const NodeContext& node)
|
||||
{
|
||||
assert(node.chainman);
|
||||
return *node.chainman;
|
||||
}
|
||||
|
||||
#endif // BITCOIN_NODE_CONTEXT_H
|
||||
|
|
|
@ -75,7 +75,10 @@ CTxMemPool& EnsureMemPool(const util::Ref& context)
|
|||
ChainstateManager& EnsureChainman(const util::Ref& context)
|
||||
{
|
||||
NodeContext& node = EnsureNodeContext(context);
|
||||
return EnsureChainman(node);
|
||||
if (!node.chainman) {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Node chainman not found");
|
||||
}
|
||||
return *node.chainman;
|
||||
}
|
||||
|
||||
/* Calculate the difficulty for a given block index.
|
||||
|
|
Loading…
Reference in a new issue