Change TER response codes from _XRP to _NATIVE. (#184)

* Change `_XRP` response codes to `_NATIVE`

* Update ServerDefinitions_test.cpp
This commit is contained in:
Denis Angell
2023-11-09 12:25:09 +01:00
committed by GitHub
parent 2a18ec563d
commit 195904574c
8 changed files with 41 additions and 41 deletions

View File

@@ -86,7 +86,7 @@ Payment::preflight(PreflightContext const& ctx)
auto const& uSrcCurrency = maxSourceAmount.getCurrency();
auto const& uDstCurrency = saDstAmount.getCurrency();
// isZero() is XRP. FIX!
// isZero() is XAH. FIX!
bool const bXRPDirect = uSrcCurrency.isZero() && uDstCurrency.isZero();
if (!isLegalNet(saDstAmount) || !isLegalNet(maxSourceAmount))
@@ -132,36 +132,36 @@ Payment::preflight(PreflightContext const& ctx)
{
// Consistent but redundant transaction.
JLOG(j.trace()) << "Malformed transaction: "
<< "SendMax specified for XRP to XRP.";
return temBAD_SEND_XRP_MAX;
<< "SendMax specified for XAH to XAH.";
return temBAD_SEND_NATIVE_MAX;
}
if (bXRPDirect && bPaths)
{
// XRP is sent without paths.
// XAH is sent without paths.
JLOG(j.trace()) << "Malformed transaction: "
<< "Paths specified for XRP to XRP.";
return temBAD_SEND_XRP_PATHS;
<< "Paths specified for XAH to XAH.";
return temBAD_SEND_NATIVE_PATHS;
}
if (bXRPDirect && partialPaymentAllowed)
{
// Consistent but redundant transaction.
JLOG(j.trace()) << "Malformed transaction: "
<< "Partial payment specified for XRP to XRP.";
return temBAD_SEND_XRP_PARTIAL;
<< "Partial payment specified for XAH to XAH.";
return temBAD_SEND_NATIVE_PARTIAL;
}
if (bXRPDirect && limitQuality)
{
// Consistent but redundant transaction.
JLOG(j.trace()) << "Malformed transaction: "
<< "Limit quality specified for XRP to XRP.";
return temBAD_SEND_XRP_LIMIT;
<< "Limit quality specified for XAH to XAH.";
return temBAD_SEND_NATIVE_LIMIT;
}
if (bXRPDirect && !defaultPathsAllowed)
{
// Consistent but redundant transaction.
JLOG(j.trace()) << "Malformed transaction: "
<< "No ripple direct specified for XRP to XRP.";
return temBAD_SEND_XRP_NO_DIRECT;
<< "No ripple direct specified for XAH to XAH.";
return temBAD_SEND_NATIVE_NO_DIRECT;
}
auto const deliverMin = tx[~sfDeliverMin];
@@ -252,7 +252,7 @@ Payment::preclaim(PreclaimContext const& ctx)
// TODO: dedupe
// Another transaction could create the account and then this
// transaction would succeed.
return tecNO_DST_INSUF_XRP;
return tecNO_DST_INSUF_NATIVE;
}
}
else if (

View File

@@ -97,11 +97,11 @@ enum TEMcodes : TERUnderlyingType {
temBAD_PATH,
temBAD_PATH_LOOP,
temBAD_REGKEY,
temBAD_SEND_XRP_LIMIT,
temBAD_SEND_XRP_MAX,
temBAD_SEND_XRP_NO_DIRECT,
temBAD_SEND_XRP_PARTIAL,
temBAD_SEND_XRP_PATHS,
temBAD_SEND_NATIVE_LIMIT,
temBAD_SEND_NATIVE_MAX,
temBAD_SEND_NATIVE_NO_DIRECT,
temBAD_SEND_NATIVE_PARTIAL,
temBAD_SEND_NATIVE_PATHS,
temBAD_SEQUENCE,
temBAD_SIGNATURE,
temBAD_SRC_ACCOUNT,
@@ -276,7 +276,7 @@ enum TECcodes : TERUnderlyingType {
tecINSUF_RESERVE_LINE = 122,
tecINSUF_RESERVE_OFFER = 123,
tecNO_DST = 124,
tecNO_DST_INSUF_XRP = 125,
tecNO_DST_INSUF_NATIVE = 125,
tecNO_LINE_INSUF_RESERVE = 126,
tecNO_LINE_REDUNDANT = 127,
tecPATH_DRY = 128,

View File

@@ -47,8 +47,8 @@ transResults()
MAKE_ERROR(tecFAILED_PROCESSING, "Failed to correctly process transaction."),
MAKE_ERROR(tecINSUF_RESERVE_LINE, "Insufficient reserve to add trust line."),
MAKE_ERROR(tecINSUF_RESERVE_OFFER, "Insufficient reserve to create offer."),
MAKE_ERROR(tecNO_DST, "Destination does not exist. Send XRP to create it."),
MAKE_ERROR(tecNO_DST_INSUF_XRP, "Destination does not exist. Too little XRP sent to create it."),
MAKE_ERROR(tecNO_DST, "Destination does not exist. Send XAH to create it."),
MAKE_ERROR(tecNO_DST_INSUF_NATIVE, "Destination does not exist. Too little XAH sent to create it."),
MAKE_ERROR(tecNO_LINE_INSUF_RESERVE, "No such line. Too little reserve to create it."),
MAKE_ERROR(tecNO_LINE_REDUNDANT, "Can't set non-existent line to default."),
MAKE_ERROR(tecPATH_DRY, "Path could not send partial amount."),
@@ -56,7 +56,7 @@ transResults()
MAKE_ERROR(tecNO_ALTERNATIVE_KEY, "The operation would remove the ability to sign transactions with the account."),
MAKE_ERROR(tecNO_REGULAR_KEY, "Regular key is not set."),
MAKE_ERROR(tecOVERSIZE, "Object exceeded serialization limits."),
MAKE_ERROR(tecUNFUNDED, "Not enough XRP to satisfy the reserve requirement."),
MAKE_ERROR(tecUNFUNDED, "Not enough XAH to satisfy the reserve requirement."),
MAKE_ERROR(tecUNFUNDED_ADD, "DEPRECATED."),
MAKE_ERROR(tecUNFUNDED_OFFER, "Insufficient balance to fund created offer."),
MAKE_ERROR(tecUNFUNDED_PAYMENT, "Insufficient balance to send."),
@@ -139,7 +139,7 @@ transResults()
MAKE_ERROR(temBAD_AMOUNT, "Can only send positive amounts."),
MAKE_ERROR(temBAD_CURRENCY, "Malformed: Bad currency."),
MAKE_ERROR(temBAD_EXPIRATION, "Malformed: Bad expiration."),
MAKE_ERROR(temBAD_FEE, "Invalid fee, negative or not XRP."),
MAKE_ERROR(temBAD_FEE, "Invalid fee, negative or not XAH."),
MAKE_ERROR(temBAD_ISSUER, "Malformed: Bad issuer."),
MAKE_ERROR(temBAD_LIMIT, "Limits must be non-negative."),
MAKE_ERROR(temBAD_OFFER, "Malformed: Bad offer."),
@@ -147,11 +147,11 @@ transResults()
MAKE_ERROR(temBAD_PATH_LOOP, "Malformed: Loop in path."),
MAKE_ERROR(temBAD_QUORUM, "Malformed: Quorum is unreachable."),
MAKE_ERROR(temBAD_REGKEY, "Malformed: Regular key cannot be same as master key."),
MAKE_ERROR(temBAD_SEND_XRP_LIMIT, "Malformed: Limit quality is not allowed for XRP to XRP."),
MAKE_ERROR(temBAD_SEND_XRP_MAX, "Malformed: Send max is not allowed for XRP to XRP."),
MAKE_ERROR(temBAD_SEND_XRP_NO_DIRECT, "Malformed: No Ripple direct is not allowed for XRP to XRP."),
MAKE_ERROR(temBAD_SEND_XRP_PARTIAL, "Malformed: Partial payment is not allowed for XRP to XRP."),
MAKE_ERROR(temBAD_SEND_XRP_PATHS, "Malformed: Paths are not allowed for XRP to XRP."),
MAKE_ERROR(temBAD_SEND_NATIVE_LIMIT, "Malformed: Limit quality is not allowed for XAH to XAH."),
MAKE_ERROR(temBAD_SEND_NATIVE_MAX, "Malformed: Send max is not allowed for XAH to XAH."),
MAKE_ERROR(temBAD_SEND_NATIVE_NO_DIRECT, "Malformed: No Ripple direct is not allowed for XAH to XAH."),
MAKE_ERROR(temBAD_SEND_NATIVE_PARTIAL, "Malformed: Partial payment is not allowed for XAH to XAH."),
MAKE_ERROR(temBAD_SEND_NATIVE_PATHS, "Malformed: Paths are not allowed for XAH to XAH."),
MAKE_ERROR(temBAD_SEQUENCE, "Malformed: Sequence is not in the past."),
MAKE_ERROR(temBAD_SIGNATURE, "Malformed: Bad signature."),
MAKE_ERROR(temBAD_SIGNER, "Malformed: No signer may duplicate account or other signers."),

View File

@@ -513,12 +513,12 @@ public:
// Verify that becky's account root is gone.
BEAST_EXPECT(!env.closed()->exists(beckyAcctKey));
// All it takes is a large enough XRP payment to resurrect
// All it takes is a large enough XAH payment to resurrect
// becky's account. Try too small a payment.
env(pay(alice,
becky,
drops(env.current()->fees().accountReserve(0)) - XRP(1)),
ter(tecNO_DST_INSUF_XRP));
ter(tecNO_DST_INSUF_NATIVE));
env.close();
// Actually resurrect becky's account.

View File

@@ -1098,7 +1098,7 @@ struct PayStrand_test : public beast::unit_test::suite
env(pay(alice, carol, XRP(100)),
path(~USD, ~XRP),
txflags(tfNoRippleDirect),
ter(temBAD_SEND_XRP_PATHS));
ter(temBAD_SEND_NATIVE_PATHS));
}
{
@@ -1117,7 +1117,7 @@ struct PayStrand_test : public beast::unit_test::suite
path(~USD, ~XRP),
sendmax(XRP(200)),
txflags(tfNoRippleDirect),
ter(temBAD_SEND_XRP_MAX));
ter(temBAD_SEND_NATIVE_MAX));
}
}

