mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-21 02:55:50 +00:00
Recover open ledger transactions to the queue (RIPD-1530):
* If the transaction can't be queued, recover to the open ledger once, and drop it on the next attempt. * New result codes for transactions that can not queue. * Add minimum queue size. * Remove the obsolete and incorrect SF_RETRY flag. * fix #2215
This commit is contained in:
@@ -32,7 +32,7 @@ class HashRouter_test : public beast::unit_test::suite
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
TestStopwatch stopwatch;
|
||||
HashRouter router(stopwatch, 2s);
|
||||
HashRouter router(stopwatch, 2s, 2);
|
||||
|
||||
uint256 const key1(1);
|
||||
uint256 const key2(2);
|
||||
@@ -69,7 +69,7 @@ class HashRouter_test : public beast::unit_test::suite
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
TestStopwatch stopwatch;
|
||||
HashRouter router(stopwatch, 2s);
|
||||
HashRouter router(stopwatch, 2s, 2);
|
||||
|
||||
uint256 const key1(1);
|
||||
uint256 const key2(2);
|
||||
@@ -148,7 +148,7 @@ class HashRouter_test : public beast::unit_test::suite
|
||||
// Normal HashRouter
|
||||
using namespace std::chrono_literals;
|
||||
TestStopwatch stopwatch;
|
||||
HashRouter router(stopwatch, 2s);
|
||||
HashRouter router(stopwatch, 2s, 2);
|
||||
|
||||
uint256 const key1(1);
|
||||
uint256 const key2(2);
|
||||
@@ -178,7 +178,7 @@ class HashRouter_test : public beast::unit_test::suite
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
TestStopwatch stopwatch;
|
||||
HashRouter router(stopwatch, 2s);
|
||||
HashRouter router(stopwatch, 2s, 2);
|
||||
|
||||
uint256 const key1(1);
|
||||
BEAST_EXPECT(router.setFlags(key1, 10));
|
||||
@@ -191,7 +191,7 @@ class HashRouter_test : public beast::unit_test::suite
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
TestStopwatch stopwatch;
|
||||
HashRouter router(stopwatch, 1s);
|
||||
HashRouter router(stopwatch, 1s, 2);
|
||||
|
||||
uint256 const key1(1);
|
||||
|
||||
@@ -229,6 +229,41 @@ 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));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void
|
||||
@@ -239,6 +274,7 @@ public:
|
||||
testSuppression();
|
||||
testSetFlags();
|
||||
testRelay();
|
||||
testRecover();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user