refactor: Remove unused EnsureChainman

pull/764/head
MarcoFalke 4 years ago
parent fa34587f1c
commit fab80fef61
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -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…
Cancel
Save