bug fixes

This commit is contained in:
Richard Holland
2023-07-12 08:02:04 +00:00
parent 076b8e3e11
commit 152780b218
5 changed files with 11 additions and 22 deletions

View File

@@ -131,20 +131,6 @@ Import::preflight(PreflightContext const& ctx)
auto& tx = ctx.tx;
if (tx.getFieldAmount(sfFee) != beast::zero)
{
if (tx.isFieldPresent(sfIssuer))
{
// pass. Import against a Hook does pay a fee
}
else
{
JLOG(ctx.j.warn())
<< "Import: sfFee must be 0 "
<< tx.getTransactionID();
return temMALFORMED;
}
}
if (tx.getFieldVL(sfBlob).size() > (512 * 1024))
{

View File

@@ -1021,11 +1021,12 @@ std::pair<TER, XRPAmount>
Transactor::reset(XRPAmount fee)
{
ApplyViewImpl& avi = dynamic_cast<ApplyViewImpl&>(ctx_.view());
std::vector<STObject> hookMeta;
avi.copyHookMetaData(hookMeta);
std::vector<STObject> executions;
std::vector<STObject> emissions;
avi.copyHookMetaData(executions, emissions);
ctx_.discard();
ApplyViewImpl& avi2 = dynamic_cast<ApplyViewImpl&>(ctx_.view());
avi2.setHookMetaData(std::move(hookMeta));
avi2.setHookMetaData(std::move(executions), std::move(emissions));
auto const txnAcct =
view().peek(keylet::account(ctx_.tx.getAccountID(sfAccount)));

View File

@@ -202,7 +202,6 @@ invoke_preclaim(PreclaimContext const& ctx)
return result;
result =
ctx.tx.getTxnType() == ttIMPORT ? tesSUCCESS :
T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx));
if (result != tesSUCCESS)

View File

@@ -91,15 +91,17 @@ public:
}
void
setHookMetaData(std::vector<STObject>&& vec)
setHookMetaData(std::vector<STObject>&& executions, std::vector<STObject>&& emissions)
{
hookExecution_ = std::move(vec);
hookExecution_ = std::move(executions);
hookEmission_ = std::move(emissions);
}
void
copyHookMetaData(std::vector<STObject>& into)
copyHookMetaData(std::vector<STObject>& execution /* in */, std::vector<STObject>& emission /* in */)
{
std::copy(hookExecution_.begin(), hookExecution_.end(), std::back_inserter(into));
std::copy(hookExecution_.begin(), hookExecution_.end(), std::back_inserter(execution));
std::copy(hookEmission_.begin(), hookEmission_.end(), std::back_inserter(emission));
}
uint16_t

View File

@@ -2582,6 +2582,7 @@ class Import_test : public beast::unit_test::suite
auto const [signers, signersSle] =
signersKeyAndSle(*env.current(), alice);
BEAST_REQUIRE(!!signersSle);
auto const signerEntries =
signersSle->getFieldArray(sfSignerEntries);
BEAST_EXPECT(signerEntries.size() == 1);