View File

@@ -52,7 +52,7 @@ class TrustAndBalance_test : public beast::unit_test::suite
using namespace test::jtx;
Env env{*this, features};
env(pay(env.master, "alice", XRP(1)), ter(tecNO_DST_INSUF_XRP));
env(pay(env.master, "alice", XRP(1)), ter(tecNO_DST_INSUF_NATIVE));
env.close();
}

View File

@@ -723,12 +723,12 @@ class AccountTx_test : public beast::unit_test::suite
}
}
// All it takes is a large enough XRP payment to resurrect
// All it takes is a large enough XAH payment to resurrect
// becky's account. Try too small a payment.
env(pay(alice,
becky,
drops(env.current()->fees().accountReserve(0)) - XRP(1)),
ter(tecNO_DST_INSUF_XRP));
ter(tecNO_DST_INSUF_NATIVE));
env.close();
// Actually resurrect becky's account.

View File

@@ -193,7 +193,7 @@ public:
"tecNO_ALTERNATIVE_KEY" : 130,
"tecNO_AUTH" : 134,
"tecNO_DST" : 124,
"tecNO_DST_INSUF_XRP" : 125,
"tecNO_DST_INSUF_NATIVE" : 125,
"tecNO_ENTRY" : 140,
"tecNO_ISSUER" : 133,
"tecNO_LINE" : 135,
@@ -285,11 +285,11 @@ public:
"temBAD_PATH_LOOP" : -290,
"temBAD_QUORUM" : -271,
"temBAD_REGKEY" : -289,
"temBAD_SEND_XRP_LIMIT" : -288,
"temBAD_SEND_XRP_MAX" : -287,
"temBAD_SEND_XRP_NO_DIRECT" : -286,
"temBAD_SEND_XRP_PARTIAL" : -285,
"temBAD_SEND_XRP_PATHS" : -284,
"temBAD_SEND_NATIVE_LIMIT" : -288,
"temBAD_SEND_NATIVE_MAX" : -287,
"temBAD_SEND_NATIVE_NO_DIRECT" : -286,
"temBAD_SEND_NATIVE_PARTIAL" : -285,
"temBAD_SEND_NATIVE_PATHS" : -284,
"temBAD_SEQUENCE" : -283,
"temBAD_SIGNATURE" : -282,
"temBAD_SIGNER" : -272,