Update error code for transfer rate error (#7115)

This commit is contained in:
yinyiqian1
2026-05-12 13:31:13 -04:00
committed by GitHub
parent d7158abb63
commit 70f03eba66
3 changed files with 10 additions and 4 deletions

View File

@@ -74,7 +74,7 @@ MPTokenIssuanceCreate::preflight(PreflightContext const& ctx)
// Confidential amounts are encrypted so transfer rate is disallowed.
if (fee > 0u && ctx.tx.isFlag(tfMPTCanConfidentialAmount))
return temMALFORMED;
return temBAD_TRANSFER_FEE;
}
if (auto const domain = ctx.tx[~sfDomainID])

View File

@@ -171,7 +171,7 @@ MPTokenIssuanceSet::preflight(PreflightContext const& ctx)
// in the same transaction is not allowed.
if ((transferFee.value_or(0) > 0u) &&
((*mutableFlags & tmfMPTSetCanConfidentialAmount) != 0u))
return temMALFORMED;
return temBAD_TRANSFER_FEE;
}
}

View File

@@ -1179,7 +1179,7 @@ class ConfidentialTransfer_test : public beast::unit_test::Suite
mptAlice.create({
.transferFee = 100,
.flags = tfMPTCanTransfer | tfMPTCanConfidentialAmount,
.err = temMALFORMED,
.err = temBAD_TRANSFER_FEE,
});
// transferFee being 0 is allowed, even with tfMPTCanConfidentialAmount
@@ -1206,7 +1206,7 @@ class ConfidentialTransfer_test : public beast::unit_test::Suite
.account = alice,
.mutableFlags = tmfMPTSetCanConfidentialAmount,
.transferFee = 100,
.err = temMALFORMED,
.err = temBAD_TRANSFER_FEE,
});
}
@@ -1249,6 +1249,12 @@ class ConfidentialTransfer_test : public beast::unit_test::Suite
.transferFee = 100,
.err = tecNO_PERMISSION,
});
// Setting transfer fee to 0 is allowed, but have no effect.
mptAlice.set({
.account = alice,
.transferFee = 0,
});
}
}