|
|
@ -12,6 +12,7 @@ |
|
|
|
#include "script/sign.h" |
|
|
|
#include "script/sign.h" |
|
|
|
#include "serialize.h" |
|
|
|
#include "serialize.h" |
|
|
|
#include "util.h" |
|
|
|
#include "util.h" |
|
|
|
|
|
|
|
#include "validation.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "test/test_bitcoin.h" |
|
|
|
#include "test/test_bitcoin.h" |
|
|
|
|
|
|
|
|
|
|
@ -32,7 +33,6 @@ struct COrphanTx { |
|
|
|
int64_t nTimeExpire; |
|
|
|
int64_t nTimeExpire; |
|
|
|
}; |
|
|
|
}; |
|
|
|
extern std::map<uint256, COrphanTx> mapOrphanTransactions; |
|
|
|
extern std::map<uint256, COrphanTx> mapOrphanTransactions; |
|
|
|
extern std::map<std::string, std::string> mapArgs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CService ip(uint32_t i) |
|
|
|
CService ip(uint32_t i) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(DoS_banning) |
|
|
|
BOOST_AUTO_TEST_CASE(DoS_banscore) |
|
|
|
BOOST_AUTO_TEST_CASE(DoS_banscore) |
|
|
|
{ |
|
|
|
{ |
|
|
|
connman->ClearBanned(); |
|
|
|
connman->ClearBanned(); |
|
|
|
mapArgs["-banscore"] = "111"; // because 11 is my favorite number
|
|
|
|
ForceSetArg("-banscore", "111"); // because 11 is my favorite number
|
|
|
|
CAddress addr1(ip(0xa0b0c001), NODE_NONE); |
|
|
|
CAddress addr1(ip(0xa0b0c001), NODE_NONE); |
|
|
|
CNode dummyNode1(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr1, 3, 1, "", true); |
|
|
|
CNode dummyNode1(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr1, 3, 1, "", true); |
|
|
|
dummyNode1.SetSendVersion(PROTOCOL_VERSION); |
|
|
|
dummyNode1.SetSendVersion(PROTOCOL_VERSION); |
|
|
@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(DoS_banscore) |
|
|
|
Misbehaving(dummyNode1.GetId(), 1); |
|
|
|
Misbehaving(dummyNode1.GetId(), 1); |
|
|
|
SendMessages(&dummyNode1, *connman); |
|
|
|
SendMessages(&dummyNode1, *connman); |
|
|
|
BOOST_CHECK(connman->IsBanned(addr1)); |
|
|
|
BOOST_CHECK(connman->IsBanned(addr1)); |
|
|
|
mapArgs.erase("-banscore"); |
|
|
|
ForceSetArg("-banscore", std::to_string(DEFAULT_BANSCORE_THRESHOLD)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(DoS_bantime) |
|
|
|
BOOST_AUTO_TEST_CASE(DoS_bantime) |
|
|
|