Bitcoin full node and query server

Nov 28, 2025

View in context in the libbitcoin Slack #general mirror.

evoskuil21:53
Here's an example of the request parser doing it's thing in one line (path_to_request):
BOOST_AUTO_TEST_CASE(path_to_request__block_tx_height_valid__expected)
{
    request_t request{};
    BOOST_REQUIRE(!path_to_request(request, "/v42/block/height/123456/transaction/7"));
    BOOST_REQUIRE_EQUAL(request.method, "block_tx");
    BOOST_REQUIRE(request.params.has_value());

    const auto& params = request.params.value();
    BOOST_REQUIRE(std::holds_alternative<object_t>(params));

    const auto& object = std::get<object_t>(request.params.value());
    BOOST_REQUIRE_EQUAL(object.size(), 3u);

    const auto version = std::get<uint8_t>(object.at("version").value());
    BOOST_REQUIRE_EQUAL(version, 42u);

    const auto height = std::get<uint32_t>(object.at("height").value());
    BOOST_REQUIRE_EQUAL(height, 123456u);

    const auto position = std::get<uint32_t>(object.at("position").value());
    BOOST_REQUIRE_EQUAL(position, 7u);
}