From bf504912a4a67f7935e49fc0d4ed3f94d7a1a5f6 Mon Sep 17 00:00:00 2001 From: Vlad <129996061+vvysokikh1@users.noreply.github.com> Date: Tue, 18 Mar 2025 13:03:03 +0000 Subject: [PATCH] fix: trust line RPC no ripple flag (#5345) The Trustline RPC `no_ripple` flag gets set depending on `lsfDefaultRipple` flag, which is not a flag of a trustline but of the account root. The `lsfDefaultRipple` flag does not provide any insight if this particular trust line has `lsfLowNoRipple` or `lsfHighNoRipple` flag set, so it should not be used here at all. This change simplifies the logic. --- src/test/rpc/AccountLines_test.cpp | 4 ++++ src/xrpld/app/paths/TrustLine.h | 6 ------ src/xrpld/rpc/handlers/AccountLines.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/test/rpc/AccountLines_test.cpp b/src/test/rpc/AccountLines_test.cpp index 79e4bf214f..6e6f0def19 100644 --- a/src/test/rpc/AccountLines_test.cpp +++ b/src/test/rpc/AccountLines_test.cpp @@ -250,6 +250,10 @@ public: gw1.human() + R"("})"); BEAST_EXPECT(lines[jss::result][jss::lines].isArray()); BEAST_EXPECT(lines[jss::result][jss::lines].size() == 26); + + // Check no ripple is not set for trustlines between alice and gw1 + auto const& line = lines[jss::result][jss::lines][0u]; + BEAST_EXPECT(!line[jss::no_ripple].isMember(jss::no_ripple)); } { // Use a malformed peer. diff --git a/src/xrpld/app/paths/TrustLine.h b/src/xrpld/app/paths/TrustLine.h index 37cdc750f3..efbe281f5e 100644 --- a/src/xrpld/app/paths/TrustLine.h +++ b/src/xrpld/app/paths/TrustLine.h @@ -101,12 +101,6 @@ public: return mFlags & (!mViewLowest ? lsfLowAuth : lsfHighAuth); } - bool - getDefaultRipple() const - { - return mFlags & lsfDefaultRipple; - } - bool getNoRipple() const { diff --git a/src/xrpld/rpc/handlers/AccountLines.cpp b/src/xrpld/rpc/handlers/AccountLines.cpp index 7afb00c8de..e921eee386 100644 --- a/src/xrpld/rpc/handlers/AccountLines.cpp +++ b/src/xrpld/rpc/handlers/AccountLines.cpp @@ -54,10 +54,10 @@ addLine(Json::Value& jsonLines, RPCTrustLine const& line) jPeer[jss::authorized] = true; if (line.getAuthPeer()) jPeer[jss::peer_authorized] = true; - if (line.getNoRipple() || !line.getDefaultRipple()) - jPeer[jss::no_ripple] = line.getNoRipple(); - if (line.getNoRipplePeer() || !line.getDefaultRipple()) - jPeer[jss::no_ripple_peer] = line.getNoRipplePeer(); + if (line.getNoRipple()) + jPeer[jss::no_ripple] = true; + if (line.getNoRipplePeer()) + jPeer[jss::no_ripple_peer] = true; if (line.getFreeze()) jPeer[jss::freeze] = true; if (line.getFreezePeer())