mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
fix for https://github.com/XRPL-Labs/xrpld-hooks/issues/69 https://github.com/Xahau/xahaud/issues/96 fix for weak tsh on uritoken, add redundant checks for various txn types
This commit is contained in:
@@ -95,9 +95,26 @@ namespace hook
|
||||
auto const owner = ut->getAccountID(sfOwner);
|
||||
auto const issuer = ut->getAccountID(sfIssuer);
|
||||
|
||||
// the issuer is a strong tsh if the burnable flag is set
|
||||
if (issuer != owner)
|
||||
ADD_TSH(issuer, ut->getFlags() & tfBurnable);
|
||||
|
||||
// three possible burn scenarios:
|
||||
// the burner is the owner and issuer of the token
|
||||
// the burner is the owner and not the issuer of the token
|
||||
// the burner is the issuer and not the owner of the token
|
||||
|
||||
if (issuer == owner)
|
||||
{
|
||||
// pass, already a TSH
|
||||
}
|
||||
else if (*otxnAcc == owner)
|
||||
{
|
||||
// the owner burns their token, and the issuer is a weak TSH
|
||||
ADD_TSH(issuer, canRollback);
|
||||
}
|
||||
else
|
||||
{
|
||||
// the issuer burns the owner's token, and the owner is a weak TSH
|
||||
ADD_TSH(owner, canRollback);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -4894,7 +4911,7 @@ DEFINE_HOOK_FUNCTION(
|
||||
}
|
||||
else if (man == 0)
|
||||
{
|
||||
out[0] = 0b11000000U;
|
||||
out[0] = 0b10000000U;
|
||||
for (int i = 1; i < 8; ++i)
|
||||
out[i] = 0;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,13 @@ ClaimReward::preflight(PreflightContext const& ctx)
|
||||
if (ctx.tx.isFieldPresent(sfFlags) && ctx.tx.getFieldU32(sfFlags) > 1)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfIssuer) && ctx.tx.getAccountID(sfIssuer) == ctx.tx.getAccountID(sfAccount))
|
||||
{
|
||||
JLOG(ctx.j.warn())
|
||||
<< "ClaimReward: Issuer cannot be the source account.";
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
return preflight2(ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +129,14 @@ Import::preflight(PreflightContext const& ctx)
|
||||
if (!ctx.rules.enabled(featureHooksUpdate1) && ctx.tx.isFieldPresent(sfIssuer))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfIssuer) &&
|
||||
ctx.tx.getAccountID(sfIssuer) == ctx.tx.getAccountID(sfAccount))
|
||||
{
|
||||
JLOG(ctx.j.warn())
|
||||
<< "Import: Issuer cannot be the source account.";
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
|
||||
return ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user