Devirtualize HashRouter

* Include some simple renames
This commit is contained in:
Edward Hennis
2015-08-04 15:38:30 -04:00
committed by Nik Bougalis
parent d69285f6ad
commit 0d7cad8d64
17 changed files with 141 additions and 170 deletions

View File

@@ -1529,7 +1529,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\app\misc\IHashRouter.h"> <ClInclude Include="..\..\src\ripple\app\misc\HashRouter.h">
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ripple\app\misc\impl\AccountTxPaging.cpp"> <ClCompile Include="..\..\src\ripple\app\misc\impl\AccountTxPaging.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>

View File

@@ -2280,7 +2280,7 @@
<ClCompile Include="..\..\src\ripple\app\misc\HashRouter.cpp"> <ClCompile Include="..\..\src\ripple\app\misc\HashRouter.cpp">
<Filter>ripple\app\misc</Filter> <Filter>ripple\app\misc</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\app\misc\IHashRouter.h"> <ClInclude Include="..\..\src\ripple\app\misc\HashRouter.h">
<Filter>ripple\app\misc</Filter> <Filter>ripple\app\misc</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ripple\app\misc\impl\AccountTxPaging.cpp"> <ClCompile Include="..\..\src\ripple\app\misc\impl\AccountTxPaging.cpp">

View File

