mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
fix: Amendment to add transaction flag checking functionality for Credentials (#5250)
CredentialCreate / CredentialAccept / CredentialDelete transactions will check sfFlags field in preflight() when the amendment is enabled.
This commit is contained in:
@@ -1058,6 +1058,43 @@ struct Credentials_test : public beast::unit_test::suite
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
testFlags(FeatureBitset features)
|
||||
{
|
||||
using namespace test::jtx;
|
||||
|
||||
bool const enabled = features[fixInvalidTxFlags];
|
||||
testcase(
|
||||
std::string("Test flag, fix ") +
|
||||
(enabled ? "enabled" : "disabled"));
|
||||
|
||||
const char credType[] = "abcde";
|
||||
Account const issuer{"issuer"};
|
||||
Account const subject{"subject"};
|
||||
|
||||
{
|
||||
using namespace jtx;
|
||||
Env env{*this, features};
|
||||
|
||||
env.fund(XRP(5000), subject, issuer);
|
||||
env.close();
|
||||
|
||||
{
|
||||
ter const expected(
|
||||
enabled ? TER(temINVALID_FLAG) : TER(tesSUCCESS));
|
||||
env(credentials::create(subject, issuer, credType),
|
||||
txflags(tfTransferable),
|
||||
expected);
|
||||
env(credentials::accept(subject, issuer, credType),
|
||||
txflags(tfSellNFToken),
|
||||
expected);
|
||||
env(credentials::deleteCred(subject, subject, issuer, credType),
|
||||
txflags(tfPassive),
|
||||
expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
@@ -1069,6 +1106,8 @@ struct Credentials_test : public beast::unit_test::suite
|
||||
testAcceptFailed(all);
|
||||
testDeleteFailed(all);
|
||||
testFeatureFailed(all - featureCredentials);
|
||||
testFlags(all - fixInvalidTxFlags);
|
||||
testFlags(all);
|
||||
testRPC();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user