mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 18:15:50 +00:00
Change TER response codes from _XRP to _NATIVE. (#184)
* Change `_XRP` response codes to `_NATIVE` * Update ServerDefinitions_test.cpp
This commit is contained in:
@@ -86,7 +86,7 @@ Payment::preflight(PreflightContext const& ctx)
|
|||||||
auto const& uSrcCurrency = maxSourceAmount.getCurrency();
|
auto const& uSrcCurrency = maxSourceAmount.getCurrency();
|
||||||
auto const& uDstCurrency = saDstAmount.getCurrency();
|
auto const& uDstCurrency = saDstAmount.getCurrency();
|
||||||
|
|
||||||
// isZero() is XRP. FIX!
|
// isZero() is XAH. FIX!
|
||||||
bool const bXRPDirect = uSrcCurrency.isZero() && uDstCurrency.isZero();
|
bool const bXRPDirect = uSrcCurrency.isZero() && uDstCurrency.isZero();
|
||||||
|
|
||||||
if (!isLegalNet(saDstAmount) || !isLegalNet(maxSourceAmount))
|
if (!isLegalNet(saDstAmount) || !isLegalNet(maxSourceAmount))
|
||||||
@@ -132,36 +132,36 @@ Payment::preflight(PreflightContext const& ctx)
|
|||||||
{
|
{
|
||||||
// Consistent but redundant transaction.
|
// Consistent but redundant transaction.
|
||||||
JLOG(j.trace()) << "Malformed transaction: "
|
JLOG(j.trace()) << "Malformed transaction: "
|
||||||
<< "SendMax specified for XRP to XRP.";
|
<< "SendMax specified for XAH to XAH.";
|
||||||
return temBAD_SEND_XRP_MAX;
|
return temBAD_SEND_NATIVE_MAX;
|
||||||
}
|
}
|
||||||
if (bXRPDirect && bPaths)
|
if (bXRPDirect && bPaths)
|
||||||
{
|
{
|
||||||
// XRP is sent without paths.
|
// XAH is sent without paths.
|
||||||
JLOG(j.trace()) << "Malformed transaction: "
|
JLOG(j.trace()) << "Malformed transaction: "
|
||||||
<< "Paths specified for XRP to XRP.";
|
<< "Paths specified for XAH to XAH.";
|
||||||
return temBAD_SEND_XRP_PATHS;
|
return temBAD_SEND_NATIVE_PATHS;
|
||||||
}
|
}
|
||||||
if (bXRPDirect && partialPaymentAllowed)
|
if (bXRPDirect && partialPaymentAllowed)
|
||||||
{
|
{
|
||||||
// Consistent but redundant transaction.
|
// Consistent but redundant transaction.
|
||||||
JLOG(j.trace()) << "Malformed transaction: "
|
JLOG(j.trace()) << "Malformed transaction: "
|
||||||
<< "Partial payment specified for XRP to XRP.";
|
<< "Partial payment specified for XAH to XAH.";
|
||||||
return temBAD_SEND_XRP_PARTIAL;
|
return temBAD_SEND_NATIVE_PARTIAL;
|
||||||
}
|
}
|
||||||
if (bXRPDirect && limitQuality)
|
if (bXRPDirect && limitQuality)
|
||||||
{
|
{
|
||||||
// Consistent but redundant transaction.
|
// Consistent but redundant transaction.
|
||||||
JLOG(j.trace()) << "Malformed transaction: "
|
JLOG(j.trace()) << "Malformed transaction: "
|
||||||
<< "Limit quality specified for XRP to XRP.";
|
<< "Limit quality specified for XAH to XAH.";
|
||||||
return temBAD_SEND_XRP_LIMIT;
|
return temBAD_SEND_NATIVE_LIMIT;
|
||||||
}
|
}
|
||||||
if (bXRPDirect && !defaultPathsAllowed)
|
if (bXRPDirect && !defaultPathsAllowed)
|
||||||
{
|
{
|
||||||
// Consistent but redundant transaction.
|
// Consistent but redundant transaction.
|
||||||
JLOG(j.trace()) << "Malformed transaction: "
|
JLOG(j.trace()) << "Malformed transaction: "
|
||||||
<< "No ripple direct specified for XRP to XRP.";
|
<< "No ripple direct specified for XAH to XAH.";
|
||||||
return temBAD_SEND_XRP_NO_DIRECT;
|
return temBAD_SEND_NATIVE_NO_DIRECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const deliverMin = tx[~sfDeliverMin];
|
auto const deliverMin = tx[~sfDeliverMin];
|
||||||
@@ -252,7 +252,7 @@ Payment::preclaim(PreclaimContext const& ctx)
|
|||||||
// TODO: dedupe
|
// TODO: dedupe
|
||||||
// Another transaction could create the account and then this
|
// Another transaction could create the account and then this
|
||||||
// transaction would succeed.
|
// transaction would succeed.
|
||||||
return tecNO_DST_INSUF_XRP;
|
return tecNO_DST_INSUF_NATIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
|
|||||||
@@ -97,11 +97,11 @@ enum TEMcodes : TERUnderlyingType {
|
|||||||
temBAD_PATH,
|
temBAD_PATH,
|
||||||
temBAD_PATH_LOOP,
|
temBAD_PATH_LOOP,
|
||||||
temBAD_REGKEY,
|
temBAD_REGKEY,
|
||||||
temBAD_SEND_XRP_LIMIT,
|
temBAD_SEND_NATIVE_LIMIT,
|
||||||
temBAD_SEND_XRP_MAX,
|
temBAD_SEND_NATIVE_MAX,
|
||||||
temBAD_SEND_XRP_NO_DIRECT,
|
temBAD_SEND_NATIVE_NO_DIRECT,
|
||||||
temBAD_SEND_XRP_PARTIAL,
|
temBAD_SEND_NATIVE_PARTIAL,
|
||||||
temBAD_SEND_XRP_PATHS,
|
temBAD_SEND_NATIVE_PATHS,
|
||||||
temBAD_SEQUENCE,
|
temBAD_SEQUENCE,
|
||||||
temBAD_SIGNATURE,
|
temBAD_SIGNATURE,
|
||||||
temBAD_SRC_ACCOUNT,
|
temBAD_SRC_ACCOUNT,
|
||||||
@@ -276,7 +276,7 @@ enum TECcodes : TERUnderlyingType {
|
|||||||
tecINSUF_RESERVE_LINE = 122,
|
tecINSUF_RESERVE_LINE = 122,
|
||||||
tecINSUF_RESERVE_OFFER = 123,
|
tecINSUF_RESERVE_OFFER = 123,
|
||||||
tecNO_DST = 124,
|
tecNO_DST = 124,
|
||||||
tecNO_DST_INSUF_XRP = 125,
|
tecNO_DST_INSUF_NATIVE = 125,
|
||||||
tecNO_LINE_INSUF_RESERVE = 126,
|
tecNO_LINE_INSUF_RESERVE = 126,
|
||||||
tecNO_LINE_REDUNDANT = 127,
|
tecNO_LINE_REDUNDANT = 127,
|
||||||
tecPATH_DRY = 128,
|
tecPATH_DRY = 128,
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ transResults()
|
|||||||
MAKE_ERROR(tecFAILED_PROCESSING, "Failed to correctly process transaction."),
|
MAKE_ERROR(tecFAILED_PROCESSING, "Failed to correctly process transaction."),
|
||||||
MAKE_ERROR(tecINSUF_RESERVE_LINE, "Insufficient reserve to add trust line."),
|
MAKE_ERROR(tecINSUF_RESERVE_LINE, "Insufficient reserve to add trust line."),
|
||||||
MAKE_ERROR(tecINSUF_RESERVE_OFFER, "Insufficient reserve to create offer."),
|
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, "Destination does not exist. Send XAH to create it."),
|
||||||
MAKE_ERROR(tecNO_DST_INSUF_XRP, "Destination does not exist. Too little XRP sent 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_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(tecNO_LINE_REDUNDANT, "Can't set non-existent line to default."),
|
||||||
MAKE_ERROR(tecPATH_DRY, "Path could not send partial amount."),
|
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_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(tecNO_REGULAR_KEY, "Regular key is not set."),
|
||||||
MAKE_ERROR(tecOVERSIZE, "Object exceeded serialization limits."),
|
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_ADD, "DEPRECATED."),
|
||||||
MAKE_ERROR(tecUNFUNDED_OFFER, "Insufficient balance to fund created offer."),
|
MAKE_ERROR(tecUNFUNDED_OFFER, "Insufficient balance to fund created offer."),
|
||||||
MAKE_ERROR(tecUNFUNDED_PAYMENT, "Insufficient balance to send."),
|
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_AMOUNT, "Can only send positive amounts."),
|
||||||
MAKE_ERROR(temBAD_CURRENCY, "Malformed: Bad currency."),
|
MAKE_ERROR(temBAD_CURRENCY, "Malformed: Bad currency."),
|
||||||
MAKE_ERROR(temBAD_EXPIRATION, "Malformed: Bad expiration."),
|
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_ISSUER, "Malformed: Bad issuer."),
|
||||||
MAKE_ERROR(temBAD_LIMIT, "Limits must be non-negative."),
|
MAKE_ERROR(temBAD_LIMIT, "Limits must be non-negative."),
|
||||||
MAKE_ERROR(temBAD_OFFER, "Malformed: Bad offer."),
|
MAKE_ERROR(temBAD_OFFER, "Malformed: Bad offer."),
|
||||||
@@ -147,11 +147,11 @@ transResults()
|
|||||||
MAKE_ERROR(temBAD_PATH_LOOP, "Malformed: Loop in path."),
|
MAKE_ERROR(temBAD_PATH_LOOP, "Malformed: Loop in path."),
|
||||||
MAKE_ERROR(temBAD_QUORUM, "Malformed: Quorum is unreachable."),
|
MAKE_ERROR(temBAD_QUORUM, "Malformed: Quorum is unreachable."),
|
||||||
MAKE_ERROR(temBAD_REGKEY, "Malformed: Regular key cannot be same as master key."),
|
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_NATIVE_LIMIT, "Malformed: Limit quality is not allowed for XAH to XAH."),
|
||||||
MAKE_ERROR(temBAD_SEND_XRP_MAX, "Malformed: Send max is not allowed for XRP to XRP."),
|
MAKE_ERROR(temBAD_SEND_NATIVE_MAX, "Malformed: Send max is not allowed for XAH to XAH."),
|
||||||
MAKE_ERROR(temBAD_SEND_XRP_NO_DIRECT, "Malformed: No Ripple direct is not allowed for XRP to XRP."),
|
MAKE_ERROR(temBAD_SEND_NATIVE_NO_DIRECT, "Malformed: No Ripple direct is not allowed for XAH to XAH."),
|
||||||
MAKE_ERROR(temBAD_SEND_XRP_PARTIAL, "Malformed: Partial payment is not allowed for XRP to XRP."),
|
MAKE_ERROR(temBAD_SEND_NATIVE_PARTIAL, "Malformed: Partial payment is not allowed for XAH to XAH."),
|
||||||
MAKE_ERROR(temBAD_SEND_XRP_PATHS, "Malformed: Paths are not allowed for XRP to XRP."),
|
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_SEQUENCE, "Malformed: Sequence is not in the past."),
|
||||||
MAKE_ERROR(temBAD_SIGNATURE, "Malformed: Bad signature."),
|
MAKE_ERROR(temBAD_SIGNATURE, "Malformed: Bad signature."),
|
||||||
MAKE_ERROR(temBAD_SIGNER, "Malformed: No signer may duplicate account or other signers."),
|
MAKE_ERROR(temBAD_SIGNER, "Malformed: No signer may duplicate account or other signers."),
|
||||||
|
|||||||
@@ -513,12 +513,12 @@ public:
|
|||||||
// Verify that becky's account root is gone.
|
// Verify that becky's account root is gone.
|
||||||
BEAST_EXPECT(!env.closed()->exists(beckyAcctKey));
|
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.
|
// becky's account. Try too small a payment.
|
||||||
env(pay(alice,
|
env(pay(alice,
|
||||||
becky,
|
becky,
|
||||||
drops(env.current()->fees().accountReserve(0)) - XRP(1)),
|
drops(env.current()->fees().accountReserve(0)) - XRP(1)),
|
||||||
ter(tecNO_DST_INSUF_XRP));
|
ter(tecNO_DST_INSUF_NATIVE));
|
||||||
env.close();
|
env.close();
|
||||||
|
|
||||||
// Actually resurrect becky's account.
|
// Actually resurrect becky's account.
|
||||||
|
|||||||
@@ -1098,7 +1098,7 @@ struct PayStrand_test : public beast::unit_test::suite
|
|||||||
env(pay(alice, carol, XRP(100)),
|
env(pay(alice, carol, XRP(100)),
|
||||||
path(~USD, ~XRP),
|
path(~USD, ~XRP),
|
||||||
txflags(tfNoRippleDirect),
|
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),
|
path(~USD, ~XRP),
|
||||||
sendmax(XRP(200)),
|
sendmax(XRP(200)),
|
||||||
txflags(tfNoRippleDirect),
|
txflags(tfNoRippleDirect),
|
||||||
ter(temBAD_SEND_XRP_MAX));
|
ter(temBAD_SEND_NATIVE_MAX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class TrustAndBalance_test : public beast::unit_test::suite
|
|||||||
using namespace test::jtx;
|
using namespace test::jtx;
|
||||||
|
|
||||||
Env env{*this, features};
|
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();
|
env.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
// becky's account. Try too small a payment.
|
||||||
env(pay(alice,
|
env(pay(alice,
|
||||||
becky,
|
becky,
|
||||||
drops(env.current()->fees().accountReserve(0)) - XRP(1)),
|
drops(env.current()->fees().accountReserve(0)) - XRP(1)),
|
||||||
ter(tecNO_DST_INSUF_XRP));
|
ter(tecNO_DST_INSUF_NATIVE));
|
||||||
env.close();
|
env.close();
|
||||||
|
|
||||||
// Actually resurrect becky's account.
|
// Actually resurrect becky's account.
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ public:
|
|||||||
"tecNO_ALTERNATIVE_KEY" : 130,
|
"tecNO_ALTERNATIVE_KEY" : 130,
|
||||||
"tecNO_AUTH" : 134,
|
"tecNO_AUTH" : 134,
|
||||||
"tecNO_DST" : 124,
|
"tecNO_DST" : 124,
|
||||||
"tecNO_DST_INSUF_XRP" : 125,
|
"tecNO_DST_INSUF_NATIVE" : 125,
|
||||||
"tecNO_ENTRY" : 140,
|
"tecNO_ENTRY" : 140,
|
||||||
"tecNO_ISSUER" : 133,
|
"tecNO_ISSUER" : 133,
|
||||||
"tecNO_LINE" : 135,
|
"tecNO_LINE" : 135,
|
||||||
@@ -285,11 +285,11 @@ public:
|
|||||||
"temBAD_PATH_LOOP" : -290,
|
"temBAD_PATH_LOOP" : -290,
|
||||||
"temBAD_QUORUM" : -271,
|
"temBAD_QUORUM" : -271,
|
||||||
"temBAD_REGKEY" : -289,
|
"temBAD_REGKEY" : -289,
|
||||||
"temBAD_SEND_XRP_LIMIT" : -288,
|
"temBAD_SEND_NATIVE_LIMIT" : -288,
|
||||||
"temBAD_SEND_XRP_MAX" : -287,
|
"temBAD_SEND_NATIVE_MAX" : -287,
|
||||||
"temBAD_SEND_XRP_NO_DIRECT" : -286,
|
"temBAD_SEND_NATIVE_NO_DIRECT" : -286,
|
||||||
"temBAD_SEND_XRP_PARTIAL" : -285,
|
"temBAD_SEND_NATIVE_PARTIAL" : -285,
|
||||||
"temBAD_SEND_XRP_PATHS" : -284,
|
"temBAD_SEND_NATIVE_PATHS" : -284,
|
||||||
"temBAD_SEQUENCE" : -283,
|
"temBAD_SEQUENCE" : -283,
|
||||||
"temBAD_SIGNATURE" : -282,
|
"temBAD_SIGNATURE" : -282,
|
||||||
"temBAD_SIGNER" : -272,
|
"temBAD_SIGNER" : -272,
|
||||||
|
|||||||
Reference in New Issue
Block a user