* 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. */
| 124 | * @returns Pointer to the chainstatemanager or nullptr if none found. |
| 125 | */ |
| 126 | static 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 | |
| 140 | static RetFormat ParseDataFormat(std::string& param, const std::string& strReq) |
| 141 | { |
no test coverage detected