Remove unused code

This commit is contained in:
Nik Bougalis
2021-03-18 23:31:17 -07:00
committed by manojsdoshi
parent 433feade5d
commit 4bedbd1d39
9 changed files with 23 additions and 222 deletions

View File

@@ -312,8 +312,6 @@ private:
std::size_t
getNeededValidations();
void
advanceThread();
void
fetchForHistory(
std::uint32_t missing,
bool& progress,

View File

@@ -1266,27 +1266,6 @@ LedgerMaster::consensusBuilt(
}
}
void
LedgerMaster::advanceThread()
{
std::unique_lock sl(m_mutex);
assert(!mValidLedger.empty() && mAdvanceThread);
JLOG(m_journal.trace()) << "advanceThread<";
try
{
doAdvance(sl);
}
catch (std::exception const&)
{
JLOG(m_journal.fatal()) << "doAdvance throws an exception";
}
mAdvanceThread = false;
JLOG(m_journal.trace()) << "advanceThread>";
}
std::optional<LedgerHash>
LedgerMaster::getLedgerHashForHistory(
LedgerIndex index,
@@ -1464,8 +1443,25 @@ LedgerMaster::tryAdvance()
if (!mAdvanceThread && !mValidLedger.empty())
{
mAdvanceThread = true;
app_.getJobQueue().addJob(
jtADVANCE, "advanceLedger", [this](Job&) { advanceThread(); });
app_.getJobQueue().addJob(jtADVANCE, "advanceLedger", [this](Job&) {
std::unique_lock sl(m_mutex);
assert(!mValidLedger.empty() && mAdvanceThread);
JLOG(m_journal.trace()) << "advanceThread<";
try
{
doAdvance(sl);
}
catch (std::exception const& ex)
{
JLOG(m_journal.fatal()) << "doAdvance throws: " << ex.what();
}
mAdvanceThread = false;
JLOG(m_journal.trace()) << "advanceThread>";
});
}
}

View File

@@ -42,15 +42,12 @@
#include <ripple/app/tx/apply.h>
#include <ripple/basics/PerfLog.h>
#include <ripple/basics/UptimeClock.h>
#include <ripple/basics/base64.h>
#include <ripple/basics/mulDiv.h>
#include <ripple/basics/safe_cast.h>
#include <ripple/beast/core/LexicalCast.h>
#include <ripple/beast/rfc2616.h>
#include <ripple/beast/utility/rngfill.h>
#include <ripple/consensus/Consensus.h>
#include <ripple/consensus/ConsensusParms.h>
#include <ripple/core/ConfigSections.h>
#include <ripple/crypto/RFC1751.h>
#include <ripple/crypto/csprng.h>
#include <ripple/json/to_string.h>

View File

@@ -1,114 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_APP_PATHS_NODEDIRECTORY_H_INCLUDED
#define RIPPLE_APP_PATHS_NODEDIRECTORY_H_INCLUDED
#include <ripple/ledger/ApplyView.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/STLedgerEntry.h>
namespace ripple {
// VFALCO TODO de-inline these function definitions
class NodeDirectory
{
public:
explicit NodeDirectory() = default;
// Current directory - the last 64 bits of this are the quality.
uint256 current;
// Start of the next order book - one past the worst quality possible
// for the current order book.
uint256 next;
// TODO(tom): directory.current and directory.next should be of type
// Directory.
bool advanceNeeded; // Need to advance directory.
bool restartNeeded; // Need to restart directory.
SLE::pointer ledgerEntry;
void
restart(bool multiQuality)
{
if (multiQuality)
current = beast::zero; // Restart book searching.
else
restartNeeded = true; // Restart at same quality.
}
bool
initialize(Book const& book, ApplyView& view)
{
if (current != beast::zero)
return false;
current = getBookBase(book);
next = getQualityNext(current);
// TODO(tom): it seems impossible that any actual offers with
// quality == 0 could occur - we should disallow them, and clear
// directory.ledgerEntry without the database call in the next line.
ledgerEntry = view.peek(keylet::page(current));
// Advance, if didn't find it. Normal not to be unable to lookup
// firstdirectory. Maybe even skip this lookup.
advanceNeeded = !ledgerEntry;
restartNeeded = false;
// Associated vars are dirty, if found it.
return bool(ledgerEntry);
}
enum Advance { NO_ADVANCE, NEW_QUALITY, END_ADVANCE };
/** Advance to the next quality directory in the order book. */
// VFALCO Consider renaming this to `nextQuality` or something
Advance
advance(ApplyView& view)
{
if (!(advanceNeeded || restartNeeded))
return NO_ADVANCE;
// Get next quality.
// The Merkel radix tree is ordered by key so we can go to the next
// quality in O(1).
if (advanceNeeded)
{
auto const opt = view.succ(current, next);
current = opt ? *opt : uint256{};
}
advanceNeeded = false;
restartNeeded = false;
if (current == beast::zero)
return END_ADVANCE;
ledgerEntry = view.peek(keylet::page(current));
return NEW_QUALITY;
}
};
} // namespace ripple
#endif

