chore: fix warnings (#509)

Co-authored-by: Denis Angell <dangell@transia.co>
Co-authored-by: RichardAH <richard.holland@starstone.co.nz>
This commit is contained in:
Niq Dudfield
2025-10-11 08:47:13 +07:00
committed by GitHub
parent e580f7cfc0
commit ad0531ad6c
2 changed files with 7 additions and 8 deletions

View File

@@ -221,7 +221,8 @@ public:
if (!ledger->info().accountHash.isNonZero())
{
JLOG(j.fatal()) << "AH is zero: " << getJson({*ledger, {}});
JLOG(j.fatal())
<< "AH is zero: " << getJson({*ledger, {}}).asString();
assert(false);
}

View File

@@ -239,19 +239,17 @@ verifyHandshake(
throw std::runtime_error("Invalid server domain");
}
// Check the network. Omitting Network-ID (on either side ours, or theirs)
// means NID=0
// Check network ID, treating absent/empty as default network 0
{
uint32_t peer_nid = 0;
std::uint32_t nid{0};
if (auto const iter = headers.find("Network-ID"); iter != headers.end())
{
if (!beast::lexicalCastChecked(
peer_nid, std::string(iter->value())))
if (!beast::lexicalCastChecked(nid, std::string(iter->value())))
throw std::runtime_error("Invalid peer network identifier");
}
uint32_t our_nid = networkID ? *networkID : 0;
if (peer_nid != our_nid)
if (networkID.value_or(0) != nid)
throw std::runtime_error("Peer is on a different network");
}