* Get the node context. * * @param[in] req The HTTP request, whose status code will be set if node * context is not found. * @returns Pointer to the node context or nullptr if not found. */
| 86 | * @returns Pointer to the node context or nullptr if not found. |
| 87 | */ |
| 88 | static NodeContext* GetNodeContext(const std::any& context, HTTPRequest* req) |
| 89 | { |
| 90 | auto node_context = util::AnyPtr<NodeContext>(context); |
| 91 | if (!node_context) { |
| 92 | RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, |
| 93 | strprintf("%s:%d (%s)\n" |
| 94 | "Internal bug detected: Node context not found!\n" |
| 95 | "You may report this issue here: %s\n", |
| 96 | __FILE__, __LINE__, __func__, PACKAGE_BUGREPORT)); |
| 97 | return nullptr; |
| 98 | } |
| 99 | return node_context; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Get the node context mempool. |