update flags

This commit is contained in:
Denis Angell
2024-04-24 13:30:12 +02:00
parent 7a4e2500bb
commit d596ceca4a
3 changed files with 23 additions and 23 deletions

View File

@@ -217,23 +217,20 @@ invoke_preclaim(PreclaimContext const& ctx)
if (id != beast::zero)
{
// TER result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j);
TER result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j);
// if (result != tesSUCCESS)
// return result;
// Ignore Sequence Validation on ttBATCH txns
TER result = tesSUCCESS;
if (result != tesSUCCESS)
return result;
result = T::checkPriorTxAndLastLedger(ctx);
if (result != tesSUCCESS)
return result;
// result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx));
result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx));
// if (result != tesSUCCESS)
// return result;
if (result != tesSUCCESS)
return result;
result = T::checkSign(ctx);
@@ -297,7 +294,7 @@ Batch::preflight(PreflightContext const& ctx)
return temMALFORMED;
}
if (txns.size() > 12)
if (txns.size() > 8)
{
JLOG(ctx.j.error()) << "Batch: txns array exceeds 12 entries.";
return temMALFORMED;
@@ -485,26 +482,28 @@ Batch::doApply()
avi.addBatchExecutionMetaData(std::move(meta));
std::cout << "tfBatchFirst: " << (flags & tfBatchFirst) << "\n";
std::cout << "tfBatchOne: " << (flags & tfBatchOne) << "\n";
std::cout << "tfAllOrNothing: " << (flags & tfAllOrNothing) << "\n";
std::cout << "tfOnlyOne: " << (flags & tfOnlyOne) << "\n";
std::cout << "tfUntilFailure: " << (flags & tfUntilFailure) << "\n";
std::cout << "tfIndependent: " << (flags & tfIndependent) << "\n";
std::cout << "tfBatchAtomic: " << _result.first << "\n";
if (_result.first != tesSUCCESS)
{
if (flags & tfBatchFirst)
if (flags & tfUntilFailure)
{
actx.discard();
result = tecBATCH_FAILURE;
break;
}
if (flags & tfBatchOne)
if (flags & tfOnlyOne)
{
actx.discard();
continue;
}
}
if (_result.first == tesSUCCESS && flags & tfBatchOne)
if (_result.first == tesSUCCESS && flags & tfOnlyOne)
{
result = tecBATCH_FAILURE;
break;

View File

@@ -169,13 +169,14 @@ constexpr std::uint32_t const tfURITokenNonMintMask = ~tfUniversal;
constexpr std::uint32_t const tfOptOut = 0x00000001;
enum BatchFlags : std::uint32_t {
tfBatchAtomic = 0x00000001,
tfBatchFirst = 0x00000002,
tfBatchOne = 0x00000004,
tfAllOrNothing = 0x00000001,
tfOnlyOne = 0x00000002,
tfUntilFailure = 0x00000004,
tfIndependent = 0x00000008,
};
constexpr std::uint32_t const tfBatchMask =
~(tfUniversal | tfBatchAtomic | tfBatchFirst);
~(tfUniversal | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent);
// clang-format on

View File

@@ -22,12 +22,12 @@
#include <ripple/protocol/jss.h>
#include <test/jtx.h>
// tfBatchOne
// tfOnlyOne
// Tx1: Payment = tecUNFUNDED => Leave
// Tx2: Payment = tesSUCCESS => Leave
// TER(tesSUCCESS)
// tfBatchFirst
// tfUntilFailure
// Tx1: Payment = tesSUCCESS => Leave
// Tx2: Payment = tecUNFUNDED => Leave
// TER(tesSUCCESS)
@@ -325,7 +325,7 @@ class Batch_test : public beast::unit_test::suite
Json::Value const tx2 = pay(alice, bob, XRP(999));
jv = addBatchTx(jv, tx2, alice, feeDrops, 1, seq + 2);
env(jv, fee(feeDrops * 2), txflags(tfBatchAtomic), ter(tecBATCH_FAILURE));
env(jv, fee(feeDrops * 2), txflags(tfAllOrNothing), ter(tecBATCH_FAILURE));
env.close();
Json::Value params;
@@ -389,7 +389,7 @@ class Batch_test : public beast::unit_test::suite
Json::Value const tx3 = pay(alice, bob, XRP(1));
jv = addBatchTx(jv, tx3, alice, feeDrops, 2, 2);
env(jv, fee(feeDrops * 3), txflags(tfBatchFirst), ter(tecBATCH_FAILURE));
env(jv, fee(feeDrops * 3), txflags(tfOnlyOne), ter(tecBATCH_FAILURE));
env.close();
Json::Value params;