View File

@@ -22,7 +22,6 @@
#include <ripple/app/paths/Pathfinder.h>
#include <ripple/app/paths/RippleCalc.h>
#include <ripple/app/paths/RippleLineCache.h>
#include <ripple/app/paths/Tuning.h>
#include <ripple/app/paths/impl/PathfinderUtils.h>
#include <ripple/basics/Log.h>
#include <ripple/core/Config.h>
@@ -68,6 +67,10 @@ namespace ripple {
namespace {
// This is an arbitrary cutoff, and it might cause us to miss other
// good paths with this arbitrary cut off.
constexpr std::size_t PATHFINDER_MAX_COMPLETE_PATHS = 1000;
struct AccountCandidate
{
int priority;
@@ -318,8 +321,6 @@ Pathfinder::findPaths(int searchLevel)
{
addPathsForType(costedPath.type);
// TODO(tom): we might be missing other good paths with this
// arbitrary cut off.
if (mCompletePaths.size() > PATHFINDER_MAX_COMPLETE_PATHS)
break;
}

View File

@@ -19,7 +19,6 @@
#include <ripple/app/paths/Flow.h>
#include <ripple/app/paths/RippleCalc.h>
#include <ripple/app/paths/Tuning.h>
#include <ripple/app/paths/impl/FlowDebugInfo.h>
#include <ripple/basics/Log.h>
#include <ripple/ledger/View.h>

View File

@@ -1,36 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_APP_PATHS_TUNING_H_INCLUDED
#define RIPPLE_APP_PATHS_TUNING_H_INCLUDED
namespace ripple {
int const CALC_NODE_DELIVER_MAX_LOOPS = 100;
int const CALC_NODE_DELIVER_MAX_LOOPS_MQ = 2000;
int const NODE_ADVANCE_MAX_LOOPS = 100;
int const PAYMENT_MAX_LOOPS = 1000;
int const PATHFINDER_HIGH_PRIORITY = 100000;
int const PATHFINDER_MAX_PATHS = 50;
int const PATHFINDER_MAX_COMPLETE_PATHS = 1000;
int const PATHFINDER_MAX_PATHS_FROM_SOURCE = 10;
} // namespace ripple
#endif

View File

@@ -1,39 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_APP_PATHS_TYPES_H_INCLUDED
#define RIPPLE_APP_PATHS_TYPES_H_INCLUDED
namespace ripple {
// account id, issue.
using AccountIssue = std::pair<AccountID, Issue>;
// Map of account, issue to node index.
namespace path {
using NodeIndex = unsigned int;
}
using AccountIssueToNodeIndex = hash_map<AccountIssue, path::NodeIndex>;
} // namespace ripple
#endif

View File

@@ -18,7 +18,6 @@
//==============================================================================
#include <ripple/app/paths/Credit.h>
#include <ripple/app/paths/NodeDirectory.h>
#include <ripple/app/paths/impl/FlatSets.h>
#include <ripple/app/paths/impl/Steps.h>
#include <ripple/app/tx/impl/OfferStream.h>