Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable duplicate detector: #4438

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions src/ripple/overlay/impl/Handshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,36 +301,6 @@ verifyHandshake(
throw std::runtime_error("Bad node public key");
}();

if (publicKey == app.nodeIdentity().first)
{
auto const peerInstanceID = [&headers]() {
std::uint64_t iid = 0;

if (auto const iter = headers.find("Instance-Cookie");
iter != headers.end())
{
if (!beast::lexicalCastChecked(iid, iter->value().to_string()))
throw std::runtime_error("Invalid instance cookie");

if (iid == 0)
throw std::runtime_error("Invalid instance cookie");
}

return iid;
}();

// Attempt to differentiate self-connections as opposed to accidental
// node identity reuse caused by accidental misconfiguration. When we
// detect this, we stop the process and log an error message.
if (peerInstanceID != app.instanceID())
{
app.signalStop("Remote server is using our node identity");
throw std::runtime_error("Node identity reuse detected");
}

throw std::runtime_error("Self connection");
}

// This check gets two birds with one stone:
//
// 1) it verifies that the node we are talking to has access to the
Expand All @@ -349,6 +319,9 @@ verifyHandshake(
throw std::runtime_error("Failed to verify session");
}

if (publicKey == app.nodeIdentity().first)
throw std::runtime_error("Self connection");

if (auto const iter = headers.find("Local-IP"); iter != headers.end())
{
boost::system::error_code ec;
Expand Down