MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetChainman

Function GetChainman

src/rest.cpp:126–138  ·  view source on GitHub ↗

* Get the node context chainstatemanager. * * @param[in] req The HTTP request, whose status code will be set if node * context chainstatemanager is not found. * @returns Pointer to the chainstatemanager or nullptr if none found. */

Source from the content-addressed store, hash-verified

124 * @returns Pointer to the chainstatemanager or nullptr if none found.
125 */
126static ChainstateManager* GetChainman(const std::any& context, HTTPRequest* req)
127{
128 auto node_context = util::AnyPtr<NodeContext>(context);
129 if (!node_context || !node_context->chainman) {
130 RESTERR(req, HTTP_INTERNAL_SERVER_ERROR,
131 strprintf("%s:%d (%s)\n"
132 "Internal bug detected: Chainman disabled or instance not found!\n"
133 "You may report this issue here: %s\n",
134 __FILE__, __LINE__, __func__, PACKAGE_BUGREPORT));
135 return nullptr;
136 }
137 return node_context->chainman.get();
138}
139
140static RetFormat ParseDataFormat(std::string& param, const std::string& strReq)
141{

Callers 6

rest_headersFunction · 0.85
rest_blockFunction · 0.85
rest_filter_headerFunction · 0.85
rest_block_filterFunction · 0.85
rest_getutxosFunction · 0.85
rest_blockhash_by_heightFunction · 0.85

Calls 2

RESTERRFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected