Enforce PD is enabled if sfDomainID is set

This commit is contained in:
Bronek Kozicki
2025-03-07 15:36:01 +00:00
parent 1589498ae1
commit b0c2b97663
5 changed files with 13 additions and 6 deletions

View File

@@ -61,7 +61,9 @@ VaultCreate::preflight(PreflightContext const& ctx)
if (auto const domain = ctx.tx[~sfDomainID])
{
if (*domain == beast::zero)
if (!ctx.rules.enabled(featurePermissionedDomains))
return temDISABLED;
else if (*domain == beast::zero)
return temMALFORMED;
else if ((ctx.tx.getFlags() & tfVaultPrivate) == 0)
return temMALFORMED; // DomainID only allowed on private vaults

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2022 Ripple Labs Inc.
Copyright (c) 2025 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2022 Ripple Labs Inc.
Copyright (c) 2025 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above

View File

@@ -48,8 +48,13 @@ VaultSet::preflight(PreflightContext const& ctx)
}
auto const domain = ctx.tx[~sfDomainID];
if (domain && *domain == beast::zero)
return temMALFORMED;
if (domain)
{
if (!ctx.rules.enabled(featurePermissionedDomains))
return temDISABLED;
else if (*domain == beast::zero)
return temMALFORMED;
}
return preflight2(ctx);
}

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2022 Ripple Labs Inc.
Copyright (c) 2025 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above