mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-22 03:55:53 +00:00
Refactor SuppressionTable into IHashRouter
Conflicts: src/cpp/ripple/Application.h
This commit is contained in:
@@ -28,11 +28,15 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
#include <map>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include <openssl/ec.h>
|
#include <openssl/ec.h>
|
||||||
#include <openssl/ripemd.h>
|
#include <openssl/ripemd.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
@@ -46,8 +50,10 @@
|
|||||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/tuple/tuple_comparison.hpp>
|
#include <boost/tuple/tuple_comparison.hpp>
|
||||||
#include <boost/unordered_set.hpp>
|
#include <boost/unordered_set.hpp>
|
||||||
|
#include <boost/unordered_map.hpp>
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -128,6 +134,7 @@
|
|||||||
// New abstract interfaces
|
// New abstract interfaces
|
||||||
#include "src/cpp/ripple/ripple_IFeatures.h"
|
#include "src/cpp/ripple/ripple_IFeatures.h"
|
||||||
#include "src/cpp/ripple/ripple_IFeeVote.h"
|
#include "src/cpp/ripple/ripple_IFeeVote.h"
|
||||||
|
#include "src/cpp/ripple/ripple_IHashRouter.h"
|
||||||
#include "src/cpp/ripple/ripple_ILoadFeeTrack.h"
|
#include "src/cpp/ripple/ripple_ILoadFeeTrack.h"
|
||||||
#include "src/cpp/ripple/ripple_IValidations.h"
|
#include "src/cpp/ripple/ripple_IValidations.h"
|
||||||
#include "src/cpp/ripple/ripple_IUniqueNodeList.h"
|
#include "src/cpp/ripple/ripple_IUniqueNodeList.h"
|
||||||
@@ -238,7 +245,6 @@ static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
|
|||||||
#include "src/cpp/ripple/ripple_HashValue.cpp"
|
#include "src/cpp/ripple/ripple_HashValue.cpp"
|
||||||
|
|
||||||
// sockets
|
// sockets
|
||||||
#include "src/cpp/ripple/Suppression.cpp" // no log
|
|
||||||
#include "src/cpp/ripple/SNTPClient.cpp"
|
#include "src/cpp/ripple/SNTPClient.cpp"
|
||||||
#include "src/cpp/ripple/ConnectionPool.cpp"
|
#include "src/cpp/ripple/ConnectionPool.cpp"
|
||||||
#include "src/cpp/ripple/NetworkOPs.cpp"
|
#include "src/cpp/ripple/NetworkOPs.cpp"
|
||||||
@@ -265,6 +271,7 @@ static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
|
|||||||
// Implementation of interfaces
|
// Implementation of interfaces
|
||||||
|
|
||||||
#include "src/cpp/ripple/ripple_FeeVote.cpp"
|
#include "src/cpp/ripple/ripple_FeeVote.cpp"
|
||||||
|
#include "src/cpp/ripple/ripple_HashRouter.cpp"
|
||||||
#include "src/cpp/ripple/ripple_LoadFeeTrack.cpp"
|
#include "src/cpp/ripple/ripple_LoadFeeTrack.cpp"
|
||||||
#include "src/cpp/ripple/ripple_Validations.cpp"
|
#include "src/cpp/ripple/ripple_Validations.cpp"
|
||||||
#include "src/cpp/ripple/ripple_UniqueNodeList.cpp"
|
#include "src/cpp/ripple/ripple_UniqueNodeList.cpp"
|
||||||
|
|||||||
@@ -1106,7 +1106,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>
|
||||||
<ClCompile Include="src\cpp\ripple\Suppression.cpp">
|
<ClCompile Include="src\cpp\ripple\ripple_HashRouter.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
@@ -1674,7 +1674,7 @@
|
|||||||
<ClInclude Include="src\cpp\ripple\SHAMap.h" />
|
<ClInclude Include="src\cpp\ripple\SHAMap.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\SHAMapSync.h" />
|
<ClInclude Include="src\cpp\ripple\SHAMapSync.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\SNTPClient.h" />
|
<ClInclude Include="src\cpp\ripple\SNTPClient.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\Suppression.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_IHashRouter.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\Transaction.h" />
|
<ClInclude Include="src\cpp\ripple\Transaction.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\TransactionEngine.h" />
|
<ClInclude Include="src\cpp\ripple\TransactionEngine.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\TransactionErr.h" />
|
<ClInclude Include="src\cpp\ripple\TransactionErr.h" />
|
||||||
|
|||||||
@@ -786,9 +786,6 @@
|
|||||||
<ClCompile Include="src\cpp\ripple\SNTPClient.cpp">
|
<ClCompile Include="src\cpp\ripple\SNTPClient.cpp">
|
||||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\cpp\ripple\Suppression.cpp">
|
|
||||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\cpp\ripple\WSDoor.cpp">
|
<ClCompile Include="src\cpp\ripple\WSDoor.cpp">
|
||||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -801,6 +798,9 @@
|
|||||||
<ClCompile Include="src\cpp\ripple\ripple_UniqueNodeList.cpp">
|
<ClCompile Include="src\cpp\ripple\ripple_UniqueNodeList.cpp">
|
||||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\cpp\ripple\ripple_HashRouter.cpp">
|
||||||
|
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="database\sqlite3ext.h">
|
<ClInclude Include="database\sqlite3ext.h">
|
||||||
@@ -1478,15 +1478,15 @@
|
|||||||
<ClInclude Include="src\cpp\ripple\SNTPClient.h">
|
<ClInclude Include="src\cpp\ripple\SNTPClient.h">
|
||||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\cpp\ripple\Suppression.h">
|
|
||||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\cpp\ripple\WSConnection.h">
|
<ClInclude Include="src\cpp\ripple\WSConnection.h">
|
||||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_IUniqueNodeList.h">
|
<ClInclude Include="src\cpp\ripple\ripple_IUniqueNodeList.h">
|
||||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\cpp\ripple\ripple_IHashRouter.h">
|
||||||
|
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="SConstruct" />
|
<None Include="SConstruct" />
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ Application::Application ()
|
|||||||
// VFALCO: New stuff
|
// VFALCO: New stuff
|
||||||
, mFeeVote (IFeeVote::New (10, 50 * SYSTEM_CURRENCY_PARTS, 12.5 * SYSTEM_CURRENCY_PARTS))
|
, mFeeVote (IFeeVote::New (10, 50 * SYSTEM_CURRENCY_PARTS, 12.5 * SYSTEM_CURRENCY_PARTS))
|
||||||
, mFeeTrack (ILoadFeeTrack::New ())
|
, mFeeTrack (ILoadFeeTrack::New ())
|
||||||
|
, mHashRouter (IHashRouter::New (IHashRouter::getDefaultHoldTime ()))
|
||||||
, mValidations (IValidations::New ())
|
, mValidations (IValidations::New ())
|
||||||
, mUNL (IUniqueNodeList::New (mIOService))
|
, mUNL (IUniqueNodeList::New (mIOService))
|
||||||
// VFALCO: End new stuff
|
// VFALCO: End new stuff
|
||||||
@@ -105,6 +106,7 @@ void sigIntHandler(int)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// VFALCO: TODO, Figure this out it looks like the wrong tool
|
||||||
static void runAux(boost::asio::io_service& svc)
|
static void runAux(boost::asio::io_service& svc)
|
||||||
{
|
{
|
||||||
setCallingThreadName("aux");
|
setCallingThreadName("aux");
|
||||||
@@ -117,6 +119,26 @@ static void runIO(boost::asio::io_service& io)
|
|||||||
io.run();
|
io.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::isNew(const uint256& s)
|
||||||
|
{
|
||||||
|
return mHashRouter->addSuppression(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Application::isNew(const uint256& s, uint64 p)
|
||||||
|
{
|
||||||
|
return mHashRouter->addSuppressionPeer(s, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Application::isNew(const uint256& s, uint64 p, int& f)
|
||||||
|
{
|
||||||
|
return mHashRouter->addSuppressionPeer(s, p, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Application::isNewFlag(const uint256& s, int f)
|
||||||
|
{
|
||||||
|
return mHashRouter->setFlag(s, f);
|
||||||
|
}
|
||||||
|
|
||||||
void Application::setup()
|
void Application::setup()
|
||||||
{
|
{
|
||||||
mJobQueue.setThreadCount();
|
mJobQueue.setThreadCount();
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "Peer.h"
|
#include "Peer.h"
|
||||||
#include "NetworkOPs.h"
|
#include "NetworkOPs.h"
|
||||||
#include "WSDoor.h"
|
#include "WSDoor.h"
|
||||||
#include "Suppression.h"
|
|
||||||
#include "SNTPClient.h"
|
#include "SNTPClient.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "RPCHandler.h"
|
#include "RPCHandler.h"
|
||||||
@@ -30,6 +29,7 @@
|
|||||||
// VFALCO: TODO, Fix forward declares required for header dependency loops
|
// VFALCO: TODO, Fix forward declares required for header dependency loops
|
||||||
class IFeatureTable;
|
class IFeatureTable;
|
||||||
class IFeeVote;
|
class IFeeVote;
|
||||||
|
class IHashRouter;
|
||||||
class ILoadFeeTrack;
|
class ILoadFeeTrack;
|
||||||
class IValidations;
|
class IValidations;
|
||||||
class IUniqueNodeList;
|
class IUniqueNodeList;
|
||||||
@@ -52,7 +52,6 @@ class Application
|
|||||||
TransactionMaster mMasterTransaction;
|
TransactionMaster mMasterTransaction;
|
||||||
NetworkOPs mNetOps;
|
NetworkOPs mNetOps;
|
||||||
NodeCache mTempNodeCache;
|
NodeCache mTempNodeCache;
|
||||||
SuppressionTable mSuppressions;
|
|
||||||
HashedObjectStore mHashedObjectStore;
|
HashedObjectStore mHashedObjectStore;
|
||||||
SLECache mSLECache;
|
SLECache mSLECache;
|
||||||
SNTPClient mSNTPClient;
|
SNTPClient mSNTPClient;
|
||||||
@@ -63,8 +62,9 @@ class Application
|
|||||||
OrderBookDB mOrderBookDB;
|
OrderBookDB mOrderBookDB;
|
||||||
|
|
||||||
// VFALCO: Clean stuff
|
// VFALCO: Clean stuff
|
||||||
beast::ScopedPointer <IFeeVote> mFeeVote;
|
beast::ScopedPointer <IFeeVote> mFeeVote;
|
||||||
beast::ScopedPointer <ILoadFeeTrack> mFeeTrack;
|
beast::ScopedPointer <ILoadFeeTrack> mFeeTrack;
|
||||||
|
beast::ScopedPointer <IHashRouter> mHashRouter;
|
||||||
beast::ScopedPointer <IValidations> mValidations;
|
beast::ScopedPointer <IValidations> mValidations;
|
||||||
beast::ScopedPointer <IUniqueNodeList> mUNL;
|
beast::ScopedPointer <IUniqueNodeList> mUNL;
|
||||||
// VFALCO: End Clean stuff
|
// VFALCO: End Clean stuff
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
NodeCache& getTempNodeCache() { return mTempNodeCache; }
|
NodeCache& getTempNodeCache() { return mTempNodeCache; }
|
||||||
HashedObjectStore& getHashedObjectStore() { return mHashedObjectStore; }
|
HashedObjectStore& getHashedObjectStore() { return mHashedObjectStore; }
|
||||||
JobQueue& getJobQueue() { return mJobQueue; }
|
JobQueue& getJobQueue() { return mJobQueue; }
|
||||||
SuppressionTable& getSuppression() { return mSuppressions; }
|
IHashRouter& getHashRouter() { return *mHashRouter; }
|
||||||
boost::recursive_mutex& getMasterLock() { return mMasterLock; }
|
boost::recursive_mutex& getMasterLock() { return mMasterLock; }
|
||||||
ProofOfWorkGenerator& getPowGen() { return mPOWGen; }
|
ProofOfWorkGenerator& getPowGen() { return mPOWGen; }
|
||||||
LoadManager& getLoadManager() { return mLoadMgr; }
|
LoadManager& getLoadManager() { return mLoadMgr; }
|
||||||
@@ -130,11 +130,14 @@ public:
|
|||||||
ILoadFeeTrack& getFeeTrack() { return *mFeeTrack; }
|
ILoadFeeTrack& getFeeTrack() { return *mFeeTrack; }
|
||||||
IValidations& getValidations() { return *mValidations; }
|
IValidations& getValidations() { return *mValidations; }
|
||||||
|
|
||||||
bool isNew(const uint256& s) { return mSuppressions.addSuppression(s); }
|
// VFALCO: TODO, eliminate these, change callers to just call IHashRouter directly!
|
||||||
bool isNew(const uint256& s, uint64 p) { return mSuppressions.addSuppressionPeer(s, p); }
|
bool isNew(const uint256& s);
|
||||||
bool isNew(const uint256& s, uint64 p, int& f) { return mSuppressions.addSuppressionPeer(s, p, f); }
|
bool isNew(const uint256& s, uint64 p);
|
||||||
bool isNewFlag(const uint256& s, int f) { return mSuppressions.setFlag(s, f); }
|
bool isNew(const uint256& s, uint64 p, int& f);
|
||||||
bool running() { return mTxnDB != NULL; }
|
bool isNewFlag(const uint256& s, int f);
|
||||||
|
|
||||||
|
// VFALCO: TODO, Move these to the .cpp
|
||||||
|
bool running() { return mTxnDB != NULL; } // VFALCO: TODO, replace with nullptr when beast is available
|
||||||
bool getSystemTimeOffset(int& offset) { return mSNTPClient.getOffset(offset); }
|
bool getSystemTimeOffset(int& offset) { return mSNTPClient.getOffset(offset); }
|
||||||
|
|
||||||
DatabaseCon* getRpcDB() { return mRpcDB; }
|
DatabaseCon* getRpcDB() { return mRpcDB; }
|
||||||
|
|||||||
@@ -1004,7 +1004,7 @@ void LedgerConsensus::playbackProposals()
|
|||||||
}
|
}
|
||||||
#if 0 // FIXME: We can't do delayed relay because we don't have the signature
|
#if 0 // FIXME: We can't do delayed relay because we don't have the signature
|
||||||
std::set<uint64> peers
|
std::set<uint64> peers
|
||||||
if (relay && theApp->getSuppression().swapSet(proposal.getSuppress(), set, SF_RELAYED))
|
if (relay && theApp->getHashRouter().swapSet(proposal.getSuppress(), set, SF_RELAYED))
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, LedgerConsensus) << "Stored proposal delayed relay";
|
WriteLog (lsDEBUG, LedgerConsensus) << "Stored proposal delayed relay";
|
||||||
ripple::TMProposeSet set;
|
ripple::TMProposeSet set;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
const uint160& getPeerID() const { return mPeerID; }
|
const uint160& getPeerID() const { return mPeerID; }
|
||||||
const uint256& getCurrentHash() const { return mCurrentHash; }
|
const uint256& getCurrentHash() const { return mCurrentHash; }
|
||||||
const uint256& getPrevLedger() const { return mPreviousLedger; }
|
const uint256& getPrevLedger() const { return mPreviousLedger; }
|
||||||
const uint256& getSuppression() const { return mSuppression; }
|
const uint256& getHashRouter() const { return mSuppression; }
|
||||||
uint32 getProposeSeq() const { return mProposeSeq; }
|
uint32 getProposeSeq() const { return mProposeSeq; }
|
||||||
uint32 getCloseTime() const { return mCloseTime; }
|
uint32 getCloseTime() const { return mCloseTime; }
|
||||||
const RippleAddress& peekPublic() const { return mPublicKey; }
|
const RippleAddress& peekPublic() const { return mPublicKey; }
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ void NetworkOPs::runTransactionQueue()
|
|||||||
if (didApply || (mMode != omFULL))
|
if (didApply || (mMode != omFULL))
|
||||||
{
|
{
|
||||||
std::set<uint64> peers;
|
std::set<uint64> peers;
|
||||||
if (theApp->getSuppression().swapSet(txn->getID(), peers, SF_RELAYED))
|
if (theApp->getHashRouter().swapSet(txn->getID(), peers, SF_RELAYED))
|
||||||
{
|
{
|
||||||
ripple::TMTransaction tx;
|
ripple::TMTransaction tx;
|
||||||
Serializer s;
|
Serializer s;
|
||||||
@@ -318,7 +318,7 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
|
|||||||
{
|
{
|
||||||
LoadEvent::autoptr ev = theApp->getJobQueue().getLoadEventAP(jtTXN_PROC, "ProcessTXN");
|
LoadEvent::autoptr ev = theApp->getJobQueue().getLoadEventAP(jtTXN_PROC, "ProcessTXN");
|
||||||
|
|
||||||
int newFlags = theApp->getSuppression().getFlags(trans->getID());
|
int newFlags = theApp->getHashRouter().getFlags(trans->getID());
|
||||||
if ((newFlags & SF_BAD) != 0)
|
if ((newFlags & SF_BAD) != 0)
|
||||||
{ // cached bad
|
{ // cached bad
|
||||||
trans->setStatus(INVALID);
|
trans->setStatus(INVALID);
|
||||||
@@ -392,7 +392,7 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
|
|||||||
if (didApply || (mMode != omFULL))
|
if (didApply || (mMode != omFULL))
|
||||||
{
|
{
|
||||||
std::set<uint64> peers;
|
std::set<uint64> peers;
|
||||||
if (theApp->getSuppression().swapSet(trans->getID(), peers, SF_RELAYED))
|
if (theApp->getHashRouter().swapSet(trans->getID(), peers, SF_RELAYED))
|
||||||
{
|
{
|
||||||
ripple::TMTransaction tx;
|
ripple::TMTransaction tx;
|
||||||
Serializer s;
|
Serializer s;
|
||||||
@@ -921,7 +921,7 @@ void NetworkOPs::processTrustedProposal(LedgerProposal::pointer proposal,
|
|||||||
if (relay)
|
if (relay)
|
||||||
{
|
{
|
||||||
std::set<uint64> peers;
|
std::set<uint64> peers;
|
||||||
theApp->getSuppression().swapSet(proposal->getSuppression(), peers, SF_RELAYED);
|
theApp->getHashRouter().swapSet(proposal->getHashRouter(), peers, SF_RELAYED);
|
||||||
PackedMessage::pointer message = boost::make_shared<PackedMessage>(*set, ripple::mtPROPOSE_LEDGER);
|
PackedMessage::pointer message = boost::make_shared<PackedMessage>(*set, ripple::mtPROPOSE_LEDGER);
|
||||||
theApp->getConnectionPool().relayMessageBut(peers, message);
|
theApp->getConnectionPool().relayMessageBut(peers, message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
#ifndef __NETWORKSTATUS__
|
|
||||||
#define __NETWORKSTATUS__
|
|
||||||
|
|
||||||
struct NSBit
|
|
||||||
{ // a network status bit
|
|
||||||
const char *name, *description;
|
|
||||||
int number;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct NetworkStatus
|
|
||||||
{
|
|
||||||
static const int nsbConnected=0; // connected to the network
|
|
||||||
static const int nsbAccepted=1; // accept this as the real network
|
|
||||||
static const int nsbFastSynching=2; // catching up, skipping transactions
|
|
||||||
static const int nsbSlowSynching=3; // catching up, txn by txn
|
|
||||||
static const int nsbSynched=4; // in synch with the network
|
|
||||||
static const int nsbIdentifiable=5; // not hiding our identity
|
|
||||||
static const int nsbLedgerSync=6; // participating in ledger sync
|
|
||||||
static const int nsbStuck=7; // unable to sync
|
|
||||||
static const int nsbShuttingDown=8; // node is shutting down
|
|
||||||
|
|
||||||
static const int nnbCount=32;
|
|
||||||
std::bitset<nnbCount> nsbValues;
|
|
||||||
std::map<int,NSBit> nsbData;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -842,12 +842,12 @@ static void checkTransaction(Job&, int flags, SerializedTransaction::pointer stx
|
|||||||
tx = boost::make_shared<Transaction>(stx, true);
|
tx = boost::make_shared<Transaction>(stx, true);
|
||||||
if (tx->getStatus() == INVALID)
|
if (tx->getStatus() == INVALID)
|
||||||
{
|
{
|
||||||
theApp->getSuppression().setFlag(stx->getTransactionID(), SF_BAD);
|
theApp->getHashRouter().setFlag(stx->getTransactionID(), SF_BAD);
|
||||||
Peer::punishPeer(peer, LT_InvalidSignature);
|
Peer::punishPeer(peer, LT_InvalidSignature);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
theApp->getSuppression().setFlag(stx->getTransactionID(), SF_SIGGOOD);
|
theApp->getHashRouter().setFlag(stx->getTransactionID(), SF_SIGGOOD);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tx = boost::make_shared<Transaction>(stx, false);
|
tx = boost::make_shared<Transaction>(stx, false);
|
||||||
@@ -858,7 +858,7 @@ static void checkTransaction(Job&, int flags, SerializedTransaction::pointer stx
|
|||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
theApp->getSuppression().setFlags(stx->getTransactionID(), SF_BAD);
|
theApp->getHashRouter().setFlags(stx->getTransactionID(), SF_BAD);
|
||||||
punishPeer(peer, LT_InvalidRequest);
|
punishPeer(peer, LT_InvalidRequest);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -962,7 +962,7 @@ static void checkPropose(Job& job, boost::shared_ptr<ripple::TMProposeSet> packe
|
|||||||
{ // relay untrusted proposal
|
{ // relay untrusted proposal
|
||||||
WriteLog (lsTRACE, Peer) << "relaying untrusted proposal";
|
WriteLog (lsTRACE, Peer) << "relaying untrusted proposal";
|
||||||
std::set<uint64> peers;
|
std::set<uint64> peers;
|
||||||
theApp->getSuppression().swapSet(proposal->getSuppression(), peers, SF_RELAYED);
|
theApp->getHashRouter().swapSet(proposal->getHashRouter(), peers, SF_RELAYED);
|
||||||
PackedMessage::pointer message = boost::make_shared<PackedMessage>(set, ripple::mtPROPOSE_LEDGER);
|
PackedMessage::pointer message = boost::make_shared<PackedMessage>(set, ripple::mtPROPOSE_LEDGER);
|
||||||
theApp->getConnectionPool().relayMessageBut(peers, message);
|
theApp->getConnectionPool().relayMessageBut(peers, message);
|
||||||
}
|
}
|
||||||
@@ -1069,7 +1069,7 @@ static void checkValidation(Job&, SerializedValidation::pointer val, uint256 sig
|
|||||||
|
|
||||||
std::set<uint64> peers;
|
std::set<uint64> peers;
|
||||||
if (theApp->getOPs().recvValidation(val, source) &&
|
if (theApp->getOPs().recvValidation(val, source) &&
|
||||||
theApp->getSuppression().swapSet(signingHash, peers, SF_RELAYED))
|
theApp->getHashRouter().swapSet(signingHash, peers, SF_RELAYED))
|
||||||
{
|
{
|
||||||
PackedMessage::pointer message = boost::make_shared<PackedMessage>(*packet, ripple::mtVALIDATION);
|
PackedMessage::pointer message = boost::make_shared<PackedMessage>(*packet, ripple::mtVALIDATION);
|
||||||
theApp->getConnectionPool().relayMessageBut(peers, message);
|
theApp->getConnectionPool().relayMessageBut(peers, message);
|
||||||
|
|||||||
@@ -1,118 +0,0 @@
|
|||||||
#include "Suppression.h"
|
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
DECLARE_INSTANCE(Suppression);
|
|
||||||
|
|
||||||
Suppression& SuppressionTable::findCreateEntry(const uint256& index, bool& created)
|
|
||||||
{
|
|
||||||
boost::unordered_map<uint256, Suppression>::iterator fit = mSuppressionMap.find(index);
|
|
||||||
|
|
||||||
if (fit != mSuppressionMap.end())
|
|
||||||
{
|
|
||||||
created = false;
|
|
||||||
return fit->second;
|
|
||||||
}
|
|
||||||
created = true;
|
|
||||||
|
|
||||||
int now = UptimeTimer::getInstance().getElapsedSeconds ();
|
|
||||||
int expireTime = now - mHoldTime;
|
|
||||||
|
|
||||||
// See if any supressions need to be expired
|
|
||||||
std::map< int, std::list<uint256> >::iterator it = mSuppressionTimes.begin();
|
|
||||||
if ((it != mSuppressionTimes.end()) && (it->first <= expireTime))
|
|
||||||
{
|
|
||||||
BOOST_FOREACH(const uint256& lit, it->second)
|
|
||||||
mSuppressionMap.erase(lit);
|
|
||||||
mSuppressionTimes.erase(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
mSuppressionTimes[now].push_back(index);
|
|
||||||
return mSuppressionMap.emplace(index, Suppression()).first->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SuppressionTable::addSuppression(const uint256& index)
|
|
||||||
{
|
|
||||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
findCreateEntry(index, created);
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
|
|
||||||
Suppression SuppressionTable::getEntry(const uint256& index)
|
|
||||||
{
|
|
||||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
return findCreateEntry(index, created);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SuppressionTable::addSuppressionPeer(const uint256& index, uint64 peer)
|
|
||||||
{
|
|
||||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
findCreateEntry(index, created).addPeer(peer);
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SuppressionTable::addSuppressionPeer(const uint256& index, uint64 peer, int& flags)
|
|
||||||
{
|
|
||||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
Suppression &s = findCreateEntry(index, created);
|
|
||||||
s.addPeer(peer);
|
|
||||||
flags = s.getFlags();
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SuppressionTable::getFlags(const uint256& index)
|
|
||||||
{
|
|
||||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
return findCreateEntry(index, created).getFlags();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SuppressionTable::addSuppressionFlags(const uint256& index, int flag)
|
|
||||||
{
|
|
||||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
findCreateEntry(index, created).setFlag(flag);
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SuppressionTable::setFlag(const uint256& index, int flag)
|
|
||||||
{ // return: true = changed, false = unchanged
|
|
||||||
assert(flag != 0);
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
Suppression &s = findCreateEntry(index, created);
|
|
||||||
|
|
||||||
if ((s.getFlags() & flag) == flag)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
s.setFlag(flag);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SuppressionTable::swapSet(const uint256& index, std::set<uint64>& peers, int flag)
|
|
||||||
{
|
|
||||||
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
Suppression &s = findCreateEntry(index, created);
|
|
||||||
|
|
||||||
if ((s.getFlags() & flag) == flag)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
s.swapSet(peers);
|
|
||||||
s.setFlag(flag);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
#ifndef __SUPPRESSION__
|
|
||||||
#define __SUPPRESSION__
|
|
||||||
|
|
||||||
#include <set>
|
|
||||||
#include <map>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
#include <boost/unordered_map.hpp>
|
|
||||||
#include <boost/thread/mutex.hpp>
|
|
||||||
|
|
||||||
DEFINE_INSTANCE(Suppression);
|
|
||||||
|
|
||||||
#define SF_RELAYED 0x01 // Has already been relayed to other nodes
|
|
||||||
#define SF_BAD 0x02 // Signature/format is bad
|
|
||||||
#define SF_SIGGOOD 0x04 // Signature is good
|
|
||||||
#define SF_SAVED 0x08
|
|
||||||
#define SF_RETRY 0x10 // Transaction can be retried
|
|
||||||
#define SF_TRUSTED 0x20 // comes from trusted source
|
|
||||||
|
|
||||||
class Suppression : private IS_INSTANCE(Suppression)
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
int mFlags;
|
|
||||||
std::set<uint64> mPeers;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Suppression() : mFlags(0) { ; }
|
|
||||||
|
|
||||||
const std::set<uint64>& peekPeers() { return mPeers; }
|
|
||||||
void addPeer(uint64 peer) { if (peer != 0) mPeers.insert(peer); }
|
|
||||||
bool hasPeer(uint64 peer) { return mPeers.count(peer) > 0; }
|
|
||||||
|
|
||||||
int getFlags(void) { return mFlags; }
|
|
||||||
bool hasFlag(int f) { return (mFlags & f) != 0; }
|
|
||||||
void setFlag(int f) { mFlags |= f; }
|
|
||||||
void clearFlag(int f) { mFlags &= ~f; }
|
|
||||||
void swapSet(std::set<uint64>& s) { mPeers.swap(s); }
|
|
||||||
};
|
|
||||||
|
|
||||||
class SuppressionTable
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
boost::mutex mSuppressionMutex;
|
|
||||||
|
|
||||||
// Stores all suppressed hashes and their expiration time
|
|
||||||
boost::unordered_map<uint256, Suppression> mSuppressionMap;
|
|
||||||
|
|
||||||
// Stores all expiration times and the hashes indexed for them
|
|
||||||
std::map< int, std::list<uint256> > mSuppressionTimes;
|
|
||||||
|
|
||||||
int mHoldTime;
|
|
||||||
|
|
||||||
Suppression& findCreateEntry(const uint256&, bool& created);
|
|
||||||
|
|
||||||
public:
|
|
||||||
SuppressionTable(int holdTime = 120) : mHoldTime(holdTime) { ; }
|
|
||||||
|
|
||||||
bool addSuppression(const uint256& index);
|
|
||||||
|
|
||||||
bool addSuppressionPeer(const uint256& index, uint64 peer);
|
|
||||||
bool addSuppressionPeer(const uint256& index, uint64 peer, int& flags);
|
|
||||||
bool addSuppressionFlags(const uint256& index, int flag);
|
|
||||||
bool setFlag(const uint256& index, int flag);
|
|
||||||
int getFlags(const uint256& index);
|
|
||||||
|
|
||||||
Suppression getEntry(const uint256&);
|
|
||||||
|
|
||||||
bool swapSet(const uint256& index, std::set<uint64>& peers, int flag);
|
|
||||||
bool swapSet(const uint256& index, std::set<uint64>& peers);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
155
src/cpp/ripple/ripple_HashRouter.cpp
Normal file
155
src/cpp/ripple/ripple_HashRouter.cpp
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
|
||||||
|
DECLARE_INSTANCE(HashRouterEntry);
|
||||||
|
|
||||||
|
// VFALCO: TODO Inline the function definitions
|
||||||
|
class HashRouter : public IHashRouter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit HashRouter (int holdTime)
|
||||||
|
: mHoldTime (holdTime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool addSuppression(const uint256& index);
|
||||||
|
|
||||||
|
bool addSuppressionPeer(const uint256& index, uint64 peer);
|
||||||
|
bool addSuppressionPeer(const uint256& index, uint64 peer, int& flags);
|
||||||
|
bool addSuppressionFlags(const uint256& index, int flag);
|
||||||
|
bool setFlag(const uint256& index, int flag);
|
||||||
|
int getFlags(const uint256& index);
|
||||||
|
|
||||||
|
HashRouterEntry getEntry(const uint256&);
|
||||||
|
|
||||||
|
bool swapSet(const uint256& index, std::set<uint64>& peers, int flag);
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::mutex mSuppressionMutex;
|
||||||
|
|
||||||
|
// Stores all suppressed hashes and their expiration time
|
||||||
|
boost::unordered_map <uint256, HashRouterEntry> mSuppressionMap;
|
||||||
|
|
||||||
|
// Stores all expiration times and the hashes indexed for them
|
||||||
|
std::map< int, std::list<uint256> > mSuppressionTimes;
|
||||||
|
|
||||||
|
int mHoldTime;
|
||||||
|
|
||||||
|
HashRouterEntry& findCreateEntry(const uint256&, bool& created);
|
||||||
|
};
|
||||||
|
|
||||||
|
HashRouterEntry& HashRouter::findCreateEntry(const uint256& index, bool& created)
|
||||||
|
{
|
||||||
|
boost::unordered_map<uint256, HashRouterEntry>::iterator fit = mSuppressionMap.find(index);
|
||||||
|
|
||||||
|
if (fit != mSuppressionMap.end())
|
||||||
|
{
|
||||||
|
created = false;
|
||||||
|
return fit->second;
|
||||||
|
}
|
||||||
|
created = true;
|
||||||
|
|
||||||
|
int now = UptimeTimer::getInstance().getElapsedSeconds ();
|
||||||
|
int expireTime = now - mHoldTime;
|
||||||
|
|
||||||
|
// See if any supressions need to be expired
|
||||||
|
std::map< int, std::list<uint256> >::iterator it = mSuppressionTimes.begin();
|
||||||
|
if ((it != mSuppressionTimes.end()) && (it->first <= expireTime))
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(const uint256& lit, it->second)
|
||||||
|
mSuppressionMap.erase(lit);
|
||||||
|
mSuppressionTimes.erase(it);
|
||||||
|
}
|
||||||
|
|
||||||
|
mSuppressionTimes[now].push_back(index);
|
||||||
|
return mSuppressionMap.emplace(index, HashRouterEntry ()).first->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HashRouter::addSuppression(const uint256& index)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
findCreateEntry(index, created);
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashRouterEntry HashRouter::getEntry(const uint256& index)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
return findCreateEntry(index, created);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HashRouter::addSuppressionPeer(const uint256& index, uint64 peer)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
findCreateEntry(index, created).addPeer(peer);
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HashRouter::addSuppressionPeer(const uint256& index, uint64 peer, int& flags)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
HashRouterEntry &s = findCreateEntry(index, created);
|
||||||
|
s.addPeer(peer);
|
||||||
|
flags = s.getFlags();
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
int HashRouter::getFlags(const uint256& index)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
return findCreateEntry(index, created).getFlags();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HashRouter::addSuppressionFlags(const uint256& index, int flag)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
findCreateEntry(index, created).setFlag(flag);
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HashRouter::setFlag(const uint256& index, int flag)
|
||||||
|
{ // return: true = changed, false = unchanged
|
||||||
|
assert(flag != 0);
|
||||||
|
|
||||||
|
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
HashRouterEntry &s = findCreateEntry(index, created);
|
||||||
|
|
||||||
|
if ((s.getFlags() & flag) == flag)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
s.setFlag(flag);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HashRouter::swapSet(const uint256& index, std::set<uint64>& peers, int flag)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mSuppressionMutex);
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
HashRouterEntry &s = findCreateEntry(index, created);
|
||||||
|
|
||||||
|
if ((s.getFlags() & flag) == flag)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
s.swapSet(peers);
|
||||||
|
s.setFlag(flag);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IHashRouter* IHashRouter::New (int holdTime)
|
||||||
|
{
|
||||||
|
return new HashRouter (holdTime);
|
||||||
|
}
|
||||||
65
src/cpp/ripple/ripple_IHashRouter.h
Normal file
65
src/cpp/ripple/ripple_IHashRouter.h
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#ifndef RIPPLE_HASHROUTER_H
|
||||||
|
#define RIPPLE_HASHROUTER_H
|
||||||
|
|
||||||
|
DEFINE_INSTANCE (HashRouterEntry);
|
||||||
|
|
||||||
|
// VFALCO: TODO, convert these macros to int constants
|
||||||
|
#define SF_RELAYED 0x01 // Has already been relayed to other nodes
|
||||||
|
#define SF_BAD 0x02 // Signature/format is bad
|
||||||
|
#define SF_SIGGOOD 0x04 // Signature is good
|
||||||
|
#define SF_SAVED 0x08
|
||||||
|
#define SF_RETRY 0x10 // Transaction can be retried
|
||||||
|
#define SF_TRUSTED 0x20 // comes from trusted source
|
||||||
|
|
||||||
|
// VFALCO: TODO move this class into the scope of class HashRouter
|
||||||
|
class HashRouterEntry : private IS_INSTANCE (HashRouterEntry)
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
int mFlags;
|
||||||
|
std::set<uint64> mPeers;
|
||||||
|
|
||||||
|
public:
|
||||||
|
HashRouterEntry () : mFlags(0) { ; }
|
||||||
|
|
||||||
|
const std::set<uint64>& peekPeers() { return mPeers; }
|
||||||
|
void addPeer(uint64 peer) { if (peer != 0) mPeers.insert(peer); }
|
||||||
|
bool hasPeer(uint64 peer) { return mPeers.count(peer) > 0; }
|
||||||
|
|
||||||
|
int getFlags(void) { return mFlags; }
|
||||||
|
bool hasFlag(int f) { return (mFlags & f) != 0; }
|
||||||
|
void setFlag(int f) { mFlags |= f; }
|
||||||
|
void clearFlag(int f) { mFlags &= ~f; }
|
||||||
|
void swapSet(std::set<uint64>& s) { mPeers.swap(s); }
|
||||||
|
};
|
||||||
|
|
||||||
|
class IHashRouter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// VFALCO: NOTE, this preferred alternative to default parameters makes
|
||||||
|
// behavior clear.
|
||||||
|
//
|
||||||
|
static inline int getDefaultHoldTime ()
|
||||||
|
{
|
||||||
|
return 120;
|
||||||
|
}
|
||||||
|
|
||||||
|
// VFALCO: TODO rename the parameter to entryHoldTimeInSeconds
|
||||||
|
static IHashRouter* New (int holdTime);
|
||||||
|
|
||||||
|
virtual ~IHashRouter () { }
|
||||||
|
|
||||||
|
virtual bool addSuppression(const uint256& index) = 0;
|
||||||
|
|
||||||
|
virtual bool addSuppressionPeer(const uint256& index, uint64 peer) = 0;
|
||||||
|
virtual bool addSuppressionPeer(const uint256& index, uint64 peer, int& flags) = 0;
|
||||||
|
virtual bool addSuppressionFlags(const uint256& index, int flag) = 0;
|
||||||
|
virtual bool setFlag(const uint256& index, int flag) = 0;
|
||||||
|
virtual int getFlags(const uint256& index) = 0;
|
||||||
|
|
||||||
|
virtual HashRouterEntry getEntry(const uint256&) = 0;
|
||||||
|
|
||||||
|
virtual bool swapSet(const uint256& index, std::set<uint64>& peers, int flag) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user