Consensus transaction recovery/deferral completely ignores the TxQ

This commit is contained in:
Edward Hennis
2021-12-07 17:14:55 -05:00
committed by Nik Bougalis
parent aaa601841c
commit ae9930b87d
8 changed files with 20 additions and 157 deletions

View File

@@ -31,7 +31,7 @@ class HashRouter_test : public beast::unit_test::suite
{
using namespace std::chrono_literals;
TestStopwatch stopwatch;
HashRouter router(stopwatch, 2s, 2);
HashRouter router(stopwatch, 2s);
uint256 const key1(1);
uint256 const key2(2);
@@ -68,7 +68,7 @@ class HashRouter_test : public beast::unit_test::suite
{
using namespace std::chrono_literals;
TestStopwatch stopwatch;
HashRouter router(stopwatch, 2s, 2);
HashRouter router(stopwatch, 2s);
uint256 const key1(1);
uint256 const key2(2);
@@ -146,7 +146,7 @@ class HashRouter_test : public beast::unit_test::suite
// Normal HashRouter
using namespace std::chrono_literals;
TestStopwatch stopwatch;
HashRouter router(stopwatch, 2s, 2);
HashRouter router(stopwatch, 2s);
uint256 const key1(1);
uint256 const key2(2);
@@ -174,7 +174,7 @@ class HashRouter_test : public beast::unit_test::suite
{
using namespace std::chrono_literals;
TestStopwatch stopwatch;
HashRouter router(stopwatch, 2s, 2);
HashRouter router(stopwatch, 2s);
uint256 const key1(1);
BEAST_EXPECT(router.setFlags(key1, 10));
@@ -187,7 +187,7 @@ class HashRouter_test : public beast::unit_test::suite
{
using namespace std::chrono_literals;
TestStopwatch stopwatch;
HashRouter router(stopwatch, 1s, 2);
HashRouter router(stopwatch, 1s);
uint256 const key1(1);
@@ -225,47 +225,12 @@ class HashRouter_test : public beast::unit_test::suite
BEAST_EXPECT(peers && peers->size() == 0);
}
void
testRecover()
{
using namespace std::chrono_literals;
TestStopwatch stopwatch;
HashRouter router(stopwatch, 1s, 5);
uint256 const key1(1);
BEAST_EXPECT(router.shouldRecover(key1));
BEAST_EXPECT(router.shouldRecover(key1));
BEAST_EXPECT(router.shouldRecover(key1));
BEAST_EXPECT(router.shouldRecover(key1));
BEAST_EXPECT(router.shouldRecover(key1));
BEAST_EXPECT(!router.shouldRecover(key1));
// Expire, but since the next search will
// be for this entry, it will get refreshed
// instead.
++stopwatch;
BEAST_EXPECT(router.shouldRecover(key1));
// Expire, but since the next search will
// be for this entry, it will get refreshed
// instead.
++stopwatch;
// Recover again. Recovery is independent of
// time as long as the entry doesn't expire.
BEAST_EXPECT(router.shouldRecover(key1));
BEAST_EXPECT(router.shouldRecover(key1));
BEAST_EXPECT(router.shouldRecover(key1));
// Expire again
++stopwatch;
BEAST_EXPECT(router.shouldRecover(key1));
BEAST_EXPECT(!router.shouldRecover(key1));
}
void
testProcess()
{
using namespace std::chrono_literals;
TestStopwatch stopwatch;
HashRouter router(stopwatch, 5s, 5);
HashRouter router(stopwatch, 5s);
uint256 const key(1);
HashRouter::PeerShortID peer = 1;
int flags;
@@ -286,7 +251,6 @@ public:
testSuppression();
testSetFlags();
testRelay();
testRecover();
testProcess();
}
};