diff --git a/src/cpp/ripple/OfferCreateTransactor.cpp b/src/cpp/ripple/OfferCreateTransactor.cpp index e4b59be8c..8155956f2 100644 --- a/src/cpp/ripple/OfferCreateTransactor.cpp +++ b/src/cpp/ripple/OfferCreateTransactor.cpp @@ -458,8 +458,19 @@ TER OfferCreateTransactor::doApply() // cLog(lsWARNING) << "OfferCreate: takeOffers: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID); // cLog(lsWARNING) << "OfferCreate: takeOffers: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID); - if (tesSUCCESS != terResult - || !saTakerPays // Wants nothing more. + if (tesSUCCESS != terResult) + { + // Fail as is. + nothing(); + } + else if (saTakerPays.isNegative() || saTakerGets.isNegative()) + { + terResult = isSetBit(mParams, tapOPEN_LEDGER) + ? telFAILED_PROCESSING // Ledger is not final, can vote no. + : tecFAILED_PROCESSING; + } + else if ( + !saTakerPays // Wants nothing more. || !saTakerGets // Offering nothing more. || bMarket // Do not persist. || !mEngine->getNodes().accountFunds(mTxnAccountID, saTakerGets).isPositive() // Not funded. diff --git a/src/cpp/ripple/TransactionErr.cpp b/src/cpp/ripple/TransactionErr.cpp index 3ffe6d639..a605a2f49 100644 --- a/src/cpp/ripple/TransactionErr.cpp +++ b/src/cpp/ripple/TransactionErr.cpp @@ -10,6 +10,7 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman) } transResultInfoA[] = { { tecCLAIM, "tecCLAIM", "Fee claimed. Sequence used. No action." }, { tecDIR_FULL, "tecDIR_FULL", "Can not add entry to full directory." }, + { tecFAILED_PROCESSING, "tecFAILED_PROCESSING", "Failed to correctly process transaction." }, { 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." }, @@ -42,6 +43,7 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman) { telBAD_DOMAIN, "telBAD_DOMAIN", "Domain too long." }, { telBAD_PATH_COUNT, "telBAD_PATH_COUNT", "Malformed: Too many paths." }, { telBAD_PUBLIC_KEY, "telBAD_PUBLIC_KEY", "Public key too long." }, + { telFAILED_PROCESSING, "telFAILED_PROCESSING", "Failed to correctly process transaction." }, { telINSUF_FEE_P, "telINSUF_FEE_P", "Fee insufficient." }, { telNO_DST_PARTIAL, "telNO_DST_PARTIAL", "Partial payment to create account not allowed." }, diff --git a/src/cpp/ripple/TransactionErr.h b/src/cpp/ripple/TransactionErr.h index 97f33f091..a1d9fb690 100644 --- a/src/cpp/ripple/TransactionErr.h +++ b/src/cpp/ripple/TransactionErr.h @@ -16,6 +16,7 @@ enum TER // aka TransactionEngineResult telBAD_DOMAIN, telBAD_PATH_COUNT, telBAD_PUBLIC_KEY, + telFAILED_PROCESSING, telINSUF_FEE_P, telNO_DST_PARTIAL, @@ -121,6 +122,7 @@ enum TER // aka TransactionEngineResult tecUNFUNDED_ADD = 102, tecUNFUNDED_OFFER = 103, tecUNFUNDED_PAYMENT = 104, + tecFAILED_PROCESSING = 105, tecDIR_FULL = 121, tecINSUF_RESERVE_LINE = 122, tecINSUF_RESERVE_OFFER = 123,