refactor: Use isFlag where possible instead of bitwise math (#7278)

This commit is contained in:
Mayukha Vadari
2026-05-15 10:00:13 -04:00
committed by GitHub
parent 15b3ed1ae7
commit 028f0cb5da
49 changed files with 242 additions and 314 deletions

View File

@@ -84,15 +84,12 @@ public:
env.fund(XRP(10000), alice, bob);
auto ar = env.le(alice);
BEAST_EXPECT(
ar->isFieldPresent(sfFlags) && ((ar->getFieldU32(sfFlags) & lsfPasswordSpent) == 0));
BEAST_EXPECT(ar->isFieldPresent(sfFlags) && !ar->isFlag(lsfPasswordSpent));
env(regkey(alice, bob), Sig(alice), Fee(0));
ar = env.le(alice);
BEAST_EXPECT(
ar->isFieldPresent(sfFlags) &&
((ar->getFieldU32(sfFlags) & lsfPasswordSpent) == lsfPasswordSpent));
BEAST_EXPECT(ar->isFieldPresent(sfFlags) && ar->isFlag(lsfPasswordSpent));
// The second SetRegularKey transaction with Fee=0 should fail.
env(regkey(alice, bob), Sig(alice), Fee(0), Ter(telINSUF_FEE_P));
@@ -100,8 +97,7 @@ public:
env.trust(bob["USD"](1), alice);
env(pay(bob, alice, bob["USD"](1)));
ar = env.le(alice);
BEAST_EXPECT(
ar->isFieldPresent(sfFlags) && ((ar->getFieldU32(sfFlags) & lsfPasswordSpent) == 0));
BEAST_EXPECT(ar->isFieldPresent(sfFlags) && !ar->isFlag(lsfPasswordSpent));
}
void