@@ -27,7 +27,7 @@
#include <ripple/app/ledger/OrderBookDB.h> #include <ripple/app/ledger/OrderBookDB.h>
#include <ripple/app/ledger/PendingSaves.h> #include <ripple/app/ledger/PendingSaves.h>
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/NetworkOPs.h> #include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/tx/TransactionMaster.h> #include <ripple/app/tx/TransactionMaster.h>
#include <ripple/basics/contract.h> #include <ripple/basics/contract.h>
@@ -1294,7 +1294,7 @@ void Ledger::updateSkipList ()
*/ */
bool Ledger::pendSaveValidated (bool isSynchronous, bool isCurrent) bool Ledger::pendSaveValidated (bool isSynchronous, bool isCurrent)
{ {
if (!getApp().getHashRouter ().setFlag (getHash (), SF_SAVED)) if (!getApp().getHashRouter ().setFlags (getHash (), SF_SAVED))
{ {
WriteLog (lsDEBUG, Ledger) << "Double pend save for " << info().seq; WriteLog (lsDEBUG, Ledger) << "Double pend save for " << info().seq;
return true; return true;

View File

@@ -24,7 +24,7 @@
#include <ripple/ledger/CachedSLEs.h> #include <ripple/ledger/CachedSLEs.h>
#include <ripple/ledger/OpenView.h> #include <ripple/ledger/OpenView.h>
#include <ripple/app/misc/CanonicalTXSet.h> #include <ripple/app/misc/CanonicalTXSet.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/basics/UnorderedContainers.h> #include <ripple/basics/UnorderedContainers.h>
#include <ripple/core/Config.h> #include <ripple/core/Config.h>
@@ -151,7 +151,7 @@ public:
std::shared_ptr<Ledger const> const& ledger, std::shared_ptr<Ledger const> const& ledger,
OrderedTxs const& locals, bool retriesFirst, OrderedTxs const& locals, bool retriesFirst,
OrderedTxs& retries, ApplyFlags flags, OrderedTxs& retries, ApplyFlags flags,
IHashRouter& router, HashRouter& router,
std::string const& suffix = ""); std::string const& suffix = "");
/** Algorithm for applying transactions. /** Algorithm for applying transactions.
@@ -164,7 +164,7 @@ public:
void void
apply (OpenView& view, ReadView const& check, apply (OpenView& view, ReadView const& check,
FwdRange const& txs, OrderedTxs& retries, FwdRange const& txs, OrderedTxs& retries,
ApplyFlags flags, IHashRouter& router, ApplyFlags flags, HashRouter& router,
Config const& config, beast::Journal j); Config const& config, beast::Journal j);
private: private:
@@ -183,7 +183,7 @@ private:
Result Result
apply_one (OpenView& view, std::shared_ptr< apply_one (OpenView& view, std::shared_ptr<
STTx const> const& tx, bool retry, STTx const> const& tx, bool retry,
ApplyFlags flags, IHashRouter& router, ApplyFlags flags, HashRouter& router,
Config const& config, beast::Journal j); Config const& config, beast::Journal j);
public: public:
@@ -205,7 +205,7 @@ void
OpenLedger::apply (OpenView& view, OpenLedger::apply (OpenView& view,
ReadView const& check, FwdRange const& txs, ReadView const& check, FwdRange const& txs,
OrderedTxs& retries, ApplyFlags flags, OrderedTxs& retries, ApplyFlags flags,
IHashRouter& router, Config const& config, HashRouter& router, Config const& config,
beast::Journal j) beast::Journal j)
{ {
for (auto iter = txs.begin(); for (auto iter = txs.begin();

View File

@@ -28,7 +28,7 @@
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/app/misc/AmendmentTable.h> #include <ripple/app/misc/AmendmentTable.h>
#include <ripple/app/misc/CanonicalTXSet.h> #include <ripple/app/misc/CanonicalTXSet.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/NetworkOPs.h> #include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/misc/Validations.h> #include <ripple/app/misc/Validations.h>
#include <ripple/app/tx/TransactionAcquire.h> #include <ripple/app/tx/TransactionAcquire.h>
@@ -1294,7 +1294,7 @@ void LedgerConsensusImp::addDisputedTransaction (
} }
// If we didn't relay this transaction recently, relay it // If we didn't relay this transaction recently, relay it
if (getApp().getHashRouter ().setFlag (txID, SF_RELAYED)) if (getApp().getHashRouter ().setFlags (txID, SF_RELAYED))
{ {
protocol::TMTransaction msg; protocol::TMTransaction msg;
msg.set_rawtransaction (& (tx.front ()), tx.size ()); msg.set_rawtransaction (& (tx.front ()), tx.size ());

View File

@@ -28,7 +28,7 @@
#include <ripple/app/tx/apply.h> #include <ripple/app/tx/apply.h>
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/app/misc/AmendmentTable.h> #include <ripple/app/misc/AmendmentTable.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/NetworkOPs.h> #include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/misc/CanonicalTXSet.h> #include <ripple/app/misc/CanonicalTXSet.h>
#include <ripple/app/misc/SHAMapStore.h> #include <ripple/app/misc/SHAMapStore.h>

View File

@@ -77,7 +77,7 @@ OpenLedger::accept(Rules const& rules,
std::shared_ptr<Ledger const> const& ledger, std::shared_ptr<Ledger const> const& ledger,
OrderedTxs const& locals, bool retriesFirst, OrderedTxs const& locals, bool retriesFirst,
OrderedTxs& retries, ApplyFlags flags, OrderedTxs& retries, ApplyFlags flags,
IHashRouter& router, std::string const& suffix) HashRouter& router, std::string const& suffix)
{ {
JLOG(j_.error) << JLOG(j_.error) <<
"accept ledger " << ledger->seq() << " " << suffix; "accept ledger " << ledger->seq() << " " << suffix;
@@ -135,7 +135,7 @@ auto
OpenLedger::apply_one (OpenView& view, OpenLedger::apply_one (OpenView& view,
std::shared_ptr<STTx const> const& tx, std::shared_ptr<STTx const> const& tx,
bool retry, ApplyFlags flags, bool retry, ApplyFlags flags,
IHashRouter& router, Config const& config, HashRouter& router, Config const& config,
beast::Journal j) -> Result beast::Journal j) -> Result
{ {
if (retry) if (retry)

View File

@@ -35,7 +35,7 @@
#include <ripple/app/main/LocalCredentials.h> #include <ripple/app/main/LocalCredentials.h>
#include <ripple/app/main/NodeStoreScheduler.h> #include <ripple/app/main/NodeStoreScheduler.h>
#include <ripple/app/misc/AmendmentTable.h> #include <ripple/app/misc/AmendmentTable.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/NetworkOPs.h> #include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/misc/SHAMapStore.h> #include <ripple/app/misc/SHAMapStore.h>
#include <ripple/app/misc/Validations.h> #include <ripple/app/misc/Validations.h>
@@ -292,7 +292,7 @@ public:
std::unique_ptr <ServerHandler> serverHandler_; std::unique_ptr <ServerHandler> serverHandler_;
std::unique_ptr <AmendmentTable> m_amendmentTable; std::unique_ptr <AmendmentTable> m_amendmentTable;
std::unique_ptr <LoadFeeTrack> mFeeTrack; std::unique_ptr <LoadFeeTrack> mFeeTrack;
std::unique_ptr <IHashRouter> mHashRouter; std::unique_ptr <HashRouter> mHashRouter;
std::unique_ptr <Validations> mValidations; std::unique_ptr <Validations> mValidations;
std::unique_ptr <LoadManager> m_loadManager; std::unique_ptr <LoadManager> m_loadManager;
beast::DeadlineTimer m_sweepTimer; beast::DeadlineTimer m_sweepTimer;
@@ -411,7 +411,8 @@ public:
, mFeeTrack (std::make_unique<LoadFeeTrack>(m_logs.journal("LoadManager"))) , mFeeTrack (std::make_unique<LoadFeeTrack>(m_logs.journal("LoadManager")))
, mHashRouter (IHashRouter::New (IHashRouter::getDefaultHoldTime ())) , mHashRouter (std::make_unique<HashRouter>(
HashRouter::getDefaultHoldTime ()))
, mValidations (make_Validations ()) , mValidations (make_Validations ())
@@ -574,7 +575,7 @@ public:
return *mFeeTrack; return *mFeeTrack;
} }
IHashRouter& getHashRouter () HashRouter& getHashRouter ()
{ {
return *mHashRouter; return *mHashRouter;
} }
@@ -1325,7 +1326,7 @@ bool ApplicationImp::loadOldLedger (
cur->rawTxInsert(item.key(), cur->rawTxInsert(item.key(),
std::make_shared<Serializer const>( std::make_shared<Serializer const>(
std::move(s)), nullptr); std::move(s)), nullptr);
getApp().getHashRouter().setFlag (item.key(), SF_SIGGOOD); getApp().getHashRouter().setFlags (item.key(), SF_SIGGOOD);
} }
// Switch to the mutable snapshot // Switch to the mutable snapshot

View File

@@ -42,7 +42,7 @@ class CollectorManager;
namespace shamap { namespace shamap {
class Family; class Family;
} // shamap } // shamap
class IHashRouter; class HashRouter;
class Logs; class Logs;
class LoadFeeTrack; class LoadFeeTrack;
class LocalCredentials; class LocalCredentials;
@@ -99,7 +99,7 @@ public:
virtual NodeCache& getTempNodeCache () = 0; virtual NodeCache& getTempNodeCache () = 0;
virtual CachedSLEs& cachedSLEs() = 0; virtual CachedSLEs& cachedSLEs() = 0;
virtual AmendmentTable& getAmendmentTable() = 0; virtual AmendmentTable& getAmendmentTable() = 0;
virtual IHashRouter& getHashRouter () = 0; virtual HashRouter& getHashRouter () = 0;
virtual LoadFeeTrack& getFeeTrack () = 0; virtual LoadFeeTrack& getFeeTrack () = 0;
virtual LoadManager& getLoadManager () = 0; virtual LoadManager& getLoadManager () = 0;
virtual Overlay& overlay () = 0; virtual Overlay& overlay () = 0;

View File

@@ -18,117 +18,14 @@
//============================================================================== //==============================================================================
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/protocol/STTx.h> #include <ripple/protocol/STTx.h>
#include <ripple/basics/CountedObject.h>
#include <ripple/basics/UnorderedContainers.h>
#include <ripple/basics/UptimeTimer.h> #include <ripple/basics/UptimeTimer.h>
#include <map> #include <map>
#include <mutex> #include <mutex>
namespace ripple { namespace ripple {
// VFALCO TODO Inline the function definitions
class HashRouter : public IHashRouter
{
private:
/** An entry in the routing table.
*/
class Entry : public CountedObject <Entry>
{
public:
static char const* getCountedObjectName () { return "HashRouterEntry"; }
Entry ()
: mFlags (0)
{
}
std::set <PeerShortID> const& peekPeers () const
{
return mPeers;
}
void addPeer (PeerShortID peer)
{
if (peer != 0)
mPeers.insert (peer);
}
bool hasPeer (PeerShortID peer) const
{
return mPeers.count (peer) > 0;
}
int getFlags (void) const
{
return mFlags;
}
bool hasFlag (int mask) const
{
return (mFlags & mask) != 0;
}
void setFlag (int flagsToSet)
{
mFlags |= flagsToSet;
}
void clearFlag (int flagsToClear)
{
mFlags &= ~flagsToClear;
}
void swapSet (std::set <PeerShortID>& other)
{
mPeers.swap (other);
}
private:
int mFlags;
std::set <PeerShortID> mPeers;
};
public:
explicit HashRouter (int holdTime)
: mHoldTime (holdTime)
{
}
bool addSuppression (uint256 const& index) override;
bool addSuppressionPeer (uint256 const& index, PeerShortID peer) override;
bool addSuppressionPeer (uint256 const& index, PeerShortID peer, int& flags) override;
bool addSuppressionFlags (uint256 const& index, int flag) override;
bool setFlag (uint256 const& index, int flag) override;
int getFlags (uint256 const& index) override;
bool swapSet (uint256 const& index, std::set<PeerShortID>& peers, int flag) override;
std::function<bool(STTx const&, std::function<bool(STTx const&)>)>
sigVerify() override;
private:
Entry getEntry (uint256 const& );
Entry& findCreateEntry (uint256 const& , bool& created);
using MutexType = std::mutex;
using ScopedLockType = std::lock_guard <MutexType>;
MutexType mMutex;
// Stores all suppressed hashes and their expiration time
hash_map <uint256, Entry> mSuppressionMap;
// Stores all expiration times and the hashes indexed for them
std::map< int, std::list<uint256> > mSuppressionTimes;
int mHoldTime;
};
//------------------------------------------------------------------------------
std::function<bool(STTx const&, std::function<bool(STTx const&)>)> std::function<bool(STTx const&, std::function<bool(STTx const&)>)>
HashRouter::sigVerify() HashRouter::sigVerify()
{ {
@@ -143,10 +40,10 @@ HashRouter::sigVerify()
return false; return false;
if (! sigCheck(tx)) if (! sigCheck(tx))
{ {
setFlag(id, SF_BAD); setFlags(id, SF_BAD);
return false; return false;
} }
setFlag(id, SF_SIGGOOD); setFlags(id, SF_SIGGOOD);
return true; return true;
}; };
} }
@@ -230,28 +127,28 @@ bool HashRouter::addSuppressionFlags (uint256 const& index, int flag)
ScopedLockType lock (mMutex); ScopedLockType lock (mMutex);
bool created; bool created;
findCreateEntry (index, created).setFlag (flag); findCreateEntry (index, created).setFlags (flag);
return created; return created;
} }
bool HashRouter::setFlag (uint256 const& index, int flag) bool HashRouter::setFlags (uint256 const& index, int flags)
{ {
// VFALCO NOTE Comments like this belong in the HEADER file, // VFALCO NOTE Comments like this belong in the HEADER file,
// and more importantly in a Javadoc comment so // and more importantly in a Javadoc comment so
// they appear in the generated documentation. // they appear in the generated documentation.
// //
// return: true = changed, false = unchanged // return: true = changed, false = unchanged
assert (flag != 0); assert (flags != 0);
ScopedLockType lock (mMutex); ScopedLockType lock (mMutex);
bool created; bool created;
Entry& s = findCreateEntry (index, created); Entry& s = findCreateEntry (index, created);
if ((s.getFlags () & flag) == flag) if ((s.getFlags () & flags) == flags)
return false; return false;
s.setFlag (flag); s.setFlags (flags);
return true; return true;
} }
@@ -266,14 +163,9 @@ bool HashRouter::swapSet (uint256 const& index, std::set<PeerShortID>& peers, in
return false; return false;
s.swapSet (peers); s.swapSet (peers);
s.setFlag (flag); s.setFlags (flag);
return true; return true;
} }
IHashRouter* IHashRouter::New (int holdTime)
{
return new HashRouter (holdTime);
}
} // ripple } // ripple

