From fdc2a0e5a6aded5669d9f1d8fb69e8e6b6b9139f Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Thu, 8 May 2025 09:02:24 +0200 Subject: [PATCH] remove cosmetic changes --- src/ripple/app/rdb/backend/RWDBDatabase.h | 3 +-- src/ripple/overlay/impl/Handshake.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ripple/app/rdb/backend/RWDBDatabase.h b/src/ripple/app/rdb/backend/RWDBDatabase.h index 593e12348..3981691bc 100644 --- a/src/ripple/app/rdb/backend/RWDBDatabase.h +++ b/src/ripple/app/rdb/backend/RWDBDatabase.h @@ -224,8 +224,7 @@ public: if (!ledger->info().accountHash.isNonZero()) { - JLOG(j.fatal()) - << "AH is zero: " << getJson({*ledger, {}}).asString(); + JLOG(j.fatal()) << "AH is zero: " << getJson({*ledger, {}}); assert(false); } diff --git a/src/ripple/overlay/impl/Handshake.cpp b/src/ripple/overlay/impl/Handshake.cpp index 5aa6ade58..11b75e28d 100644 --- a/src/ripple/overlay/impl/Handshake.cpp +++ b/src/ripple/overlay/impl/Handshake.cpp @@ -239,7 +239,8 @@ verifyHandshake( 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 { uint32_t peer_nid = 0; if (auto const iter = headers.find("Network-ID"); iter != headers.end()) @@ -249,10 +250,8 @@ verifyHandshake( throw std::runtime_error("Invalid peer network identifier"); } - if (!beast::lexicalCastChecked(peer_nid, std::string(iter->value()))) - throw std::runtime_error("Invalid peer network identifier"); - - if (networkID && peer_nid != *networkID) + uint32_t our_nid = networkID ? *networkID : 0; + if (peer_nid != our_nid) throw std::runtime_error("Peer is on a different network"); }