mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-04 19:25:51 +00:00
Improve Env::ter and ter() funclet
This commit is contained in:
committed by
Edward Hennis
parent
dd94de2830
commit
60002bf9bc
@@ -358,6 +358,13 @@ public:
|
||||
}
|
||||
/** @} */
|
||||
|
||||
/** Return the TER for the last JTx. */
|
||||
TER
|
||||
ter() const
|
||||
{
|
||||
return ter_;
|
||||
}
|
||||
|
||||
/** Return metadata for the last JTx.
|
||||
|
||||
Effects:
|
||||
@@ -473,6 +480,7 @@ protected:
|
||||
bool nosig_ = false;
|
||||
TestStopwatch stopwatch_;
|
||||
uint256 txid_;
|
||||
TER ter_ = tesSUCCESS;
|
||||
|
||||
void
|
||||
autofill_sig (JTx& jt);
|
||||
|
||||
@@ -42,7 +42,7 @@ struct JTx
|
||||
{
|
||||
Json::Value jv;
|
||||
requires_t requires;
|
||||
TER ter = tesSUCCESS;
|
||||
boost::optional<TER> ter = tesSUCCESS;
|
||||
bool fill_fee = true;
|
||||
bool fill_seq = true;
|
||||
bool fill_sig = true;
|
||||
|
||||
@@ -243,7 +243,6 @@ Env::trust (STAmount const& amount,
|
||||
void
|
||||
Env::submit (JTx const& jt)
|
||||
{
|
||||
TER ter;
|
||||
bool didApply;
|
||||
auto const& stx = jt.stx;
|
||||
if (stx)
|
||||
@@ -252,7 +251,7 @@ Env::submit (JTx const& jt)
|
||||
openLedger.modify(
|
||||
[&](OpenView& view, beast::Journal j)
|
||||
{
|
||||
std::tie(ter, didApply) = ripple::apply(
|
||||
std::tie(ter_, didApply) = ripple::apply(
|
||||
app(), view, *stx, applyFlags(),
|
||||
directSigVerify, config,
|
||||
beast::Journal{});
|
||||
@@ -263,12 +262,12 @@ Env::submit (JTx const& jt)
|
||||
{
|
||||
// Parsing failed or the JTx is
|
||||
// otherwise missing the stx field.
|
||||
ter = temMALFORMED;
|
||||
ter_ = temMALFORMED;
|
||||
didApply = false;
|
||||
}
|
||||
if (! test.expect(ter == jt.ter,
|
||||
"apply: " + transToken(ter) +
|
||||
" (" + transHuman(ter) + ")"))
|
||||
if (jt.ter && ! test.expect(ter_ == *jt.ter,
|
||||
"apply: " + transToken(ter_) +
|
||||
" (" + transHuman(ter_) + ")"))
|
||||
{
|
||||
test.log << pretty(jt.jv);
|
||||
// Don't check postconditions if
|
||||
@@ -283,9 +282,6 @@ Env::submit (JTx const& jt)
|
||||
}
|
||||
for (auto const& f : jt.requires)
|
||||
f(*this);
|
||||
//if (isTerRetry(ter))
|
||||
//if (! isTesSuccess(ter))
|
||||
// held.insert(stx);
|
||||
}
|
||||
|
||||
std::shared_ptr<STObject const>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define RIPPLE_TEST_JTX_TER_H_INCLUDED
|
||||
|
||||
#include <ripple/test/jtx/Env.h>
|
||||
#include <tuple>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
@@ -32,9 +33,14 @@ namespace jtx {
|
||||
class ter
|
||||
{
|
||||
private:
|
||||
TER v_;
|
||||
boost::optional<TER> v_;
|
||||
|
||||
public:
|
||||
explicit
|
||||
ter (decltype(std::ignore))
|
||||
{
|
||||
}
|
||||
|
||||
explicit
|
||||
ter (TER v)
|
||||
: v_(v)
|
||||
|
||||
Reference in New Issue
Block a user