View File

@@ -17,10 +17,12 @@
*/ */
//============================================================================== //==============================================================================
#ifndef RIPPLE_APP_MISC_IHASHROUTER_H_INCLUDED #ifndef RIPPLE_APP_MISC_HASHROUTER_H_INCLUDED
#define RIPPLE_APP_MISC_IHASHROUTER_H_INCLUDED #define RIPPLE_APP_MISC_HASHROUTER_H_INCLUDED
#include <ripple/basics/base_uint.h> #include <ripple/basics/base_uint.h>
#include <ripple/basics/CountedObject.h>
#include <ripple/basics/UnorderedContainers.h>
#include <cstdint> #include <cstdint>
#include <functional> #include <functional>
#include <set> #include <set>
@@ -45,12 +47,72 @@ class STTx;
It is used to manage the routing and broadcasting of messages in the peer It is used to manage the routing and broadcasting of messages in the peer
to peer overlay. to peer overlay.
*/ */
class IHashRouter class HashRouter
{ {
public: public:
// The type here *MUST* match the type of Peer::id_t // The type here *MUST* match the type of Peer::id_t
using PeerShortID = std::uint32_t; using PeerShortID = std::uint32_t;
private:
/** An entry in the routing table.
*/
class Entry : public CountedObject <Entry>
{
public:
static char const* getCountedObjectName () { return "HashRouterEntry"; }
Entry ()
: mFlags (0)
{
}
std::set <PeerShortID> const& peekPeers () const
{
return mPeers;
}
void addPeer (PeerShortID peer)
{
if (peer != 0)
mPeers.insert (peer);
}
bool hasPeer (PeerShortID peer) const
{
return mPeers.count (peer) > 0;
}
int getFlags (void) const
{
return mFlags;
}
bool hasFlag (int mask) const
{
return (mFlags & mask) != 0;
}
void setFlags (int flagsToSet)
{
mFlags |= flagsToSet;
}
void clearFlag (int flagsToClear)
{
mFlags &= ~flagsToClear;
}
void swapSet (std::set <PeerShortID>& other)
{
mPeers.swap (other);
}
private:
int mFlags;
std::set <PeerShortID> mPeers;
};
public:
// VFALCO NOTE this preferred alternative to default parameters makes // VFALCO NOTE this preferred alternative to default parameters makes
// behavior clear. // behavior clear.
// //
@@ -59,39 +121,56 @@ public:
return 300; return 300;
} }
// VFALCO TODO rename the parameter to entryHoldTimeInSeconds explicit HashRouter (int entryHoldTimeInSeconds)
static IHashRouter* New (int holdTime); : mHoldTime (entryHoldTimeInSeconds)
{
}
virtual ~IHashRouter () { } virtual ~HashRouter() = default;
// VFALCO TODO Replace "Supression" terminology with something more semantically meaningful. // VFALCO TODO Replace "Supression" terminology with something more semantically meaningful.
virtual bool addSuppression (uint256 const& index) = 0; bool addSuppression (uint256 const& index);
virtual bool addSuppressionPeer (uint256 const& index, PeerShortID peer) = 0; bool addSuppressionPeer (uint256 const& index, PeerShortID peer);
virtual bool addSuppressionPeer (uint256 const& index, PeerShortID peer, int& flags) = 0; bool addSuppressionPeer (uint256 const& index, PeerShortID peer, int& flags);
virtual bool addSuppressionFlags (uint256 const& index, int flag) = 0; bool addSuppressionFlags (uint256 const& index, int flag);
/** Set the flags on a hash. /** Set the flags on a hash.
@return `true` if the flags were changed. @return `true` if the flags were changed.
*/ */
// VFALCO TODO Rename to setFlags since it works with multiple flags. bool setFlags (uint256 const& index, int flags);
virtual bool setFlag (uint256 const& index, int mask) = 0;
virtual int getFlags (uint256 const& index) = 0; int getFlags (uint256 const& index);
virtual bool swapSet (uint256 const& index, std::set<PeerShortID>& peers, int flag) = 0; bool swapSet (uint256 const& index, std::set<PeerShortID>& peers, int flag);
/** /**
Function wrapper that will check the signature status Function wrapper that will check the signature status
of a STTx before calling an expensive signature of a STTx before calling an expensive signature
checking function. checking function.
*/ */
virtual
std::function<bool(STTx const&, std::function<bool(STTx const&)>)> std::function<bool(STTx const&, std::function<bool(STTx const&)>)>
sigVerify() = 0; sigVerify();
private:
Entry getEntry (uint256 const& );
Entry& findCreateEntry (uint256 const& , bool& created);
using MutexType = std::mutex;
using ScopedLockType = std::lock_guard <MutexType>;
MutexType mMutex;
// Stores all suppressed hashes and their expiration time
hash_map <uint256, Entry> mSuppressionMap;
// Stores all expiration times and the hashes indexed for them
std::map< int, std::list<uint256> > mSuppressionTimes;
int mHoldTime;
}; };
} // ripple } // ripple

