Changeset View
Changeset View
Standalone View
Standalone View
src/test/denialofservice_tests.cpp
Show All 18 Lines | |||||
#include <validation.h> | #include <validation.h> | ||||
#include <test/util/setup_common.h> | #include <test/util/setup_common.h> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
#include <cstdint> | #include <cstdint> | ||||
namespace { | |||||
struct CConnmanTest : public CConnman { | struct CConnmanTest : public CConnman { | ||||
using CConnman::CConnman; | using CConnman::CConnman; | ||||
void AddNode(CNode &node) { | void AddNode(CNode &node) { | ||||
LOCK(cs_vNodes); | LOCK(cs_vNodes); | ||||
vNodes.push_back(&node); | vNodes.push_back(&node); | ||||
} | } | ||||
void ClearNodes() { | void ClearNodes() { | ||||
LOCK(cs_vNodes); | LOCK(cs_vNodes); | ||||
for (CNode *node : vNodes) { | for (CNode *node : vNodes) { | ||||
delete node; | delete node; | ||||
} | } | ||||
vNodes.clear(); | vNodes.clear(); | ||||
} | } | ||||
}; | }; | ||||
} // namespace | |||||
// Tests these internal-to-net_processing.cpp methods: | // Tests these internal-to-net_processing.cpp methods: | ||||
extern bool AddOrphanTx(const CTransactionRef &tx, NodeId peer); | extern bool AddOrphanTx(const CTransactionRef &tx, NodeId peer); | ||||
extern void EraseOrphansFor(NodeId peer); | extern void EraseOrphansFor(NodeId peer); | ||||
extern unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans); | extern unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans); | ||||
struct COrphanTx { | struct COrphanTx { | ||||
CTransactionRef tx; | CTransactionRef tx; | ||||
▲ Show 20 Lines • Show All 440 Lines • Show Last 20 Lines |