From 567e42e071662720e15ed3d543f0a0341a2ac422 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Wed, 4 Mar 2020 22:31:53 -0800 Subject: [PATCH] Deprecate 'Time to Live' fields --- src/ripple/overlay/Overlay.h | 1 - src/ripple/overlay/impl/OverlayImpl.cpp | 9 --------- src/ripple/overlay/impl/OverlayImpl.h | 2 -- src/ripple/overlay/impl/PeerImp.cpp | 6 ------ src/ripple/proto/ripple.proto | 19 ++++++++++++++----- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/ripple/overlay/Overlay.h b/src/ripple/overlay/Overlay.h index 34498c0ed7..eb1c74e1b8 100644 --- a/src/ripple/overlay/Overlay.h +++ b/src/ripple/overlay/Overlay.h @@ -72,7 +72,6 @@ public: explicit Setup() = default; std::shared_ptr context; - bool expire = false; beast::IP::Address public_ip; int ipLimit = 0; std::uint32_t crawlOptions = 0; diff --git a/src/ripple/overlay/impl/OverlayImpl.cpp b/src/ripple/overlay/impl/OverlayImpl.cpp index 14fb679174..685b60a2f0 100644 --- a/src/ripple/overlay/impl/OverlayImpl.cpp +++ b/src/ripple/overlay/impl/OverlayImpl.cpp @@ -1186,16 +1186,12 @@ OverlayImpl::findPeerByPublicKey(PublicKey const& pubKey) void OverlayImpl::send(protocol::TMProposeSet& m) { - if (setup_.expire) - m.set_hops(0); auto const sm = std::make_shared(m, protocol::mtPROPOSE_LEDGER); for_each([&](std::shared_ptr&& p) { p->send(sm); }); } void OverlayImpl::send(protocol::TMValidation& m) { - if (setup_.expire) - m.set_hops(0); auto const sm = std::make_shared(m, protocol::mtVALIDATION); for_each([&](std::shared_ptr&& p) { p->send(sm); }); @@ -1212,8 +1208,6 @@ OverlayImpl::send(protocol::TMValidation& m) void OverlayImpl::relay(protocol::TMProposeSet& m, uint256 const& uid) { - if (m.has_hops() && m.hops() >= maxTTL) - return; if (auto const toSkip = app_.getHashRouter().shouldRelay(uid)) { auto const sm = @@ -1228,8 +1222,6 @@ OverlayImpl::relay(protocol::TMProposeSet& m, uint256 const& uid) void OverlayImpl::relay(protocol::TMValidation& m, uint256 const& uid) { - if (m.has_hops() && m.hops() >= maxTTL) - return; if (auto const toSkip = app_.getHashRouter().shouldRelay(uid)) { auto const sm = std::make_shared(m, protocol::mtVALIDATION); @@ -1335,7 +1327,6 @@ setup_Overlay(BasicConfig const& config) { auto const& section = config.section("overlay"); setup.context = make_SSLContext(""); - setup.expire = get(section, "expire", false); set(setup.ipLimit, "ip_limit", section); if (setup.ipLimit < 0) diff --git a/src/ripple/overlay/impl/OverlayImpl.h b/src/ripple/overlay/impl/OverlayImpl.h index a87db3cc31..5f4f6e90ee 100644 --- a/src/ripple/overlay/impl/OverlayImpl.h +++ b/src/ripple/overlay/impl/OverlayImpl.h @@ -52,8 +52,6 @@ namespace ripple { class PeerImp; class BasicConfig; -constexpr std::uint32_t maxTTL = 2; - class OverlayImpl : public Overlay { public: diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index 6a780f1c23..61f749396f 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -1605,9 +1605,6 @@ PeerImp::onMessage(std::shared_ptr const& m) { protocol::TMProposeSet& set = *m; - if (set.has_hops() && !cluster()) - set.set_hops(set.hops() + 1); - auto const sig = makeSlice(set.signature()); // Preliminary check for the validity of the signature: A DER encoded @@ -2111,9 +2108,6 @@ PeerImp::onMessage(std::shared_ptr const& m) { auto const closeTime = app_.timeKeeper().closeTime(); - if (m->has_hops() && !cluster()) - m->set_hops(m->hops() + 1); - if (m->validation().size() < 50) { JLOG(p_journal_.warn()) << "Validation: Too small"; diff --git a/src/ripple/proto/ripple.proto b/src/ripple/proto/ripple.proto index 471a25338e..6038dac10a 100644 --- a/src/ripple/proto/ripple.proto +++ b/src/ripple/proto/ripple.proto @@ -179,10 +179,14 @@ message TMProposeSet required uint32 closeTime = 4; required bytes signature = 5; // signature of above fields required bytes previousledger = 6; - optional bool checkedSignature = 7; // node vouches signature is correct repeated bytes addedTransactions = 10; // not required if number is large repeated bytes removedTransactions = 11; // not required if number is large - optional uint32 hops = 12; // Number of hops traveled + + // node vouches signature is correct + optional bool checkedSignature = 7 [deprecated=true]; + + // Number of hops traveled + optional uint32 hops = 12 [deprecated=true]; } enum TxSetStatus @@ -210,9 +214,14 @@ message TMValidatorList // Used to sign a final closed ledger after reprocessing message TMValidation { - required bytes validation = 1; // in STValidation signed form - optional bool checkedSignature = 2; // node vouches signature is correct - optional uint32 hops = 3; // Number of hops traveled + // The serialized validation + required bytes validation = 1; + + // node vouches signature is correct + optional bool checkedSignature = 2 [deprecated = true]; + + // Number of hops traveled + optional uint32 hops = 3 [deprecated = true]; } message TMIPv4Endpoint