View File

@@ -33,7 +33,7 @@
#include <ripple/app/ledger/OrderBookDB.h> #include <ripple/app/ledger/OrderBookDB.h>
#include <ripple/app/main/LoadManager.h> #include <ripple/app/main/LoadManager.h>
#include <ripple/app/main/LocalCredentials.h> #include <ripple/app/main/LocalCredentials.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/NetworkOPs.h> #include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/misc/Validations.h> #include <ripple/app/misc/Validations.h>
#include <ripple/app/misc/impl/AccountTxPaging.h> #include <ripple/app/misc/impl/AccountTxPaging.h>
@@ -679,11 +679,11 @@ void NetworkOPsImp::submitTransaction (Job&, STTx::pointer iTrans)
{ {
m_journal.warning << "Submitted transaction " << m_journal.warning << "Submitted transaction " <<
(reason.empty () ? "has bad signature" : "error: " + reason); (reason.empty () ? "has bad signature" : "error: " + reason);
getApp().getHashRouter ().setFlag (suppress, SF_BAD); getApp().getHashRouter ().setFlags (suppress, SF_BAD);
return; return;
} }
getApp().getHashRouter ().setFlag (suppress, SF_SIGGOOD); getApp().getHashRouter ().setFlags (suppress, SF_SIGGOOD);
} }
catch (...) catch (...)
{ {
@@ -728,12 +728,12 @@ void NetworkOPsImp::processTransaction (Transaction::pointer& transaction,
m_journal.info << "Transaction has bad signature: " << reason; m_journal.info << "Transaction has bad signature: " << reason;
transaction->setStatus (INVALID); transaction->setStatus (INVALID);
transaction->setResult (temBAD_SIGNATURE); transaction->setResult (temBAD_SIGNATURE);
getApp().getHashRouter ().setFlag (transaction->getID (), SF_BAD); getApp().getHashRouter ().setFlags (transaction->getID (), SF_BAD);
return; return;
} }
} }
getApp().getHashRouter ().setFlag (transaction->getID (), SF_SIGGOOD); getApp().getHashRouter ().setFlags (transaction->getID (), SF_SIGGOOD);
// canonicalize can change our pointer // canonicalize can change our pointer
getApp().getMasterTransaction ().canonicalize (&transaction); getApp().getMasterTransaction ().canonicalize (&transaction);
@@ -916,7 +916,7 @@ void NetworkOPsImp::apply (std::unique_lock<std::mutex>& batchLock)
e.transaction->setResult (e.result); e.transaction->setResult (e.result);
if (isTemMalformed (e.result)) if (isTemMalformed (e.result))
getApp().getHashRouter().setFlag (e.transaction->getID(), SF_BAD); getApp().getHashRouter().setFlags (e.transaction->getID(), SF_BAD);
#ifdef BEAST_DEBUG #ifdef BEAST_DEBUG
if (e.result != tesSUCCESS) if (e.result != tesSUCCESS)

