From a173dd20e223d7965b73b89afcd768e426cedc17 Mon Sep 17 00:00:00 2001 From: Bronek Kozicki Date: Mon, 24 Mar 2025 11:45:50 +0000 Subject: [PATCH] Disallow regular Clawback on Vault accounts --- include/xrpl/protocol/TER.h | 1 + src/libxrpl/protocol/TER.cpp | 1 + src/xrpld/app/tx/detail/Clawback.cpp | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/include/xrpl/protocol/TER.h b/include/xrpl/protocol/TER.h index 06a1b34bd0..ce2695a8f9 100644 --- a/include/xrpl/protocol/TER.h +++ b/include/xrpl/protocol/TER.h @@ -347,6 +347,7 @@ enum TECcodes : TERUnderlyingType { tecWRONG_ASSET = 194, tecLIMIT_EXCEEDED = 195, tecINVALID_DOMAIN = 196, + tecVAULT_ACCOUNT = 197, }; //------------------------------------------------------------------------------ diff --git a/src/libxrpl/protocol/TER.cpp b/src/libxrpl/protocol/TER.cpp index e9c6a79caf..5bd27fe856 100644 --- a/src/libxrpl/protocol/TER.cpp +++ b/src/libxrpl/protocol/TER.cpp @@ -126,6 +126,7 @@ transResults() MAKE_ERROR(tecWRONG_ASSET, "Wrong asset given."), MAKE_ERROR(tecLIMIT_EXCEEDED, "Limit exceeded."), MAKE_ERROR(tecINVALID_DOMAIN, "Invalid permissioned domain."), + MAKE_ERROR(tecVAULT_ACCOUNT, "This operation is not allowed on a Vault Account."), MAKE_ERROR(tefALREADY, "The exact transaction was already in this ledger."), MAKE_ERROR(tefBAD_ADD_AUTH, "Not authorized to add account."), diff --git a/src/xrpld/app/tx/detail/Clawback.cpp b/src/xrpld/app/tx/detail/Clawback.cpp index e58faf2286..155ea5c7f8 100644 --- a/src/xrpld/app/tx/detail/Clawback.cpp +++ b/src/xrpld/app/tx/detail/Clawback.cpp @@ -210,6 +210,10 @@ Clawback::preclaim(PreclaimContext const& ctx) if (sleHolder->isFieldPresent(sfAMMID)) return tecAMM_ACCOUNT; + if (ctx.view.rules().enabled(featureSingleAssetVault) && + sleHolder->isFieldPresent(sfVaultID)) + return tecVAULT_ACCOUNT; + return std::visit( [&](T const&) { return preclaimHelper(