who cares

This commit is contained in:
dr7ana 2023-12-11 13:45:35 -08:00
parent cece742cf3
commit 7544436f6a
8 changed files with 24 additions and 11 deletions

@ -1 +1 @@
Subproject commit fdc92554a40414fdcdea1fa1bd84b2c827d21b1c
Subproject commit ad8904debc55f9495667e8571ee5bb963156d54e

View File

@ -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;

View File

@ -1,6 +1,7 @@
#pragma once
#include "common.hpp"
#include <llarp/util/logging/buffer.hpp>
namespace llarp

View File

@ -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)
{

View File

@ -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

View File

@ -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}}

View File

@ -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"};