mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
who cares
This commit is contained in:
parent
cece742cf3
commit
7544436f6a
2
external/oxen-libquic
vendored
2
external/oxen-libquic
vendored
@ -1 +1 @@
|
||||
Subproject commit fdc92554a40414fdcdea1fa1bd84b2c827d21b1c
|
||||
Subproject commit ad8904debc55f9495667e8571ee5bb963156d54e
|
@ -646,7 +646,6 @@ namespace llarp
|
||||
assert(_router.is_service_node());
|
||||
log::critical(logcat, "Handling fetch bootstrap fetch request...");
|
||||
|
||||
const auto& rcs = node_db->get_rcs();
|
||||
RemoteRC remote;
|
||||
size_t quantity;
|
||||
|
||||
@ -668,7 +667,16 @@ namespace llarp
|
||||
|
||||
node_db->put_rc(remote);
|
||||
|
||||
auto rc_size = rcs.size();
|
||||
auto& bootstraps = node_db->bootstrap_list();
|
||||
auto count = bootstraps.size();
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
log::error(logcat, "No bootstraps locally to send!");
|
||||
m.respond(messages::ERROR_RESPONSE, true);
|
||||
return;
|
||||
}
|
||||
|
||||
auto now = llarp::time_now_ms();
|
||||
size_t i = 0;
|
||||
|
||||
@ -679,7 +687,7 @@ namespace llarp
|
||||
|
||||
while (i < quantity)
|
||||
{
|
||||
auto& next_rc = *std::next(rcs.begin(), csrng() % rc_size);
|
||||
auto& next_rc = bootstraps.next();
|
||||
|
||||
if (next_rc.is_expired(now))
|
||||
continue;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#include <llarp/util/logging/buffer.hpp>
|
||||
|
||||
namespace llarp
|
||||
|
@ -671,8 +671,7 @@ namespace llarp
|
||||
|
||||
_router.link_manager().fetch_bootstrap_rcs(
|
||||
_bootstraps->current(),
|
||||
BootstrapFetchMessage::serialize(
|
||||
_router.router_contact, BOOTSTRAP_SOURCE_COUNT),
|
||||
BootstrapFetchMessage::serialize(_router.router_contact, BOOTSTRAP_SOURCE_COUNT),
|
||||
[this](oxen::quic::message m) mutable {
|
||||
if (not m)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ namespace llarp
|
||||
inline constexpr double GOOD_RID_FETCH_THRESHOLD{};
|
||||
/* Bootstrap Constants */
|
||||
// the number of rc's we query the bootstrap for
|
||||
inline constexpr size_t BOOTSTRAP_SOURCE_COUNT{50};
|
||||
inline constexpr size_t BOOTSTRAP_SOURCE_COUNT{10};
|
||||
// the maximum number of fetch requests we make across all bootstraps
|
||||
inline constexpr int MAX_BOOTSTRAP_FETCH_ATTEMPTS{5};
|
||||
// if all bootstraps fail, router will trigger re-bootstrapping after this cooldown
|
||||
|
@ -63,8 +63,8 @@ namespace llarp
|
||||
|
||||
auto pubkey = data.require<std::string_view>("p");
|
||||
if (pubkey.size() != 32)
|
||||
throw std::runtime_error{
|
||||
"Invalid RC pubkey: expected 32 bytes, got {}"_format(pubkey.size())};
|
||||
throw std::runtime_error{
|
||||
"Invalid RC pubkey: expected 32 bytes, got {}"_format(pubkey.size())};
|
||||
std::memcpy(_router_id.data(), pubkey.data(), 32);
|
||||
|
||||
// auto pk = data.require<std::string_view>("p");
|
||||
|
@ -315,6 +315,7 @@ namespace llarp
|
||||
bt_verify(oxenc::bt_dict_consumer& data, bool reject_expired = false) const;
|
||||
|
||||
explicit RemoteRC(oxenc::bt_dict_consumer btdc);
|
||||
|
||||
public:
|
||||
RemoteRC() = default;
|
||||
explicit RemoteRC(std::string_view data) : RemoteRC{oxenc::bt_dict_consumer{data}}
|
||||
|
@ -47,8 +47,12 @@ namespace llarp
|
||||
throw std::runtime_error{err};
|
||||
}
|
||||
|
||||
log::error(log::Cat("FIXME"), "ABOUT TO VERIFY THIS: {}, WITH SIG {}, SIGNED BY {}",
|
||||
oxenc::to_hex(msg), oxenc::to_hex(sig), router_id().ToHex());
|
||||
log::error(
|
||||
log::Cat("FIXME"),
|
||||
"ABOUT TO VERIFY THIS: {}, WITH SIG {}, SIGNED BY {}",
|
||||
oxenc::to_hex(msg),
|
||||
oxenc::to_hex(sig),
|
||||
router_id().ToHex());
|
||||
|
||||
if (not crypto::verify(router_id(), msg, sig))
|
||||
throw std::runtime_error{"Failed to verify RemoteRC signature"};
|
||||
|
Loading…
Reference in New Issue
Block a user