View File

@@ -23,7 +23,7 @@
#include <ripple/core/DatabaseCon.h> #include <ripple/core/DatabaseCon.h>
#include <ripple/app/ledger/LedgerMaster.h> #include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/protocol/JsonFields.h> #include <ripple/protocol/JsonFields.h>
#include <boost/optional.hpp> #include <boost/optional.hpp>

View File

@@ -18,7 +18,7 @@
//============================================================================== //==============================================================================
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/core/DatabaseCon.h> #include <ripple/core/DatabaseCon.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/basics/make_SSLContext.h> #include <ripple/basics/make_SSLContext.h>

View File

@@ -23,7 +23,7 @@
#include <ripple/overlay/impl/Tuning.h> #include <ripple/overlay/impl/Tuning.h>
#include <ripple/app/ledger/InboundLedgers.h> #include <ripple/app/ledger/InboundLedgers.h>
#include <ripple/app/ledger/LedgerMaster.h> #include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/NetworkOPs.h> #include <ripple/app/misc/NetworkOPs.h>
#include <ripple/overlay/ClusterNodeStatus.h> #include <ripple/overlay/ClusterNodeStatus.h>
#include <ripple/app/misc/UniqueNodeList.h> #include <ripple/app/misc/UniqueNodeList.h>
@@ -1702,7 +1702,7 @@ PeerImp::checkTransaction (Job&, int flags,
(stx->getFieldU32 (sfLastLedgerSequence) < (stx->getFieldU32 (sfLastLedgerSequence) <
getApp().getLedgerMaster().getValidLedgerIndex())) getApp().getLedgerMaster().getValidLedgerIndex()))
{ {
getApp().getHashRouter().setFlag(stx->getTransactionID(), SF_BAD); getApp().getHashRouter().setFlags(stx->getTransactionID(), SF_BAD);
charge (Resource::feeUnwantedData); charge (Resource::feeUnwantedData);
return; return;
} }
@@ -1718,13 +1718,13 @@ PeerImp::checkTransaction (Job&, int flags,
if (! reason.empty ()) if (! reason.empty ())
p_journal_.trace << "Exception checking transaction: " << reason; p_journal_.trace << "Exception checking transaction: " << reason;
getApp().getHashRouter ().setFlag (stx->getTransactionID (), SF_BAD); getApp().getHashRouter ().setFlags (stx->getTransactionID (), SF_BAD);
charge (Resource::feeInvalidSignature); charge (Resource::feeInvalidSignature);
return; return;
} }
else else
{ {
getApp().getHashRouter ().setFlag (stx->getTransactionID (), SF_SIGGOOD); getApp().getHashRouter ().setFlags (stx->getTransactionID (), SF_SIGGOOD);
} }
bool const trusted (flags & SF_TRUSTED); bool const trusted (flags & SF_TRUSTED);
@@ -1733,7 +1733,7 @@ PeerImp::checkTransaction (Job&, int flags,
} }
catch (...) catch (...)
{ {
getApp().getHashRouter ().setFlag (stx->getTransactionID (), SF_BAD); getApp().getHashRouter ().setFlags (stx->getTransactionID (), SF_BAD);
charge (Resource::feeBadData); charge (Resource::feeBadData);
} }
} }

View File

@@ -20,7 +20,7 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/app/misc/NetworkOPs.h> #include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/HashRouter.h>
#include <ripple/basics/StringUtilities.h> #include <ripple/basics/StringUtilities.h>
#include <ripple/basics/strHex.h> #include <ripple/basics/strHex.h>
#include <ripple/net/RPCErr.h> #include <ripple/net/RPCErr.h>

View File

@@ -100,8 +100,7 @@ Env::close(NetClock::time_point const& closeTime)
for (auto iter = cur->txs.begin(); for (auto iter = cur->txs.begin();
iter != cur->txs.end(); ++iter) iter != cur->txs.end(); ++iter)
txs.push_back(iter->first); txs.push_back(iter->first);
std::unique_ptr<IHashRouter> router( auto router = std::make_unique<HashRouter>(60);
IHashRouter::New(60));
OrderedTxs retries(uint256{}); OrderedTxs retries(uint256{});
{ {
OpenView accum(&*next); OpenView accum(&*next);