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:
Olek
2026-02-20 03:56:58 +09:00
committed by tequ
parent 76139db44e
commit e4330e6d14
2 changed files with 51 additions and 0 deletions

View File

@@ -1058,6 +1058,38 @@ struct Credentials_test : public beast::unit_test::suite
}
}
void
testFlags(FeatureBitset features)
{
using namespace test::jtx;
testcase("Test flags");
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();
{
env(credentials::create(subject, issuer, credType),
txflags(tfTransferable),
ter(temINVALID_FLAG));
env(credentials::accept(subject, issuer, credType),
txflags(tfSellNFToken),
ter(temINVALID_FLAG));
env(credentials::deleteCred(subject, subject, issuer, credType),
txflags(tfPassive),
ter(temINVALID_FLAG));
}
}
}
void
run() override
{
@@ -1069,6 +1101,7 @@ struct Credentials_test : public beast::unit_test::suite
testAcceptFailed(all);
testDeleteFailed(all);
testFeatureFailed(all - featureCredentials);
testFlags(all);
testRPC();
}
};