refactor: remove dead code in CreateOffer (#6541)

Removed redundant check for account creating trustline to itself.
This commit is contained in:
Mayukha Vadari
2026-03-12 17:03:35 -04:00
committed by GitHub
parent 2b14ee3018
commit 7dd3e0b3cc

View File

@@ -214,8 +214,10 @@ CreateOffer::checkAcceptAsset(
return (flags & tapRETRY) ? TER{terNO_ACCOUNT} : TER{tecNO_ISSUER};
}
// An account cannot create a trustline to itself, so no line can exist
// to be frozen. Additionally, an issuer can always accept its own
// issuance.
if (issue.account == id)
// An account can always accept its own issuance.
return tesSUCCESS;
if ((*issuerAccount)[sfFlags] & lsfRequireAuth)
@@ -242,14 +244,6 @@ CreateOffer::checkAcceptAsset(
}
}
// An account can not create a trustline to itself, so no line can exist
// to be frozen. Additionally, an issuer can always accept its own
// issuance.
if (issue.account == id)
{
return tesSUCCESS;
}
auto const trustLine = view.read(keylet::line(id, issue.account, issue.currency));
if (!trustLine)