Retried transactions that tec move from TxQ to open ledger:

* Unit test of tec code handling.
* Extra TxQ debug logging
This commit is contained in:
Edward Hennis
2018-05-31 15:13:54 -04:00
committed by Nik Bougalis
parent 7427cf7506
commit 16b9bbb517
12 changed files with 140 additions and 41 deletions

View File

@@ -115,7 +115,7 @@ public:
{
OpenView accum(&*res);
applyTransaction(
env.app(), accum, *stx, false, tapNO_CHECK_SIGN, env.journal);
env.app(), accum, *stx, false, tapNONE, env.journal);
accum.apply(*res);
}
res->updateSkipList();

View File

@@ -48,7 +48,7 @@ struct LedgerReplay_test : public beast::unit_test::suite
auto const replayed = buildLedger(
LedgerReplay(lastClosedParent,lastClosed),
tapNO_CHECK_SIGN,
tapNONE,
env.app(),
env.journal);

View File

@@ -344,6 +344,41 @@ public:
256);
}
void testTecResult()
{
using namespace jtx;
Env env(*this,
makeConfig({ { "minimum_txn_in_ledger_standalone", "2" } }));
auto alice = Account("alice");
auto gw = Account("gw");
auto USD = gw["USD"];
checkMetrics(env, 0, boost::none, 0, 2, 256);
// Create accounts
env.fund(XRP(50000), noripple(alice, gw));
checkMetrics(env, 0, boost::none, 2, 2, 256);
env.close();
checkMetrics(env, 0, 4, 0, 2, 256);
// Alice creates an unfunded offer while the ledger is not full
env(offer(alice, XRP(1000), USD(1000)), ter(tecUNFUNDED_OFFER));
checkMetrics(env, 0, 4, 1, 2, 256);
fillQueue(env, alice);
checkMetrics(env, 0, 4, 3, 2, 256);
// Alice creates an unfunded offer that goes in the queue
env(offer(alice, XRP(1000), USD(1000)), ter(terQUEUED));
checkMetrics(env, 1, 4, 3, 2, 256);
// The offer comes out of the queue
env.close();
checkMetrics(env, 0, 6, 1, 3, 256);
}
void testLocalTxRetry()
{
using namespace jtx;

View File

@@ -363,25 +363,25 @@ class View_test
BEAST_EXPECT(v1.parentCloseTime() ==
v1.parentCloseTime());
ApplyViewImpl v2(&v1, tapNO_CHECK_SIGN);
ApplyViewImpl v2(&v1, tapRETRY);
BEAST_EXPECT(v2.parentCloseTime() ==
v1.parentCloseTime());
BEAST_EXPECT(v2.seq() == v1.seq());
BEAST_EXPECT(v2.flags() == tapNO_CHECK_SIGN);
BEAST_EXPECT(v2.flags() == tapRETRY);
Sandbox v3(&v2);
BEAST_EXPECT(v3.seq() == v2.seq());
BEAST_EXPECT(v3.parentCloseTime() ==
v2.parentCloseTime());
BEAST_EXPECT(v3.flags() == tapNO_CHECK_SIGN);
BEAST_EXPECT(v3.flags() == tapRETRY);
}
{
ApplyViewImpl v1(&v0, tapNO_CHECK_SIGN);
ApplyViewImpl v1(&v0, tapRETRY);
PaymentSandbox v2(&v1);
BEAST_EXPECT(v2.seq() == v0.seq());
BEAST_EXPECT(v2.parentCloseTime() ==
v0.parentCloseTime());
BEAST_EXPECT(v2.flags() == tapNO_CHECK_SIGN);
BEAST_EXPECT(v2.flags() == tapRETRY);
PaymentSandbox v3(&v2);
BEAST_EXPECT(v3.seq() == v2.seq());
BEAST_EXPECT(v3.parentCloseTime() ==