Skip to content

discv4/discv4_enr_response.hpp

Namespaces

Name
discv4

Classes

Name
struct discv4::ForkId
Fork identifier per EIP-2124.
struct discv4::discv4_enr_response
Parsed ENRResponse — discv4 wire type 0x06 (EIP-868).

Source code

// Copyright 2025 GeniusVentures
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <array>
#include <cstdint>
#include <vector>

#include <rlp/common.hpp>
#include <rlp/rlp_decoder.hpp>
#include <discv4/discv4_constants.hpp>

namespace discv4 {

struct ForkId
{
    std::array<uint8_t, 4U> hash{};  
    uint64_t                next{};  

    bool operator==( const ForkId& other ) const noexcept
    {
        return hash == other.hash && next == other.next;
    }
};

struct discv4_enr_response
{
    std::array<uint8_t, kWireHashSize> request_hash{};

    std::vector<uint8_t> record_rlp{};

    [[nodiscard]] static rlp::Result<discv4_enr_response> Parse( rlp::ByteView raw ) noexcept;

    [[nodiscard]] rlp::Result<ForkId> ParseEthForkId() const noexcept;
};

} // namespace discv4

Updated on 2026-04-13 at 23:22:46 -0700