Deprecate 'Time to Live' fields

This commit is contained in:
Nik Bougalis
2020-03-04 22:31:53 -08:00
parent 2bf3b194fa
commit 567e42e071
5 changed files with 14 additions and 23 deletions

View File

@@ -72,7 +72,6 @@ public:
explicit Setup() = default;
std::shared_ptr<boost::asio::ssl::context> context;
bool expire = false;
beast::IP::Address public_ip;
int ipLimit = 0;
std::uint32_t crawlOptions = 0;

View File

@@ -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<Message>(m, protocol::mtPROPOSE_LEDGER);
for_each([&](std::shared_ptr<PeerImp>&& p) { p->send(sm); });
}
void
OverlayImpl::send(protocol::TMValidation& m)
{
if (setup_.expire)
m.set_hops(0);
auto const sm = std::make_shared<Message>(m, protocol::mtVALIDATION);
for_each([&](std::shared_ptr<PeerImp>&& 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<Message>(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<bool>(section, "expire", false);
set(setup.ipLimit, "ip_limit", section);
if (setup.ipLimit < 0)

View File

@@ -52,8 +52,6 @@ namespace ripple {
class PeerImp;
class BasicConfig;
constexpr std::uint32_t maxTTL = 2;
class OverlayImpl : public Overlay
{
public:

View File

@@ -1605,9 +1605,6 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProposeSet> 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<protocol::TMValidation> 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";

View File

@@ -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