mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
Add and move to new tecCLAIM result codes.
This commit is contained in:
@@ -568,7 +568,7 @@ TER LedgerEntrySet::dirAdd(
|
||||
// Add to new node.
|
||||
else if (!++uNodeDir)
|
||||
{
|
||||
return terDIR_FULL;
|
||||
return tecDIR_FULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -324,7 +324,7 @@ TER OfferCreateTransactor::doApply()
|
||||
{
|
||||
cLog(lsWARNING) << "doOfferCreate: delay: Offers must be at least partially funded.";
|
||||
|
||||
terResult = terUNFUNDED;
|
||||
terResult = tecUNFUNDED;
|
||||
}
|
||||
|
||||
if (tesSUCCESS == terResult && !saTakerPays.isNative())
|
||||
@@ -398,13 +398,13 @@ TER OfferCreateTransactor::doApply()
|
||||
if (isSetBit(mParams, tapOPEN_LEDGER)) // Ledger is not final, can vote no.
|
||||
{
|
||||
// Hope for more reserve to come in or more offers to consume.
|
||||
terResult = terINSUF_RESERVE_OFFER;
|
||||
terResult = tecINSUF_RESERVE_OFFER;
|
||||
}
|
||||
else if (!saOfferPaid && !saOfferGot)
|
||||
{
|
||||
// Ledger is final, insufficent reserve to create offer, processed nothing.
|
||||
|
||||
terResult = tepINSUF_RESERVE_OFFER;
|
||||
terResult = tecINSUF_RESERVE_OFFER;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ TER PaymentTransactor::doApply()
|
||||
cLog(lsINFO) << "doPayment: Delay transaction: Destination account does not exist.";
|
||||
|
||||
// Another transaction could create the account and then this transaction would succeed.
|
||||
return terNO_DST;
|
||||
return tecNO_DST;
|
||||
}
|
||||
else if (isSetBit(mParams, tapOPEN_LEDGER) // Ledger is not final, can vote no.
|
||||
&& saDstAmount.getNValue() < mEngine->getLedger()->getReserve(0)) // Reserve is not scaled by load.
|
||||
@@ -91,7 +91,7 @@ TER PaymentTransactor::doApply()
|
||||
cLog(lsINFO) << "doPayment: Delay transaction: Destination account does not exist. Insufficent payment to create account.";
|
||||
|
||||
// Another transaction could create the account and then this transaction would succeed.
|
||||
return terNO_DST_INSUF_XRP;
|
||||
return tecNO_DST_INSUF_XRP;
|
||||
}
|
||||
|
||||
// Create the account.
|
||||
@@ -152,7 +152,7 @@ TER PaymentTransactor::doApply()
|
||||
cLog(lsINFO) << boost::str(boost::format("doPayment: Delay transaction: Insufficient funds: %s / %s (%d)")
|
||||
% saSrcXRPBalance.getText() % (saDstAmount + uReserve).getText() % uReserve);
|
||||
|
||||
terResult = terUNFUNDED;
|
||||
terResult = tecUNFUNDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ TER PathState::pushImply(
|
||||
|
||||
// Append a node and insert before it any implied nodes.
|
||||
// Offers may go back to back.
|
||||
// <-- terResult: tesSUCCESS, temBAD_PATH, terNO_LINE, tepPATH_DRY
|
||||
// <-- terResult: tesSUCCESS, temBAD_PATH, terNO_LINE, tecPATH_DRY
|
||||
TER PathState::pushNode(
|
||||
const int iType,
|
||||
const uint160& uAccountID,
|
||||
@@ -235,7 +235,7 @@ TER PathState::pushNode(
|
||||
|
||||
if (!saOwed.isPositive() && *saOwed.negate() >= lesEntries.rippleLimit(pnCur.uAccountID, pnBck.uAccountID, pnCur.uCurrencyID))
|
||||
{
|
||||
terResult = tepPATH_DRY;
|
||||
terResult = tecPATH_DRY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1148,7 +1148,7 @@ TER RippleCalc::calcNodeDeliverRev(
|
||||
}
|
||||
|
||||
if (!saOutAct)
|
||||
terResult = tepPATH_DRY;
|
||||
terResult = tecPATH_DRY;
|
||||
|
||||
return terResult;
|
||||
}
|
||||
@@ -1540,7 +1540,7 @@ void RippleCalc::calcNodeRipple(
|
||||
// Reedems are limited based on IOUs previous has on hand.
|
||||
// Issues are limited based on credit limits and amount owed.
|
||||
// No account balance adjustments as we don't know how much is going to actually be pushed through yet.
|
||||
// <-- tesSUCCESS or tepPATH_DRY
|
||||
// <-- tesSUCCESS or tecPATH_DRY
|
||||
TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, const bool bMultiQuality)
|
||||
{
|
||||
TER terResult = tesSUCCESS;
|
||||
@@ -1688,7 +1688,7 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, c
|
||||
if (!saCurWantedAct)
|
||||
{
|
||||
// Must have processed something.
|
||||
terResult = tepPATH_DRY;
|
||||
terResult = tecPATH_DRY;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1751,7 +1751,7 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, c
|
||||
if (!saCurRedeemAct && !saCurIssueAct)
|
||||
{
|
||||
// Did not make progress.
|
||||
terResult = tepPATH_DRY;
|
||||
terResult = tecPATH_DRY;
|
||||
}
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeAccountRev: ^|account --> ACCOUNT --> account : saCurRedeemReq=%s saCurIssueReq=%s saPrvOwed=%s saCurRedeemAct=%s saCurIssueAct=%s")
|
||||
@@ -1790,7 +1790,7 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, c
|
||||
if (!saCurDeliverAct)
|
||||
{
|
||||
// Must want something.
|
||||
terResult = tepPATH_DRY;
|
||||
terResult = tecPATH_DRY;
|
||||
}
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeAccountRev: saCurDeliverReq=%s saCurDeliverAct=%s saPrvOwed=%s")
|
||||
@@ -1870,7 +1870,7 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, c
|
||||
if (!saCurDeliverAct)
|
||||
{
|
||||
// Must want something.
|
||||
terResult = tepPATH_DRY;
|
||||
terResult = tecPATH_DRY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2224,7 +2224,7 @@ TER RippleCalc::calcNodeFwd(const unsigned int uNode, PathState& psCur, const bo
|
||||
// Calculate a node and its previous nodes.
|
||||
// From the destination work in reverse towards the source calculating how much must be asked for.
|
||||
// Then work forward, figuring out how much can actually be delivered.
|
||||
// <-- terResult: tesSUCCESS or tepPATH_DRY
|
||||
// <-- terResult: tesSUCCESS or tecPATH_DRY
|
||||
// <-> pnNodes:
|
||||
// --> [end]saWanted.mAmount
|
||||
// --> [all]saWanted.mCurrency
|
||||
@@ -2579,8 +2579,7 @@ cLog(lsDEBUG) << boost::str(boost::format("rippleCalc: Summary: %d rate: %s qual
|
||||
else if (!saDstAmountAct)
|
||||
{
|
||||
// No payment at all.
|
||||
terResult = tepPATH_DRY;
|
||||
lesActive = lesBase; // Revert to just fees charged.
|
||||
terResult = tecPATH_DRY; // Revert to just fees charged is built into tec.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8,6 +8,18 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
|
||||
const char* cpToken;
|
||||
const char* cpHuman;
|
||||
} transResultInfoA[] = {
|
||||
{ tecCLAIM, "tecCLAIM", "Fee claim. Sequence used. No action." },
|
||||
{ tecDIR_FULL, "tecDIR_FULL", "Can not add entry to full dir." },
|
||||
{ tecINSUF_RESERVE_LINE, "tecINSUF_RESERVE_LINE", "Insufficent reserve to add trust line." },
|
||||
{ tecINSUF_RESERVE_OFFER, "tecINSUF_RESERVE_OFFER", "Insufficent reserve to create offer." },
|
||||
{ tecNO_DST, "tecNO_DST", "Destination does not exist. Send XRP to create it." },
|
||||
{ tecNO_DST_INSUF_XRP, "tecNO_DST_INSUF_XRP", "Destination does not exist. Too little XRP sent to create it." },
|
||||
{ tecNO_LINE_INSUF_RESERVE, "tecNO_LINE_INSUF_RESERVE", "No such line. Too little reserve to create it." },
|
||||
{ tecNO_LINE_REDUNDANT, "tecNO_LINE_REDUNDANT", "Can't set non-existant line to default." },
|
||||
{ tecPATH_DRY, "tecPATH_DRY", "Path could not send partial amount." },
|
||||
{ tecUNFUNDED, "tecUNFUNDED", "Source account had insufficient balance for transaction." },
|
||||
|
||||
{ tefFAILURE, "tefFAILURE", "Failed to apply." },
|
||||
{ tefALREADY, "tefALREADY", "The exact transaction was already in this ledger." },
|
||||
{ tefBAD_ADD_AUTH, "tefBAD_ADD_AUTH", "Not authorized to add account." },
|
||||
{ tefBAD_AUTH, "tefBAD_AUTH", "Transaction's public key is not authorized." },
|
||||
@@ -20,9 +32,11 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
|
||||
{ tefGEN_IN_USE, "tefGEN_IN_USE", "Generator already in use." },
|
||||
{ tefPAST_SEQ, "tefPAST_SEQ", "This sequence number has already past" },
|
||||
|
||||
{ telLOCAL_ERROR, "telLOCAL_ERROR", "Local failure." },
|
||||
{ telBAD_PATH_COUNT, "telBAD_PATH_COUNT", "Malformed: too many paths." },
|
||||
{ telINSUF_FEE_P, "telINSUF_FEE_P", "Fee insufficient." },
|
||||
|
||||
{ temMALFORMED, "temMALFORMED", "Malformed transaction." },
|
||||
{ temBAD_AMOUNT, "temBAD_AMOUNT", "Can only send positive amounts." },
|
||||
{ temBAD_AUTH_MASTER, "temBAD_AUTH_MASTER", "Auth for unclaimed account needs correct master key." },
|
||||
{ temBAD_EXPIRATION, "temBAD_EXPIRATION", "Malformed." },
|
||||
@@ -44,24 +58,17 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
|
||||
{ temUNCERTAIN, "temUNCERTAIN", "In process of determining result. Never returned." },
|
||||
{ temUNKNOWN, "temUNKNOWN", "The transactions requires logic not implemented yet." },
|
||||
|
||||
{ tepPATH_DRY, "tepPATH_DRY", "Path could not send partial amount." },
|
||||
{ tepPATH_PARTIAL, "tepPATH_PARTIAL", "Path could not send full amount." },
|
||||
{ tepPARTIAL, "tepPARTIAL", "Partial success." },
|
||||
{ tepINSUF_RESERVE_OFFER, "tepINSUF_RESERVE_OFFER", "Insufficent reserve to create offer." },
|
||||
{ tepPATH_DRY, "tepPATH_DRY", "Path could not send partial amount. Obsolete." },
|
||||
{ tepPATH_PARTIAL, "tepPATH_PARTIAL", "Path could not send full amount." },
|
||||
|
||||
{ terDIR_FULL, "terDIR_FULL", "Can not add entry to full dir." },
|
||||
{ terRETRY, "terRETRY", "Retry transaction." },
|
||||
{ terFUNDS_SPENT, "terFUNDS_SPENT", "Can't set password, password set funds already spent." },
|
||||
{ terINSUF_FEE_B, "terINSUF_FEE_B", "Account balance can't pay fee." },
|
||||
{ terINSUF_RESERVE_LINE, "terINSUF_RESERVE_LINE", "Insufficent reserve to add trust line." },
|
||||
{ terINSUF_RESERVE_OFFER, "terINSUF_RESERVE_OFFER", "Insufficent reserve to create offer." },
|
||||
{ terNO_ACCOUNT, "terNO_ACCOUNT", "The source account does not exist." },
|
||||
{ terNO_DST, "terNO_DST", "Destination does not exist. Send XRP to create it." },
|
||||
{ terNO_DST_INSUF_XRP, "terNO_DST_INSUF_XRP", "Destination does not exist. Too little XRP sent to create it." },
|
||||
{ terNO_LINE, "terNO_LINE", "No such line." },
|
||||
{ terNO_LINE_INSUF_RESERVE, "terNO_LINE_INSUF_RESERVE", "No such line. Too little reserve to create it." },
|
||||
{ terNO_LINE_REDUNDANT, "terNO_LINE_REDUNDANT", "Can't set non-existant line to default." },
|
||||
{ terPRE_SEQ, "terPRE_SEQ", "Missing/inapplicable prior transaction." },
|
||||
{ terSET_MISSING_DST, "terSET_MISSING_DST", "Can't set password, destination missing." },
|
||||
{ terUNFUNDED, "terUNFUNDED", "Source account had insufficient balance for transaction." },
|
||||
|
||||
{ tesSUCCESS, "tesSUCCESS", "The transaction was applied." },
|
||||
};
|
||||
|
||||
@@ -76,21 +76,13 @@ enum TER // aka TransactionEngineResult
|
||||
// - Not forwarded
|
||||
// - Might succeed later
|
||||
// - Hold
|
||||
// - Makes hole in sequence which jams transactions.
|
||||
terRETRY = -99,
|
||||
terDIR_FULL,
|
||||
terFUNDS_SPENT,
|
||||
terINSUF_FEE_B,
|
||||
terINSUF_RESERVE_LINE,
|
||||
terINSUF_RESERVE_OFFER,
|
||||
terNO_ACCOUNT,
|
||||
terNO_DST,
|
||||
terNO_DST_INSUF_XRP,
|
||||
terNO_LINE,
|
||||
terNO_LINE_INSUF_RESERVE,
|
||||
terNO_LINE_REDUNDANT,
|
||||
terPRE_SEQ,
|
||||
terSET_MISSING_DST,
|
||||
terUNFUNDED,
|
||||
terFUNDS_SPENT, // This is a free transaction, therefore don't burden network.
|
||||
terINSUF_FEE_B, // Can't pay fee, therefore don't burden network.
|
||||
terNO_ACCOUNT, // Can't pay fee, therefore don't burden network.
|
||||
terNO_LINE, // Internal flag.
|
||||
terPRE_SEQ, // Can't pay fee, no point in forwarding, therefore don't burden network.
|
||||
|
||||
// 0: S Success (success)
|
||||
// Causes:
|
||||
@@ -100,18 +92,39 @@ enum TER // aka TransactionEngineResult
|
||||
// - Forwarded
|
||||
tesSUCCESS = 0,
|
||||
|
||||
// 100 .. P Partial success (SR) (ripple transaction with no good paths, pay to non-existent account)
|
||||
// 100 .. 119 P Partial success (SR) (ripple transaction with no good paths, pay to non-existent account)
|
||||
// Causes:
|
||||
// - Success, but does not achieve optimal result.
|
||||
// Implications:
|
||||
// - Applied
|
||||
// - Forwarded
|
||||
// Only allowed as a return code of appliedTransaction when !tapRetry. Otherwise, treated as terRETRY.
|
||||
// CAUTION: The numerical values for these results are part of the binary formats
|
||||
//
|
||||
// DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data.
|
||||
tepPARTIAL = 100,
|
||||
tepPATH_DRY = 101,
|
||||
tepPATH_DRY = 101, // Obsolete. May exist in ledger.
|
||||
tepPATH_PARTIAL = 102,
|
||||
tepINSUF_RESERVE_OFFER = 103,
|
||||
tepINSUF_RESERVE_OFFER = 103, // Obsolete. May exist in ledger.
|
||||
|
||||
// 120 .. C Claim fee only (CO) (no path)
|
||||
// Causes:
|
||||
// - Invalid transaction or no effect, but claim fee to use the sequence number.
|
||||
// Implications:
|
||||
// - Applied
|
||||
// - Forwarded
|
||||
// Only allowed as a return code of appliedTransaction when !tapRetry. Otherwise, treated as terRETRY.
|
||||
//
|
||||
// DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data.
|
||||
tecCLAIM = 120,
|
||||
tecDIR_FULL = 121,
|
||||
tecINSUF_RESERVE_LINE = 122,
|
||||
tecINSUF_RESERVE_OFFER = 123,
|
||||
tecNO_DST = 124,
|
||||
tecNO_DST_INSUF_XRP = 125,
|
||||
tecNO_LINE_INSUF_RESERVE = 126,
|
||||
tecNO_LINE_REDUNDANT = 127,
|
||||
tecPATH_DRY = 128,
|
||||
tecUNFUNDED = 129,
|
||||
};
|
||||
|
||||
#define isTelLocal(x) ((x) >= telLOCAL_ERROR && (x) < temMALFORMED)
|
||||
@@ -119,7 +132,8 @@ enum TER // aka TransactionEngineResult
|
||||
#define isTefFailure(x) ((x) >= tefFAILURE && (x) < terRETRY)
|
||||
#define isTerRetry(x) ((x) >= terRETRY && (x) < tesSUCCESS)
|
||||
#define isTepSuccess(x) ((x) >= tesSUCCESS)
|
||||
#define isTepPartial(x) ((x) >= tepPATH_PARTIAL)
|
||||
#define isTepPartial(x) ((x) >= tepPATH_PARTIAL && (x) < tecCLAIM)
|
||||
#define isTecClaim(x) ((x) >= tepCLAIM)
|
||||
|
||||
bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman);
|
||||
std::string transToken(TER terCode);
|
||||
|
||||
@@ -53,7 +53,7 @@ TER TrustSetTransactor::doApply()
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Delay transaction: Destination account does not exist.";
|
||||
|
||||
return terNO_DST;
|
||||
return tecNO_DST;
|
||||
}
|
||||
|
||||
const STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
|
||||
@@ -241,7 +241,7 @@ TER TrustSetTransactor::doApply()
|
||||
cLog(lsINFO) << "doTrustSet: Delay transaction: Insufficent reserve to add trust line.";
|
||||
|
||||
// Another transaction could provide XRP to the account and then this transaction would succeed.
|
||||
terResult = terINSUF_RESERVE_LINE;
|
||||
terResult = tecINSUF_RESERVE_LINE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -257,7 +257,7 @@ TER TrustSetTransactor::doApply()
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Redundant: Setting non-existent ripple line to defaults.";
|
||||
|
||||
return terNO_LINE_REDUNDANT;
|
||||
return tecNO_LINE_REDUNDANT;
|
||||
}
|
||||
else if (isSetBit(mParams, tapOPEN_LEDGER) // Ledger is not final, we can vote no.
|
||||
&& saSrcXRPBalance.getNValue() < uReserveCreate) // Reserve is not scaled by load.
|
||||
@@ -265,7 +265,7 @@ TER TrustSetTransactor::doApply()
|
||||
cLog(lsINFO) << "doTrustSet: Delay transaction: Line does not exist. Insufficent reserve to create line.";
|
||||
|
||||
// Another transaction could create the account and then this transaction would succeed.
|
||||
terResult = terNO_LINE_INSUF_RESERVE;
|
||||
terResult = tecNO_LINE_INSUF_RESERVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ TER WalletAddTransactor::doApply()
|
||||
% saAmount.getText())
|
||||
<< std::endl;
|
||||
|
||||
return terUNFUNDED;
|
||||
return tecUNFUNDED;
|
||||
}
|
||||
|
||||
// Deduct initial balance from source account.
|
||||
@@ -56,3 +56,5 @@ TER WalletAddTransactor::doApply()
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -481,7 +481,7 @@ buster.testCase("Offer tests", {
|
||||
.offer_create("bob", "50/USD/alice", "200/EUR/carol")
|
||||
.on('proposed', function (m) {
|
||||
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
||||
callback(m.result !== 'terUNFUNDED');
|
||||
callback(m.result !== 'tecUNFUNDED');
|
||||
|
||||
seq = m.tx_json.Sequence;
|
||||
})
|
||||
|
||||
@@ -80,7 +80,7 @@ buster.testCase("Sending", {
|
||||
// Transaction got an error.
|
||||
// console.log("proposed: %s", JSON.stringify(m));
|
||||
|
||||
buster.assert.equals(m.result, 'terNO_DST_INSUF_XRP');
|
||||
buster.assert.equals(m.result, 'tecNO_DST_INSUF_XRP');
|
||||
|
||||
got_proposed = true;
|
||||
|
||||
@@ -100,15 +100,15 @@ buster.testCase("Sending", {
|
||||
.submit();
|
||||
},
|
||||
|
||||
// Also test transaction becomes lost after terNO_DST.
|
||||
"credit_limit to non-existent account = terNO_DST" :
|
||||
// Also test transaction becomes lost after tecNO_DST.
|
||||
"credit_limit to non-existent account = tecNO_DST" :
|
||||
function (done) {
|
||||
this.remote.transaction()
|
||||
.ripple_line_set("root", "100/USD/alice")
|
||||
.on('proposed', function (m) {
|
||||
//console.log("proposed: %s", JSON.stringify(m));
|
||||
|
||||
buster.assert.equals(m.result, 'terNO_DST');
|
||||
buster.assert.equals(m.result, 'tecNO_DST');
|
||||
|
||||
done();
|
||||
})
|
||||
@@ -431,7 +431,7 @@ buster.testCase("Sending future", {
|
||||
.payment('bob', 'alice', "1/USD/bob")
|
||||
.once('proposed', function (m) {
|
||||
// console.log("proposed: %s", JSON.stringify(m));
|
||||
callback(m.result !== 'tepPATH_DRY');
|
||||
callback(m.result !== 'tecPATH_DRY');
|
||||
})
|
||||
.submit();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user