Review feedback from @mvadari

- Add a test for preflightCheckSigningKey
This commit is contained in:
Ed Hennis
2025-09-26 15:32:57 -04:00
parent d76f31cb7c
commit 66216a3d41

View File

@@ -19,6 +19,8 @@
#include <test/jtx.h>
#include <xrpld/app/tx/apply.h>
#include <xrpl/protocol/AmountConversions.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Quality.h>
@@ -578,6 +580,32 @@ public:
env.close();
}
void
testBadSigningKey()
{
using namespace test::jtx;
testcase("Bad singing key");
Env env(*this);
Account const alice("alice");
env.fund(XRP(10000), alice);
env.close();
auto jtx = env.jt(noop("alice"), ter(temBAD_SIGNATURE));
if (!BEAST_EXPECT(jtx.stx))
return;
auto stx = std::make_shared<STTx>(*jtx.stx);
stx->at(sfSigningPubKey) = makeSlice(std::string("badkey"));
env.app().openLedger().modify([&](OpenView& view, beast::Journal j) {
auto const result =
ripple::apply(env.app(), view, *stx, tapNONE, j);
BEAST_EXPECT(result.ter == temBAD_SIGNATURE);
BEAST_EXPECT(!result.applied);
return result.applied;
});
}
void
run() override
{
@@ -594,6 +622,7 @@ public:
testRequireAuthWithDir();
testTransferRate();
testTicket();
testBadSigningKey();
}
};