mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-21 14:22:38 +02:00
refactor: Remove unused EnsureChainman
This commit is contained in:
parent
fa34587f1c
commit
fab80fef61
@ -50,6 +50,7 @@
|
|||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
#include <ui_interface.h>
|
#include <ui_interface.h>
|
||||||
#include <util/asmap.h>
|
#include <util/asmap.h>
|
||||||
|
#include <util/check.h>
|
||||||
#include <util/moneystr.h>
|
#include <util/moneystr.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
@ -1377,9 +1378,9 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
|
|||||||
node.mempool = &::mempool;
|
node.mempool = &::mempool;
|
||||||
assert(!node.chainman);
|
assert(!node.chainman);
|
||||||
node.chainman = &g_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());
|
RegisterValidationInterface(node.peer_logic.get());
|
||||||
|
|
||||||
// sanitize comments per BIP-0014, format user agent and check total size
|
// sanitize comments per BIP-0014, format user agent and check total size
|
||||||
|
@ -49,10 +49,4 @@ struct NodeContext {
|
|||||||
~NodeContext();
|
~NodeContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline ChainstateManager& EnsureChainman(const NodeContext& node)
|
|
||||||
{
|
|
||||||
assert(node.chainman);
|
|
||||||
return *node.chainman;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // BITCOIN_NODE_CONTEXT_H
|
#endif // BITCOIN_NODE_CONTEXT_H
|
||||||
|
@ -75,7 +75,10 @@ CTxMemPool& EnsureMemPool(const util::Ref& context)
|
|||||||
ChainstateManager& EnsureChainman(const util::Ref& context)
|
ChainstateManager& EnsureChainman(const util::Ref& context)
|
||||||
{
|
{
|
||||||
NodeContext& node = EnsureNodeContext(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.
|
/* Calculate the difficulty for a given block index.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user