Compare commits

..

1 Commits

Author SHA1 Message Date
Denis Angell
105790e61d add logs 2025-08-18 12:30:23 +02:00
3 changed files with 13 additions and 9 deletions

View File

@@ -339,7 +339,7 @@ LedgerHistory::handleMismatch(
assert(builtLedger->info().seq == validLedger->info().seq); assert(builtLedger->info().seq == validLedger->info().seq);
if (auto stream = j_.debug()) if (auto stream = j_.error())
{ {
stream << "Built: " << getJson({*builtLedger, {}}); stream << "Built: " << getJson({*builtLedger, {}});
stream << "Valid: " << getJson({*validLedger, {}}); stream << "Valid: " << getJson({*validLedger, {}});

View File

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

View File

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