mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 06:55:50 +00:00
Finish Log changes for module ripple_ledger
This commit is contained in:
@@ -24,15 +24,18 @@
|
||||
|
||||
#include "ripple_ledger.h"
|
||||
|
||||
// VFALCO: TODO, fix these warnings!
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length"
|
||||
#pragma warning (disable: 4018) // signed/unsigned mismatch
|
||||
#pragma warning (disable: 4244) // conversion, possible loss of data
|
||||
#endif
|
||||
|
||||
// contracts
|
||||
#include "src/cpp/ripple/Contract.cpp" // no log
|
||||
#include "src/cpp/ripple/Operation.cpp" // no log
|
||||
|
||||
// processing
|
||||
#include "src/cpp/ripple/AcceptedLedger.cpp" // no log
|
||||
#include "src/cpp/ripple/AccountItems.cpp" // no log
|
||||
#include "src/cpp/ripple/AccountState.cpp" // no log
|
||||
@@ -52,6 +55,32 @@
|
||||
#include "src/cpp/ripple/RippleCalc.cpp"
|
||||
#include "src/cpp/ripple/RippleState.cpp" // no log
|
||||
|
||||
// serialization
|
||||
#include "src/cpp/ripple/SerializedLedger.cpp"
|
||||
#include "src/cpp/ripple/SerializedObject.cpp"
|
||||
#include "src/cpp/ripple/SerializedTransaction.cpp"
|
||||
#include "src/cpp/ripple/SerializedTypes.cpp"
|
||||
#include "src/cpp/ripple/SerializedValidation.cpp"
|
||||
#include "src/cpp/ripple/Serializer.cpp"
|
||||
|
||||
// transactions
|
||||
#include "src/cpp/ripple/AccountSetTransactor.cpp"
|
||||
#include "src/cpp/ripple/OfferCancelTransactor.cpp"
|
||||
#include "src/cpp/ripple/OfferCreateTransactor.cpp"
|
||||
#include "src/cpp/ripple/PaymentTransactor.cpp"
|
||||
#include "src/cpp/ripple/RegularKeySetTransactor.cpp"
|
||||
#include "src/cpp/ripple/Transaction.cpp"
|
||||
#include "src/cpp/ripple/TransactionAcquire.cpp"
|
||||
#include "src/cpp/ripple/TransactionCheck.cpp"
|
||||
#include "src/cpp/ripple/TransactionEngine.cpp"
|
||||
#include "src/cpp/ripple/TransactionErr.cpp" // no log
|
||||
#include "src/cpp/ripple/TransactionFormats.cpp" // no log
|
||||
#include "src/cpp/ripple/TransactionMaster.cpp" // no log
|
||||
#include "src/cpp/ripple/TransactionMeta.cpp"
|
||||
#include "src/cpp/ripple/TransactionQueue.cpp" // no log
|
||||
#include "src/cpp/ripple/Transactor.cpp"
|
||||
#include "src/cpp/ripple/TrustSetTransactor.cpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#include "AccountSetTransactor.h"
|
||||
#include "Config.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
TER AccountSetTransactor::doApply()
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet>";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet>";
|
||||
|
||||
const uint32 uTxFlags = mTxn.getFlags();
|
||||
|
||||
@@ -14,7 +12,7 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if (uTxFlags & tfAccountSetMask)
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Malformed transaction: Invalid flags set.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Malformed transaction: Invalid flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
@@ -25,7 +23,7 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if ((tfRequireAuth|tfOptionalAuth) == (uTxFlags & (tfRequireAuth|tfOptionalAuth)))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Malformed transaction: Contradictory flags set.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Malformed transaction: Contradictory flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
@@ -34,19 +32,19 @@ TER AccountSetTransactor::doApply()
|
||||
{
|
||||
if (mTxnAccount->getFieldU32(sfOwnerCount))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Retry: OwnerCount not zero.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Retry: OwnerCount not zero.";
|
||||
|
||||
return terOWNERS;
|
||||
}
|
||||
|
||||
cLog(lsINFO) << "AccountSet: Set RequireAuth.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Set RequireAuth.";
|
||||
|
||||
uFlagsOut |= lsfRequireAuth;
|
||||
}
|
||||
|
||||
if ((uTxFlags & tfOptionalAuth) && isSetBit(uFlagsIn, lsfRequireAuth))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Clear RequireAuth.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Clear RequireAuth.";
|
||||
|
||||
uFlagsOut &= ~lsfRequireAuth;
|
||||
}
|
||||
@@ -57,21 +55,21 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if ((tfRequireDestTag|tfOptionalDestTag) == (uTxFlags & (tfRequireDestTag|tfOptionalDestTag)))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Malformed transaction: Contradictory flags set.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Malformed transaction: Contradictory flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
|
||||
if ((uTxFlags & tfRequireDestTag) && !isSetBit(uFlagsIn, lsfRequireDestTag))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Set lsfRequireDestTag.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Set lsfRequireDestTag.";
|
||||
|
||||
uFlagsOut |= lsfRequireDestTag;
|
||||
}
|
||||
|
||||
if ((uTxFlags & tfOptionalDestTag) && isSetBit(uFlagsIn, lsfRequireDestTag))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Clear lsfRequireDestTag.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Clear lsfRequireDestTag.";
|
||||
|
||||
uFlagsOut &= ~lsfRequireDestTag;
|
||||
}
|
||||
@@ -82,21 +80,21 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if ((tfDisallowXRP|tfAllowXRP) == (uTxFlags & (tfDisallowXRP|tfAllowXRP)))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Malformed transaction: Contradictory flags set.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Malformed transaction: Contradictory flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
|
||||
if ((uTxFlags & tfDisallowXRP) && !isSetBit(uFlagsIn, lsfDisallowXRP))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Set lsfDisallowXRP.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Set lsfDisallowXRP.";
|
||||
|
||||
uFlagsOut |= lsfDisallowXRP;
|
||||
}
|
||||
|
||||
if ((uTxFlags & tfAllowXRP) && isSetBit(uFlagsIn, lsfDisallowXRP))
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: Clear lsfDisallowXRP.";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: Clear lsfDisallowXRP.";
|
||||
|
||||
uFlagsOut &= ~lsfDisallowXRP;
|
||||
}
|
||||
@@ -111,13 +109,13 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if (!uHash)
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: unset email hash";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: unset email hash";
|
||||
|
||||
mTxnAccount->makeFieldAbsent(sfEmailHash);
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: set email hash";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: set email hash";
|
||||
|
||||
mTxnAccount->setFieldH128(sfEmailHash, uHash);
|
||||
}
|
||||
@@ -133,13 +131,13 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if (!uHash)
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: unset wallet locator";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: unset wallet locator";
|
||||
|
||||
mTxnAccount->makeFieldAbsent(sfEmailHash);
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: set wallet locator";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: set wallet locator";
|
||||
|
||||
mTxnAccount->setFieldH256(sfWalletLocator, uHash);
|
||||
}
|
||||
@@ -155,13 +153,13 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if (vucPublic.size() > PUBLIC_BYTES_MAX)
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: message key too long";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: message key too long";
|
||||
|
||||
return telBAD_PUBLIC_KEY;
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: set message key";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: set message key";
|
||||
|
||||
mTxnAccount->setFieldVL(sfMessageKey, vucPublic);
|
||||
}
|
||||
@@ -177,19 +175,19 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if (vucDomain.empty())
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: unset domain";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: unset domain";
|
||||
|
||||
mTxnAccount->makeFieldAbsent(sfDomain);
|
||||
}
|
||||
else if (vucDomain.size() > DOMAIN_BYTES_MAX)
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: domain too long";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: domain too long";
|
||||
|
||||
return telBAD_DOMAIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: set domain";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: set domain";
|
||||
|
||||
mTxnAccount->setFieldVL(sfDomain, vucDomain);
|
||||
}
|
||||
@@ -205,19 +203,19 @@ TER AccountSetTransactor::doApply()
|
||||
|
||||
if (!uRate || uRate == QUALITY_ONE)
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: unset transfer rate";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: unset transfer rate";
|
||||
|
||||
mTxnAccount->makeFieldAbsent(sfTransferRate);
|
||||
}
|
||||
else if (uRate > QUALITY_ONE)
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: set transfer rate";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: set transfer rate";
|
||||
|
||||
mTxnAccount->setFieldU32(sfTransferRate, uRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "AccountSet: bad transfer rate";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet: bad transfer rate";
|
||||
|
||||
return temBAD_TRANSFER_RATE;
|
||||
}
|
||||
@@ -226,7 +224,7 @@ TER AccountSetTransactor::doApply()
|
||||
if (uFlagsIn != uFlagsOut)
|
||||
mTxnAccount->setFieldU32(sfFlags, uFlagsOut);
|
||||
|
||||
cLog(lsINFO) << "AccountSet<";
|
||||
WriteLog (lsINFO, AccountSetTransactor) << "AccountSet<";
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ enum LogSeverity
|
||||
lsFATAL = 5 // A severe condition that indicates a server problem
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO: TODO, make this a nested class in Log
|
||||
class LogPartition
|
||||
{
|
||||
protected:
|
||||
@@ -66,8 +69,25 @@ public:
|
||||
static bool setSeverity(const std::string& partition, LogSeverity severity);
|
||||
static void setSeverity(LogSeverity severity);
|
||||
static std::vector< std::pair<std::string, std::string> > getSeverities();
|
||||
|
||||
private:
|
||||
template <class Key>
|
||||
inline static LogPartition getFileName ()
|
||||
{
|
||||
// VFALCO: TODO, to implement this correctly get __FILE__ from Key
|
||||
return __FILE__;
|
||||
}
|
||||
public:
|
||||
template <class Key>
|
||||
inline static LogPartition const& get ()
|
||||
{
|
||||
static LogPartition logPartition (getFileName <Key> ());
|
||||
return logPartition;
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class Log
|
||||
{
|
||||
private:
|
||||
@@ -114,24 +134,9 @@ public:
|
||||
static std::string rotateLog(void);
|
||||
};
|
||||
|
||||
//-----
|
||||
|
||||
template <class Key>
|
||||
inline LogPartition const& getLogPartition ()
|
||||
{
|
||||
static LogPartition logPartition (__FILE__);
|
||||
return logPartition;
|
||||
}
|
||||
|
||||
template <class Key>
|
||||
inline Log getLog (LogSeverity level)
|
||||
{
|
||||
return Log (level, getLogPartition <Key> ());
|
||||
}
|
||||
|
||||
#define ShouldLog(s, k) (getLogPartition <k> ().doLog (s))
|
||||
#define WriteLog(s, k) if (!ShouldLog (s, k)) do {} while (0); else Log (s, getLogPartition <k> ())
|
||||
#define CondLog(c, s, k) if (!ShouldLog (s, k) || !(c)) do {} while(0); else Log(s, getLogPartition <k> ())
|
||||
#define ShouldLog(s, k) (LogPartition::get <k> ().doLog (s))
|
||||
#define WriteLog(s, k) if (!ShouldLog (s, k)) do {} while (0); else Log (s, LogPartition::get <k> ())
|
||||
#define CondLog(c, s, k) if (!ShouldLog (s, k) || !(c)) do {} while(0); else Log(s, LogPartition::get <k> ())
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
#include "OfferCancelTransactor.h"
|
||||
#include "Log.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
TER OfferCancelTransactor::doApply()
|
||||
{
|
||||
TER terResult;
|
||||
const uint32 uOfferSequence = mTxn.getFieldU32(sfOfferSequence);
|
||||
const uint32 uAccountSequenceNext = mTxnAccount->getFieldU32(sfSequence);
|
||||
|
||||
cLog(lsDEBUG) << "OfferCancel: uAccountSequenceNext=" << uAccountSequenceNext << " uOfferSequence=" << uOfferSequence;
|
||||
WriteLog (lsDEBUG, OfferCancelTransactor) << "OfferCancel: uAccountSequenceNext=" << uAccountSequenceNext << " uOfferSequence=" << uOfferSequence;
|
||||
|
||||
const uint32 uTxFlags = mTxn.getFlags();
|
||||
|
||||
if (uTxFlags)
|
||||
{
|
||||
cLog(lsINFO) << "OfferCancel: Malformed transaction: Invalid flags set.";
|
||||
WriteLog (lsINFO, OfferCancelTransactor) << "OfferCancel: Malformed transaction: Invalid flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
|
||||
if (!uOfferSequence || uAccountSequenceNext-1 <= uOfferSequence)
|
||||
{
|
||||
cLog(lsINFO) << "OfferCancel: uAccountSequenceNext=" << uAccountSequenceNext << " uOfferSequence=" << uOfferSequence;
|
||||
WriteLog (lsINFO, OfferCancelTransactor) << "OfferCancel: uAccountSequenceNext=" << uAccountSequenceNext << " uOfferSequence=" << uOfferSequence;
|
||||
|
||||
terResult = temBAD_SEQUENCE;
|
||||
}
|
||||
@@ -33,13 +31,13 @@ TER OfferCancelTransactor::doApply()
|
||||
|
||||
if (sleOffer)
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCancel: uOfferSequence=" << uOfferSequence;
|
||||
WriteLog (lsWARNING, OfferCancelTransactor) << "OfferCancel: uOfferSequence=" << uOfferSequence;
|
||||
|
||||
terResult = mEngine->getNodes().offerDelete(sleOffer, uOfferIndex, mTxnAccountID);
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCancel: offer not found: "
|
||||
WriteLog (lsWARNING, OfferCancelTransactor) << "OfferCancel: offer not found: "
|
||||
<< RippleAddress::createHumanAccountID(mTxnAccountID)
|
||||
<< " : " << uOfferSequence
|
||||
<< " : " << uOfferIndex.ToString();
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
// Make sure an offer is still valid. If not, mark it unfunded.
|
||||
bool OfferCreateTransactor::bValidOffer(
|
||||
SLE::ref sleOfferDir,
|
||||
@@ -24,7 +22,7 @@ bool OfferCreateTransactor::bValidOffer(
|
||||
if (sleOfferDir->isFieldPresent(sfExpiration) && sleOfferDir->getFieldU32(sfExpiration) <= mEngine->getLedger()->getParentCloseTimeNC())
|
||||
{
|
||||
// Offer is expired. Expired offers are considered unfunded. Delete it.
|
||||
cLog(lsINFO) << "bValidOffer: encountered expired offer";
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << "bValidOffer: encountered expired offer";
|
||||
|
||||
usOfferUnfundedFound.insert(uOfferIndex);
|
||||
|
||||
@@ -33,7 +31,7 @@ bool OfferCreateTransactor::bValidOffer(
|
||||
else if (uOfferOwnerID == uTakerAccountID)
|
||||
{
|
||||
// Would take own offer. Consider old offer expired. Delete it.
|
||||
cLog(lsINFO) << "bValidOffer: encountered taker's own old offer";
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << "bValidOffer: encountered taker's own old offer";
|
||||
|
||||
usOfferUnfundedFound.insert(uOfferIndex);
|
||||
|
||||
@@ -42,21 +40,21 @@ bool OfferCreateTransactor::bValidOffer(
|
||||
else if (!saOfferGets.isPositive() || !saOfferPays.isPositive())
|
||||
{
|
||||
// Offer has bad amounts. Consider offer expired. Delete it.
|
||||
cLog(lsWARNING) << boost::str(boost::format("bValidOffer: BAD OFFER: saOfferPays=%s saOfferGets=%s")
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << boost::str(boost::format("bValidOffer: BAD OFFER: saOfferPays=%s saOfferGets=%s")
|
||||
% saOfferPays % saOfferGets);
|
||||
|
||||
usOfferUnfundedFound.insert(uOfferIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsTRACE) << "bValidOffer: saOfferPays=" << saOfferPays.getFullText();
|
||||
WriteLog (lsTRACE, OfferCreateTransactor) << "bValidOffer: saOfferPays=" << saOfferPays.getFullText();
|
||||
|
||||
saOfferFunds = mEngine->getNodes().accountFunds(uOfferOwnerID, saOfferPays);
|
||||
|
||||
if (!saOfferFunds.isPositive())
|
||||
{
|
||||
// Offer is unfunded, possibly due to previous balance action.
|
||||
cLog(lsDEBUG) << "bValidOffer: offer unfunded: delete";
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "bValidOffer: offer unfunded: delete";
|
||||
|
||||
boost::unordered_set<uint160>::iterator account = usAccountTouched.find(uOfferOwnerID);
|
||||
if (account != usAccountTouched.end())
|
||||
@@ -111,7 +109,7 @@ TER OfferCreateTransactor::takeOffers(
|
||||
|
||||
assert(saTakerPays && saTakerGets);
|
||||
|
||||
cLog(lsDEBUG) << "takeOffers: bSell: " << bSell << ": against book: " << uBookBase.ToString();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: bSell: " << bSell << ": against book: " << uBookBase.ToString();
|
||||
|
||||
LedgerEntrySet& lesActive = mEngine->getNodes();
|
||||
uint256 uTipIndex = uBookBase;
|
||||
@@ -148,14 +146,14 @@ TER OfferCreateTransactor::takeOffers(
|
||||
uTipIndex = sleOfferDir->getIndex();
|
||||
uTipQuality = Ledger::getQuality(uTipIndex);
|
||||
|
||||
cLog(lsDEBUG) << boost::str(boost::format("takeOffers: possible counter offer found: uTipQuality=%d uTipIndex=%s")
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << boost::str(boost::format("takeOffers: possible counter offer found: uTipQuality=%d uTipIndex=%s")
|
||||
% uTipQuality
|
||||
% uTipIndex.ToString());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsTRACE) << "takeOffers: counter offer book is empty: "
|
||||
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: counter offer book is empty: "
|
||||
<< uTipIndex.ToString()
|
||||
<< " ... "
|
||||
<< uBookEnd.ToString();
|
||||
@@ -165,7 +163,7 @@ TER OfferCreateTransactor::takeOffers(
|
||||
if (!saTakerFunds.isPositive()) // Taker has no funds.
|
||||
{
|
||||
// Done. Ran out of funds on previous round. As fees aren't calculated directly in this routine, funds are checked here.
|
||||
cLog(lsDEBUG) << "takeOffers: done: taker unfunded.";
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: done: taker unfunded.";
|
||||
|
||||
bUnfunded = true; // Don't create an order.
|
||||
terResult = tesSUCCESS;
|
||||
@@ -177,7 +175,7 @@ TER OfferCreateTransactor::takeOffers(
|
||||
// Done.
|
||||
STAmount saTipRate = sleOfferDir ? STAmount::setRate(uTipQuality) : saTakerRate;
|
||||
|
||||
cLog(lsDEBUG) << boost::str(boost::format("takeOffers: done: dir=%d uTakeQuality=%d %c uTipQuality=%d saTakerRate=%s %c saTipRate=%s bPassive=%d")
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << boost::str(boost::format("takeOffers: done: dir=%d uTakeQuality=%d %c uTipQuality=%d saTakerRate=%s %c saTipRate=%s bPassive=%d")
|
||||
% !!sleOfferDir
|
||||
% uTakeQuality
|
||||
% (uTakeQuality == uTipQuality
|
||||
@@ -200,7 +198,7 @@ TER OfferCreateTransactor::takeOffers(
|
||||
else
|
||||
{
|
||||
// Have an offer directory to consider.
|
||||
cLog(lsTRACE) << "takeOffers: considering dir: " << sleOfferDir->getJson(0);
|
||||
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: considering dir: " << sleOfferDir->getJson(0);
|
||||
|
||||
SLE::pointer sleBookNode;
|
||||
unsigned int uBookEntry;
|
||||
@@ -210,7 +208,7 @@ TER OfferCreateTransactor::takeOffers(
|
||||
|
||||
SLE::pointer sleOffer = mEngine->entryCache(ltOFFER, uOfferIndex);
|
||||
|
||||
cLog(lsDEBUG) << "takeOffers: considering offer : " << sleOffer->getJson(0);
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: considering offer : " << sleOffer->getJson(0);
|
||||
|
||||
const uint160 uOfferOwnerID = sleOffer->getFieldAccount160(sfAccount);
|
||||
STAmount saOfferPays = sleOffer->getFieldAmount(sfTakerGets);
|
||||
@@ -232,17 +230,17 @@ TER OfferCreateTransactor::takeOffers(
|
||||
STAmount saOfferIssuerFee;
|
||||
STAmount saOfferRate = STAmount::setRate(uTipQuality);
|
||||
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saTakerPays: " << saTakerPays.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saTakerPaid: " << saTakerPaid.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saTakerFunds: " << saTakerFunds.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saOfferFunds: " << saOfferFunds.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saOfferPays: " << saOfferPays.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saOfferGets: " << saOfferGets.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saOfferRate: " << saOfferRate.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saSubTakerPays: " << saSubTakerPays.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saSubTakerGets: " << saSubTakerGets.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saTakerPays: " << saTakerPays.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saTakerGets: " << saTakerGets.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPays: " << saTakerPays.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPaid: " << saTakerPaid.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerFunds: " << saTakerFunds.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferFunds: " << saOfferFunds.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferPays: " << saOfferPays.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferGets: " << saOfferGets.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferRate: " << saOfferRate.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerPays: " << saSubTakerPays.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerGets: " << saSubTakerGets.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPays: " << saTakerPays.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerGets: " << saTakerGets.getFullText();
|
||||
|
||||
bool bOfferDelete = STAmount::applyOffer(
|
||||
bSell,
|
||||
@@ -260,8 +258,8 @@ TER OfferCreateTransactor::takeOffers(
|
||||
saTakerIssuerFee,
|
||||
saOfferIssuerFee);
|
||||
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saSubTakerPaid: " << saSubTakerPaid.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saSubTakerGot: " << saSubTakerGot.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerPaid: " << saSubTakerPaid.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerGot: " << saSubTakerGot.getFullText();
|
||||
|
||||
// Adjust offer
|
||||
|
||||
@@ -276,7 +274,7 @@ TER OfferCreateTransactor::takeOffers(
|
||||
if (bOfferDelete)
|
||||
{
|
||||
// Offer now fully claimed or now unfunded.
|
||||
cLog(lsDEBUG) << "takeOffers: Offer claimed: Delete.";
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: Offer claimed: Delete.";
|
||||
|
||||
usOfferUnfundedBecame.insert(uOfferIndex); // Delete unfunded offer on success.
|
||||
|
||||
@@ -285,11 +283,11 @@ TER OfferCreateTransactor::takeOffers(
|
||||
}
|
||||
else if (saSubTakerGot)
|
||||
{
|
||||
cLog(lsDEBUG) << "takeOffers: Offer partial claim.";
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: Offer partial claim.";
|
||||
|
||||
if (!saOfferPays.isPositive() || !saOfferGets.isPositive())
|
||||
{
|
||||
cLog(lsWARNING) << "takeOffers: ILLEGAL OFFER RESULT.";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "takeOffers: ILLEGAL OFFER RESULT.";
|
||||
bUnfunded = true;
|
||||
terResult = bOpenLedger ? telFAILED_PROCESSING : tecFAILED_PROCESSING;
|
||||
}
|
||||
@@ -297,7 +295,7 @@ TER OfferCreateTransactor::takeOffers(
|
||||
else
|
||||
{
|
||||
// Taker got nothing, probably due to rounding. Consider taker unfunded.
|
||||
cLog(lsDEBUG) << "takeOffers: No claim.";
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: No claim.";
|
||||
|
||||
bUnfunded = true;
|
||||
terResult = tesSUCCESS; // Done.
|
||||
@@ -325,10 +323,10 @@ TER OfferCreateTransactor::takeOffers(
|
||||
|
||||
STAmount saTakerUsed = STAmount::multiply(saSubTakerGot, saTakerRate, saTakerPays);
|
||||
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saTakerCould: " << saTakerCould.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saSubTakerGot: " << saSubTakerGot.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saTakerRate: " << saTakerRate.getFullText();
|
||||
cLog(lsDEBUG) << "takeOffers: applyOffer: saTakerUsed: " << saTakerUsed.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerCould: " << saTakerCould.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerGot: " << saSubTakerGot.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerRate: " << saTakerRate.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerUsed: " << saTakerUsed.getFullText();
|
||||
|
||||
saSubTakerPaid = std::min(saTakerCould, saTakerUsed);
|
||||
}
|
||||
@@ -342,14 +340,14 @@ TER OfferCreateTransactor::takeOffers(
|
||||
}
|
||||
}
|
||||
|
||||
cLog(lsDEBUG) << "takeOffers: " << transToken(terResult);
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: " << transToken(terResult);
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
{
|
||||
// On success, delete offers that became unfunded.
|
||||
BOOST_FOREACH(const uint256& uOfferIndex, usOfferUnfundedBecame)
|
||||
{
|
||||
cLog(lsDEBUG) << "takeOffers: became unfunded: " << uOfferIndex.ToString();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: became unfunded: " << uOfferIndex.ToString();
|
||||
|
||||
terResult = lesActive.offerDelete(uOfferIndex);
|
||||
if (tesSUCCESS != terResult)
|
||||
@@ -357,14 +355,14 @@ TER OfferCreateTransactor::takeOffers(
|
||||
}
|
||||
}
|
||||
|
||||
cLog(lsDEBUG) << "takeOffers< " << transToken(terResult);
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers< " << transToken(terResult);
|
||||
|
||||
return terResult;
|
||||
}
|
||||
|
||||
TER OfferCreateTransactor::doApply()
|
||||
{
|
||||
cLog(lsTRACE) << "OfferCreate> " << mTxn.getJson(0);
|
||||
WriteLog (lsTRACE, OfferCreateTransactor) << "OfferCreate> " << mTxn.getJson(0);
|
||||
const uint32 uTxFlags = mTxn.getFlags();
|
||||
const bool bPassive = isSetBit(uTxFlags, tfPassive);
|
||||
const bool bImmediateOrCancel = isSetBit(uTxFlags, tfImmediateOrCancel);
|
||||
@@ -373,7 +371,7 @@ TER OfferCreateTransactor::doApply()
|
||||
STAmount saTakerPays = mTxn.getFieldAmount(sfTakerPays);
|
||||
STAmount saTakerGets = mTxn.getFieldAmount(sfTakerGets);
|
||||
|
||||
cLog(lsTRACE) << boost::str(boost::format("OfferCreate: saTakerPays=%s saTakerGets=%s")
|
||||
WriteLog (lsTRACE, OfferCreateTransactor) << boost::str(boost::format("OfferCreate: saTakerPays=%s saTakerGets=%s")
|
||||
% saTakerPays.getFullText()
|
||||
% saTakerGets.getFullText());
|
||||
|
||||
@@ -385,7 +383,7 @@ TER OfferCreateTransactor::doApply()
|
||||
|
||||
const uint256 uLedgerIndex = Ledger::getOfferIndex(mTxnAccountID, uSequence);
|
||||
|
||||
cLog(lsTRACE) << "OfferCreate: Creating offer node: " << uLedgerIndex.ToString() << " uSequence=" << uSequence;
|
||||
WriteLog (lsTRACE, OfferCreateTransactor) << "OfferCreate: Creating offer node: " << uLedgerIndex.ToString() << " uSequence=" << uSequence;
|
||||
|
||||
const uint160 uPaysCurrency = saTakerPays.getCurrency();
|
||||
const uint160 uGetsCurrency = saTakerGets.getCurrency();
|
||||
@@ -404,61 +402,61 @@ TER OfferCreateTransactor::doApply()
|
||||
|
||||
if (uTxFlags & tfOfferCreateMask)
|
||||
{
|
||||
cLog(lsINFO) << "OfferCreate: Malformed transaction: Invalid flags set.";
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << "OfferCreate: Malformed transaction: Invalid flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
else if (bImmediateOrCancel && bFillOrKill)
|
||||
{
|
||||
cLog(lsINFO) << "OfferCreate: Malformed transaction: both IoC and FoK set.";
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << "OfferCreate: Malformed transaction: both IoC and FoK set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
else if (bHaveExpiration && !uExpiration)
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: Malformed offer: bad expiration";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: Malformed offer: bad expiration";
|
||||
|
||||
terResult = temBAD_EXPIRATION;
|
||||
}
|
||||
else if (bHaveExpiration && mEngine->getLedger()->getParentCloseTimeNC() >= uExpiration)
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: Expired transaction: offer expired";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: Expired transaction: offer expired";
|
||||
|
||||
terResult = tesSUCCESS; // Only charged fee.
|
||||
}
|
||||
else if (saTakerPays.isNative() && saTakerGets.isNative())
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: Malformed offer: XRP for XRP";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: Malformed offer: XRP for XRP";
|
||||
|
||||
terResult = temBAD_OFFER;
|
||||
}
|
||||
else if (!saTakerPays.isPositive() || !saTakerGets.isPositive())
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: Malformed offer: bad amount";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: Malformed offer: bad amount";
|
||||
|
||||
terResult = temBAD_OFFER;
|
||||
}
|
||||
else if (uPaysCurrency == uGetsCurrency && uPaysIssuerID == uGetsIssuerID)
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: Malformed offer: redundant offer";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: Malformed offer: redundant offer";
|
||||
|
||||
terResult = temREDUNDANT;
|
||||
}
|
||||
else if (CURRENCY_BAD == uPaysCurrency || CURRENCY_BAD == uGetsCurrency)
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: Malformed offer: Bad currency.";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: Malformed offer: Bad currency.";
|
||||
|
||||
terResult = temBAD_CURRENCY;
|
||||
}
|
||||
else if (saTakerPays.isNative() != !uPaysIssuerID || saTakerGets.isNative() != !uGetsIssuerID)
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: Malformed offer: bad issuer";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: Malformed offer: bad issuer";
|
||||
|
||||
terResult = temBAD_ISSUER;
|
||||
}
|
||||
else if (!lesActive.accountFunds(mTxnAccountID, saTakerGets).isPositive())
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: delay: Offers must be at least partially funded.";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: delay: Offers must be at least partially funded.";
|
||||
|
||||
terResult = tecUNFUNDED_OFFER;
|
||||
}
|
||||
@@ -469,7 +467,7 @@ TER OfferCreateTransactor::doApply()
|
||||
|
||||
if (!sleTakerPays)
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: delay: can't receive IOUs from non-existent issuer: " << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: delay: can't receive IOUs from non-existent issuer: " << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
|
||||
terResult = terNO_ACCOUNT;
|
||||
}
|
||||
@@ -479,7 +477,7 @@ TER OfferCreateTransactor::doApply()
|
||||
|
||||
if (!sleRippleState
|
||||
|| !isSetBit(sleRippleState->getFieldU32(sfFlags), (bHigh ? lsfHighAuth : lsfLowAuth))) {
|
||||
cLog(lsWARNING) << "OfferCreate: delay: can't receive IOUs from issuer without auth.";
|
||||
WriteLog (lsWARNING, OfferCreateTransactor) << "OfferCreate: delay: can't receive IOUs from issuer without auth.";
|
||||
|
||||
terResult = terNO_AUTH;
|
||||
}
|
||||
@@ -495,13 +493,13 @@ TER OfferCreateTransactor::doApply()
|
||||
{
|
||||
const uint256 uTakeBookBase = Ledger::getBookBase(uGetsCurrency, uGetsIssuerID, uPaysCurrency, uPaysIssuerID);
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("OfferCreate: take against book: %s for %s -> %s")
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << boost::str(boost::format("OfferCreate: take against book: %s for %s -> %s")
|
||||
% uTakeBookBase.ToString()
|
||||
% saTakerGets.getFullText()
|
||||
% saTakerPays.getFullText());
|
||||
|
||||
// Take using the parameters of the offer.
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: BEFORE saTakerGets=" << saTakerGets.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: BEFORE saTakerGets=" << saTakerGets.getFullText();
|
||||
|
||||
terResult = takeOffers(
|
||||
bOpenLedger,
|
||||
@@ -516,27 +514,27 @@ TER OfferCreateTransactor::doApply()
|
||||
saGot, // How much was got.
|
||||
bUnfunded);
|
||||
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers=" << terResult;
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: saPaid=" << saPaid.getFullText();
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: saGot=" << saGot.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers=" << terResult;
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: saPaid=" << saPaid.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: saGot=" << saGot.getFullText();
|
||||
|
||||
if (tesSUCCESS == terResult && !bUnfunded)
|
||||
{
|
||||
saTakerPays -= saGot; // Reduce pay in from takers by what offer just got.
|
||||
saTakerGets -= saPaid; // Reduce pay out to takers by what srcAccount just paid.
|
||||
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: AFTER saTakerPays=" << saTakerPays.getFullText();
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: AFTER saTakerGets=" << saTakerGets.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: AFTER saTakerPays=" << saTakerPays.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: AFTER saTakerGets=" << saTakerGets.getFullText();
|
||||
}
|
||||
}
|
||||
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: saTakerPays=" << saTakerPays.getFullText();
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: saTakerGets=" << saTakerGets.getFullText();
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: mTxnAccountID=" << RippleAddress::createHumanAccountID(mTxnAccountID);
|
||||
cLog(lsDEBUG) << "OfferCreate: takeOffers: FUNDS=" << lesActive.accountFunds(mTxnAccountID, saTakerGets).getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: saTakerPays=" << saTakerPays.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: saTakerGets=" << saTakerGets.getFullText();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: mTxnAccountID=" << RippleAddress::createHumanAccountID(mTxnAccountID);
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: FUNDS=" << lesActive.accountFunds(mTxnAccountID, saTakerGets).getFullText();
|
||||
|
||||
// cLog(lsDEBUG) << "OfferCreate: takeOffers: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
// cLog(lsDEBUG) << "OfferCreate: takeOffers: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID);
|
||||
// WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
// WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: takeOffers: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID);
|
||||
|
||||
if (tesSUCCESS != terResult)
|
||||
{
|
||||
@@ -587,7 +585,7 @@ TER OfferCreateTransactor::doApply()
|
||||
else
|
||||
{
|
||||
// We need to place the remainder of the offer into its order book.
|
||||
cLog(lsINFO) << boost::str(boost::format("OfferCreate: offer not fully consumed: saTakerPays=%s saTakerGets=%s")
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << boost::str(boost::format("OfferCreate: offer not fully consumed: saTakerPays=%s saTakerGets=%s")
|
||||
% saTakerPays.getFullText()
|
||||
% saTakerGets.getFullText());
|
||||
|
||||
@@ -603,7 +601,7 @@ TER OfferCreateTransactor::doApply()
|
||||
|
||||
uint256 uBookBase = Ledger::getBookBase(uPaysCurrency, uPaysIssuerID, uGetsCurrency, uGetsIssuerID);
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("OfferCreate: adding to book: %s : %s/%s -> %s/%s")
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << boost::str(boost::format("OfferCreate: adding to book: %s : %s/%s -> %s/%s")
|
||||
% uBookBase.ToString()
|
||||
% saTakerPays.getHumanCurrency()
|
||||
% RippleAddress::createHumanAccountID(saTakerPays.getIssuer())
|
||||
@@ -620,13 +618,13 @@ TER OfferCreateTransactor::doApply()
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
{
|
||||
cLog(lsDEBUG) << "OfferCreate: sfAccount=" << RippleAddress::createHumanAccountID(mTxnAccountID);
|
||||
cLog(lsDEBUG) << "OfferCreate: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
cLog(lsDEBUG) << "OfferCreate: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID);
|
||||
cLog(lsTRACE) << "OfferCreate: saTakerPays.isNative()=" << saTakerPays.isNative();
|
||||
cLog(lsTRACE) << "OfferCreate: saTakerGets.isNative()=" << saTakerGets.isNative();
|
||||
cLog(lsDEBUG) << "OfferCreate: uPaysCurrency=" << saTakerPays.getHumanCurrency();
|
||||
cLog(lsDEBUG) << "OfferCreate: uGetsCurrency=" << saTakerGets.getHumanCurrency();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: sfAccount=" << RippleAddress::createHumanAccountID(mTxnAccountID);
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID);
|
||||
WriteLog (lsTRACE, OfferCreateTransactor) << "OfferCreate: saTakerPays.isNative()=" << saTakerPays.isNative();
|
||||
WriteLog (lsTRACE, OfferCreateTransactor) << "OfferCreate: saTakerGets.isNative()=" << saTakerGets.isNative();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: uPaysCurrency=" << saTakerPays.getHumanCurrency();
|
||||
WriteLog (lsDEBUG, OfferCreateTransactor) << "OfferCreate: uGetsCurrency=" << saTakerGets.getHumanCurrency();
|
||||
|
||||
SLE::pointer sleOffer = mEngine->entryCreate(ltOFFER, uLedgerIndex);
|
||||
|
||||
@@ -644,7 +642,7 @@ TER OfferCreateTransactor::doApply()
|
||||
if (bPassive)
|
||||
sleOffer->setFlag(lsfPassive);
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("OfferCreate: final terResult=%s sleOffer=%s")
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << boost::str(boost::format("OfferCreate: final terResult=%s sleOffer=%s")
|
||||
% transToken(terResult)
|
||||
% sleOffer->getJson(0));
|
||||
}
|
||||
@@ -656,7 +654,7 @@ TER OfferCreateTransactor::doApply()
|
||||
BOOST_FOREACH(const uint256& uOfferIndex, usOfferUnfundedFound)
|
||||
{
|
||||
|
||||
cLog(lsINFO) << "takeOffers: found unfunded: " << uOfferIndex.ToString();
|
||||
WriteLog (lsINFO, OfferCreateTransactor) << "takeOffers: found unfunded: " << uOfferIndex.ToString();
|
||||
|
||||
terResult = lesActive.offerDelete(uOfferIndex);
|
||||
if (tesSUCCESS != terResult)
|
||||
@@ -664,7 +662,7 @@ TER OfferCreateTransactor::doApply()
|
||||
}
|
||||
}
|
||||
|
||||
tLog(tesSUCCESS != terResult, lsINFO) << boost::str(boost::format("OfferCreate: final terResult=%s") % transToken(terResult));
|
||||
CondLog (tesSUCCESS != terResult, lsINFO, OfferCreateTransactor) << boost::str(boost::format("OfferCreate: final terResult=%s") % transToken(terResult));
|
||||
|
||||
if (isTesSuccess(terResult))
|
||||
theApp->getOrderBookDB().invalidate();
|
||||
|
||||
@@ -27,43 +27,43 @@ TER PaymentTransactor::doApply()
|
||||
const uint160 uDstCurrency = saDstAmount.getCurrency();
|
||||
const bool bXRPDirect = uSrcCurrency.isZero() && uDstCurrency.isZero();
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("Payment> saMaxAmount=%s saDstAmount=%s")
|
||||
WriteLog (lsINFO, PaymentTransactor) << boost::str(boost::format("Payment> saMaxAmount=%s saDstAmount=%s")
|
||||
% saMaxAmount.getFullText()
|
||||
% saDstAmount.getFullText());
|
||||
|
||||
if (uTxFlags & tfPaymentMask)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: Invalid flags set.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: Invalid flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
else if (!uDstAccountID)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: Payment destination account not specified.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: Payment destination account not specified.";
|
||||
|
||||
return temDST_NEEDED;
|
||||
}
|
||||
else if (bMax && !saMaxAmount.isPositive())
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: bad max amount: " << saMaxAmount.getFullText();
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: bad max amount: " << saMaxAmount.getFullText();
|
||||
|
||||
return temBAD_AMOUNT;
|
||||
}
|
||||
else if (!saDstAmount.isPositive())
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: bad dst amount: " << saDstAmount.getFullText();
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: bad dst amount: " << saDstAmount.getFullText();
|
||||
|
||||
return temBAD_AMOUNT;
|
||||
}
|
||||
else if (CURRENCY_BAD == uSrcCurrency || CURRENCY_BAD == uDstCurrency)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: Bad currency.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: Bad currency.";
|
||||
|
||||
return temBAD_CURRENCY;
|
||||
}
|
||||
else if (mTxnAccountID == uDstAccountID && uSrcCurrency == uDstCurrency && !bPaths)
|
||||
{
|
||||
cLog(lsINFO) << boost::str(boost::format("Payment: Malformed transaction: Redundant transaction: src=%s, dst=%s, src_cur=%s, dst_cur=%s")
|
||||
WriteLog (lsINFO, PaymentTransactor) << boost::str(boost::format("Payment: Malformed transaction: Redundant transaction: src=%s, dst=%s, src_cur=%s, dst_cur=%s")
|
||||
% mTxnAccountID.ToString()
|
||||
% uDstAccountID.ToString()
|
||||
% uSrcCurrency.ToString()
|
||||
@@ -73,37 +73,37 @@ TER PaymentTransactor::doApply()
|
||||
}
|
||||
else if (bMax && saMaxAmount == saDstAmount && saMaxAmount.getCurrency() == saDstAmount.getCurrency())
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: Redundant SendMax.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: Redundant SendMax.";
|
||||
|
||||
return temREDUNDANT_SEND_MAX;
|
||||
}
|
||||
else if (bXRPDirect && bMax)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: SendMax specified for XRP to XRP.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: SendMax specified for XRP to XRP.";
|
||||
|
||||
return temBAD_SEND_XRP_MAX;
|
||||
}
|
||||
else if (bXRPDirect && bPaths)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: Paths specified for XRP to XRP.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: Paths specified for XRP to XRP.";
|
||||
|
||||
return temBAD_SEND_XRP_PATHS;
|
||||
}
|
||||
else if (bXRPDirect && bPartialPayment)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: Partial payment specified for XRP to XRP.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: Partial payment specified for XRP to XRP.";
|
||||
|
||||
return temBAD_SEND_XRP_PARTIAL;
|
||||
}
|
||||
else if (bXRPDirect && bLimitQuality)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: Limit quality specified for XRP to XRP.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: Limit quality specified for XRP to XRP.";
|
||||
|
||||
return temBAD_SEND_XRP_LIMIT;
|
||||
}
|
||||
else if (bXRPDirect && bNoRippleDirect)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: No ripple direct specified for XRP to XRP.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: No ripple direct specified for XRP to XRP.";
|
||||
|
||||
return temBAD_SEND_XRP_NO_DIRECT;
|
||||
}
|
||||
@@ -115,14 +115,14 @@ TER PaymentTransactor::doApply()
|
||||
|
||||
if (!saDstAmount.isNative())
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Delay transaction: Destination account does not exist.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Delay transaction: Destination account does not exist.";
|
||||
|
||||
// Another transaction could create the account and then this transaction would succeed.
|
||||
return tecNO_DST;
|
||||
}
|
||||
else if (isSetBit(mParams, tapOPEN_LEDGER) && bPartialPayment)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Delay transaction: Partial payment not allowed to create account.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Delay transaction: Partial payment not allowed to create account.";
|
||||
// Make retry work smaller, by rejecting this.
|
||||
|
||||
// Another transaction could create the account and then this transaction would succeed.
|
||||
@@ -130,7 +130,7 @@ TER PaymentTransactor::doApply()
|
||||
}
|
||||
else if (saDstAmount.getNValue() < mEngine->getLedger()->getReserve(0)) // Reserve is not scaled by load.
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Delay transaction: Destination account does not exist. Insufficent payment to create account.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: 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 tecNO_DST_INSUF_XRP;
|
||||
@@ -144,7 +144,7 @@ TER PaymentTransactor::doApply()
|
||||
}
|
||||
else if ((sleDst->getFlags() & lsfRequireDestTag) && !mTxn.isFieldPresent(sfDestinationTag))
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Malformed transaction: DestinationTag required.";
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Malformed transaction: DestinationTag required.";
|
||||
|
||||
return tefDST_TAG_NEEDED;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ TER PaymentTransactor::doApply()
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
cLog(lsINFO) << "Payment: Caught throw: " << e.what();
|
||||
WriteLog (lsINFO, PaymentTransactor) << "Payment: Caught throw: " << e.what();
|
||||
|
||||
terResult = tefEXCEPTION;
|
||||
}
|
||||
@@ -204,8 +204,8 @@ TER PaymentTransactor::doApply()
|
||||
if (mPriorBalance < saDstAmount + uReserve) // Reserve is not scaled by fee.
|
||||
{
|
||||
// Vote no. However, transaction might succeed, if applied in a different order.
|
||||
cLog(lsINFO) << "";
|
||||
cLog(lsINFO) << boost::str(boost::format("Payment: Delay transaction: Insufficient funds: %s / %s (%d)")
|
||||
WriteLog (lsINFO, PaymentTransactor) << "";
|
||||
WriteLog (lsINFO, PaymentTransactor) << boost::str(boost::format("Payment: Delay transaction: Insufficient funds: %s / %s (%d)")
|
||||
% mPriorBalance.getText() % (saDstAmount + uReserve).getText() % uReserve);
|
||||
|
||||
terResult = tecUNFUNDED_PAYMENT;
|
||||
@@ -228,7 +228,7 @@ TER PaymentTransactor::doApply()
|
||||
|
||||
if (transResultInfo(terResult, strToken, strHuman))
|
||||
{
|
||||
cLog(lsINFO) << boost::str(boost::format("Payment: %s: %s") % strToken % strHuman);
|
||||
WriteLog (lsINFO, PaymentTransactor) << boost::str(boost::format("Payment: %s: %s") % strToken % strHuman);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "RegularKeySetTransactor.h"
|
||||
#include "Log.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
uint64 RegularKeySetTransactor::calculateBaseFee()
|
||||
{
|
||||
if ( !(mTxnAccount->getFlags() & lsfPasswordSpent)
|
||||
@@ -22,7 +20,7 @@ TER RegularKeySetTransactor::doApply()
|
||||
|
||||
if (uTxFlags)
|
||||
{
|
||||
cLog(lsINFO) << "RegularKeySet: Malformed transaction: Invalid flags set.";
|
||||
WriteLog (lsINFO, RegularKeySetTransactor) << "RegularKeySet: Malformed transaction: Invalid flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
#include "Log.h"
|
||||
|
||||
DECLARE_INSTANCE(SerializedLedgerEntry)
|
||||
SETUP_LOG();
|
||||
|
||||
struct SerializedLedger
|
||||
{
|
||||
};
|
||||
|
||||
SerializedLedgerEntry::SerializedLedgerEntry(SerializerIterator& sit, const uint256& index)
|
||||
: STObject(sfLedgerEntry), mIndex(index), mMutable(true)
|
||||
@@ -34,8 +37,8 @@ SerializedLedgerEntry::SerializedLedgerEntry(const Serializer& s, const uint256&
|
||||
mType = mFormat->t_type;
|
||||
if (!setType(mFormat->elements))
|
||||
{
|
||||
cLog(lsWARNING) << "Ledger entry not valid for type " << mFormat->t_name;
|
||||
cLog(lsWARNING) << getJson(0);
|
||||
WriteLog (lsWARNING, SerializedLedger) << "Ledger entry not valid for type " << mFormat->t_name;
|
||||
WriteLog (lsWARNING, SerializedLedger) << getJson(0);
|
||||
throw std::runtime_error("ledger entry not valid for type");
|
||||
}
|
||||
}
|
||||
@@ -107,7 +110,7 @@ uint32 SerializedLedgerEntry::getThreadedLedger()
|
||||
bool SerializedLedgerEntry::thread(const uint256& txID, uint32 ledgerSeq, uint256& prevTxID, uint32& prevLedgerID)
|
||||
{
|
||||
uint256 oldPrevTxID = getFieldH256(sfPreviousTxnID);
|
||||
cLog(lsTRACE) << "Thread Tx:" << txID << " prev:" << oldPrevTxID;
|
||||
WriteLog (lsTRACE, SerializedLedger) << "Thread Tx:" << txID << " prev:" << oldPrevTxID;
|
||||
if (oldPrevTxID == txID)
|
||||
{ // this transaction is already threaded
|
||||
assert(getFieldU32(sfPreviousTxnLgrSeq) == ledgerSeq);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
DEFINE_INSTANCE(SerializedLedgerEntry);
|
||||
|
||||
// VFALCO: TODO, rename this to SerializedLedger
|
||||
class SerializedLedgerEntry : public STObject, private IS_INSTANCE(SerializedLedgerEntry)
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "TransactionFormats.h"
|
||||
#include "SerializedTransaction.h"
|
||||
|
||||
SETUP_LOG();
|
||||
DECLARE_INSTANCE(SerializedObject);
|
||||
DECLARE_INSTANCE(SerializedArray);
|
||||
|
||||
@@ -69,7 +68,7 @@ UPTR_T<SerializedType> STObject::makeDefaultObject(SerializedTypeID id, SField::
|
||||
return UPTR_T<SerializedType>(new STArray(name));
|
||||
|
||||
default:
|
||||
cLog(lsFATAL) << "Object type: " << lexical_cast_i(id);
|
||||
WriteLog (lsFATAL, STObject) << "Object type: " << lexical_cast_i(id);
|
||||
assert(false);
|
||||
throw std::runtime_error("Unknown object type");
|
||||
}
|
||||
@@ -176,7 +175,7 @@ bool STObject::setType(const SOTemplate &type)
|
||||
match = true;
|
||||
if ((elem->flags == SOE_DEFAULT) && it->isDefault())
|
||||
{
|
||||
cLog(lsWARNING) << "setType( " << getFName().getName() << ") invalid default "
|
||||
WriteLog (lsWARNING, STObject) << "setType( " << getFName().getName() << ") invalid default "
|
||||
<< elem->e_field.fieldName;
|
||||
valid = false;
|
||||
}
|
||||
@@ -188,7 +187,7 @@ bool STObject::setType(const SOTemplate &type)
|
||||
{ // no match found
|
||||
if (elem->flags == SOE_REQUIRED)
|
||||
{
|
||||
cLog(lsWARNING) << "setType( " << getFName().getName() << ") invalid missing "
|
||||
WriteLog (lsWARNING, STObject) << "setType( " << getFName().getName() << ") invalid missing "
|
||||
<< elem->e_field.fieldName;
|
||||
valid = false;
|
||||
}
|
||||
@@ -200,7 +199,7 @@ bool STObject::setType(const SOTemplate &type)
|
||||
{ // Anything left over must be discardable
|
||||
if (!t.getFName().isDiscardable())
|
||||
{
|
||||
cLog(lsWARNING) << "setType( " << getFName().getName() << ") invalid leftover "
|
||||
WriteLog (lsWARNING, STObject) << "setType( " << getFName().getName() << ") invalid leftover "
|
||||
<< t.getFName().getName();
|
||||
valid = false;
|
||||
}
|
||||
@@ -244,7 +243,7 @@ bool STObject::set(SerializerIterator& sit, int depth)
|
||||
SField::ref fn = SField::getField(type, field);
|
||||
if (fn.isInvalid())
|
||||
{
|
||||
cLog(lsWARNING) << "Unknown field: field_type=" << type << ", field_name=" << field;
|
||||
WriteLog (lsWARNING, STObject) << "Unknown field: field_type=" << type << ", field_name=" << field;
|
||||
throw std::runtime_error("Unknown field");
|
||||
}
|
||||
giveObject(makeDeserializedObject(fn.fieldType, fn, sit, depth + 1));
|
||||
@@ -947,7 +946,7 @@ STArray* STArray::construct(SerializerIterator& sit, SField::ref field)
|
||||
SField::ref fn = SField::getField(type, field);
|
||||
if (fn.isInvalid())
|
||||
{
|
||||
cLog(lsTRACE) << "Unknown field: " << type << "/" << field;
|
||||
WriteLog (lsTRACE, STObject) << "Unknown field: " << type << "/" << field;
|
||||
throw std::runtime_error("Unknown field");
|
||||
}
|
||||
|
||||
@@ -1209,7 +1208,7 @@ UPTR_T<STObject> STObject::parseJson(const Json::Value& object, SField::ref inNa
|
||||
RippleAddress a;
|
||||
if (!a.setAccountID(strValue))
|
||||
{
|
||||
cLog(lsINFO) << "Invalid acccount JSON: " << fieldName << ": " << strValue;
|
||||
WriteLog (lsINFO, STObject) << "Invalid acccount JSON: " << fieldName << ": " << strValue;
|
||||
throw std::runtime_error("Account invalid");
|
||||
}
|
||||
data.push_back(new STAccount(field, a.getAccountID()));
|
||||
@@ -1278,8 +1277,8 @@ BOOST_AUTO_TEST_CASE( FieldManipulation_test )
|
||||
|
||||
if (object1.getSerializer() == object2.getSerializer())
|
||||
{
|
||||
cLog(lsINFO) << "O1: " << object1.getJson(0);
|
||||
cLog(lsINFO) << "O2: " << object2.getJson(0);
|
||||
WriteLog (lsINFO, STObject) << "O1: " << object1.getJson(0);
|
||||
WriteLog (lsINFO, STObject) << "O2: " << object2.getJson(0);
|
||||
BOOST_FAIL("STObject error 4");
|
||||
}
|
||||
object1.makeFieldAbsent(sfTestH256);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "Log.h"
|
||||
#include "HashPrefixes.h"
|
||||
|
||||
SETUP_LOG();
|
||||
DECLARE_INSTANCE(SerializedTransaction);
|
||||
|
||||
SerializedTransaction::SerializedTransaction(TransactionType type) : STObject(sfTransaction), mType(type),
|
||||
@@ -17,7 +16,7 @@ SerializedTransaction::SerializedTransaction(TransactionType type) : STObject(sf
|
||||
mFormat = TransactionFormat::getTxnFormat(type);
|
||||
if (mFormat == NULL)
|
||||
{
|
||||
cLog(lsWARNING) << "Transaction type: " << type;
|
||||
WriteLog (lsWARNING, SerializedTransaction) << "Transaction type: " << type;
|
||||
throw std::runtime_error("invalid transaction type");
|
||||
}
|
||||
set(mFormat->elements);
|
||||
@@ -31,7 +30,7 @@ SerializedTransaction::SerializedTransaction(const STObject& object) : STObject(
|
||||
mFormat = TransactionFormat::getTxnFormat(mType);
|
||||
if (!mFormat)
|
||||
{
|
||||
cLog(lsWARNING) << "Transaction type: " << mType;
|
||||
WriteLog (lsWARNING, SerializedTransaction) << "Transaction type: " << mType;
|
||||
throw std::runtime_error("invalid transaction type");
|
||||
}
|
||||
if (!setType(mFormat->elements))
|
||||
@@ -56,7 +55,7 @@ SerializedTransaction::SerializedTransaction(SerializerIterator& sit) : STObject
|
||||
mFormat = TransactionFormat::getTxnFormat(mType);
|
||||
if (!mFormat)
|
||||
{
|
||||
cLog(lsWARNING) << "Transaction type: " << mType;
|
||||
WriteLog (lsWARNING, SerializedTransaction) << "Transaction type: " << mType;
|
||||
throw std::runtime_error("invalid transaction type");
|
||||
}
|
||||
if (!setType(mFormat->elements))
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#include "RippleAddress.h"
|
||||
#include "TransactionErr.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
const STAmount saZero(CURRENCY_ONE, ACCOUNT_ONE, 0);
|
||||
const STAmount saOne(CURRENCY_ONE, ACCOUNT_ONE, 1);
|
||||
|
||||
@@ -22,7 +20,7 @@ SerializedType& SerializedType::operator=(const SerializedType& t)
|
||||
{
|
||||
if ((t.fName != fName) && fName->isUseful() && t.fName->isUseful())
|
||||
{
|
||||
cLog((t.getSType() == STI_AMOUNT) ? lsDEBUG : lsWARNING) // This is common for amounts
|
||||
WriteLog ((t.getSType() == STI_AMOUNT) ? lsDEBUG : lsWARNING, SerializedType) // This is common for amounts
|
||||
<< "Caution: " << t.fName->getName() << " not replacing " << fName->getName();
|
||||
}
|
||||
if (!fName->isUseful()) fName = t.fName;
|
||||
@@ -93,7 +91,7 @@ Json::Value STUInt8::getJson(int) const
|
||||
if (transResultInfo(static_cast<TER>(value), token, human))
|
||||
return token;
|
||||
else
|
||||
cLog(lsWARNING) << "Unknown result code in metadata: " << value;
|
||||
WriteLog (lsWARNING, SerializedType) << "Unknown result code in metadata: " << value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -381,7 +379,7 @@ STPathSet* STPathSet::construct(SerializerIterator& s, SField::ref name)
|
||||
{
|
||||
if (path.empty())
|
||||
{
|
||||
cLog(lsINFO) << "STPathSet: Empty path.";
|
||||
WriteLog (lsINFO, SerializedType) << "STPathSet: Empty path.";
|
||||
|
||||
throw std::runtime_error("empty path");
|
||||
}
|
||||
@@ -396,7 +394,7 @@ STPathSet* STPathSet::construct(SerializerIterator& s, SField::ref name)
|
||||
}
|
||||
else if (iType & ~STPathElement::typeValidBits)
|
||||
{
|
||||
cLog(lsINFO) << "STPathSet: Bad path element: " << iType;
|
||||
WriteLog (lsINFO, SerializedType) << "STPathSet: Bad path element: " << iType;
|
||||
|
||||
throw std::runtime_error("bad path element");
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "key.h"
|
||||
#include "Log.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
int Serializer::addZeros(size_t uBytes)
|
||||
{
|
||||
int ret = mData.size();
|
||||
@@ -190,7 +188,7 @@ bool Serializer::getFieldID(int& type, int& name, int offset) const
|
||||
{
|
||||
if (!get8(type, offset))
|
||||
{
|
||||
cLog(lsWARNING) << "gFID: unable to get type";
|
||||
WriteLog (lsWARNING, Serializer) << "gFID: unable to get type";
|
||||
return false;
|
||||
}
|
||||
name = type & 15;
|
||||
@@ -201,7 +199,7 @@ bool Serializer::getFieldID(int& type, int& name, int offset) const
|
||||
return false;
|
||||
if ((type == 0) || (type < 16))
|
||||
{
|
||||
cLog(lsWARNING) << "gFID: uncommon type out of range " << type;
|
||||
WriteLog (lsWARNING, Serializer) << "gFID: uncommon type out of range " << type;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -211,7 +209,7 @@ bool Serializer::getFieldID(int& type, int& name, int offset) const
|
||||
return false;
|
||||
if ((name == 0) || (name < 16))
|
||||
{
|
||||
cLog(lsWARNING) << "gFID: uncommon name out of range " << name;
|
||||
WriteLog (lsWARNING, Serializer) << "gFID: uncommon name out of range " << name;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
typedef std::map<uint160, LedgerProposal::pointer>::value_type u160_prop_pair;
|
||||
typedef std::map<uint256, LCTransaction::pointer>::value_type u256_lct_pair;
|
||||
|
||||
SETUP_LOG();
|
||||
DECLARE_INSTANCE(TransactionAcquire);
|
||||
|
||||
TransactionAcquire::TransactionAcquire(const uint256& hash) : PeerSet(hash, TX_ACQUIRE_TIMEOUT), mHaveRoot(false)
|
||||
@@ -33,12 +32,12 @@ void TransactionAcquire::done()
|
||||
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
|
||||
if (mFailed)
|
||||
{
|
||||
cLog(lsWARNING) << "Failed to acquire TX set " << mHash;
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Failed to acquire TX set " << mHash;
|
||||
theApp->getOPs().mapComplete(mHash, SHAMap::pointer());
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "Acquired TX set " << mHash;
|
||||
WriteLog (lsINFO, TransactionAcquire) << "Acquired TX set " << mHash;
|
||||
mMap->setImmutable();
|
||||
theApp->getOPs().mapComplete(mHash, mMap);
|
||||
}
|
||||
@@ -50,12 +49,12 @@ void TransactionAcquire::onTimer(bool progress)
|
||||
bool aggressive = false;
|
||||
if (getTimeouts() > 10)
|
||||
{
|
||||
cLog(lsWARNING) << "Ten timeouts on TX set " << getHash();
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Ten timeouts on TX set " << getHash();
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
|
||||
if (theApp->getOPs().stillNeedTXSet(mHash))
|
||||
{
|
||||
cLog(lsWARNING) << "Still need it";
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Still need it";
|
||||
mTimeouts = 0;
|
||||
aggressive = true;
|
||||
}
|
||||
@@ -69,7 +68,7 @@ void TransactionAcquire::onTimer(bool progress)
|
||||
}
|
||||
if (aggressive || !getPeerCount())
|
||||
{ // out of peers
|
||||
cLog(lsWARNING) << "Out of peers for TX set " << getHash();
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Out of peers for TX set " << getHash();
|
||||
|
||||
bool found = false;
|
||||
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
|
||||
@@ -100,12 +99,12 @@ void TransactionAcquire::trigger(Peer::ref peer)
|
||||
{
|
||||
if (mComplete || mFailed)
|
||||
{
|
||||
cLog(lsINFO) << "complete or failed";
|
||||
WriteLog (lsINFO, TransactionAcquire) << "complete or failed";
|
||||
return;
|
||||
}
|
||||
if (!mHaveRoot)
|
||||
{
|
||||
cLog(lsTRACE) << "TransactionAcquire::trigger " << (peer ? "havePeer" : "noPeer") << " no root";
|
||||
WriteLog (lsTRACE, TransactionAcquire) << "TransactionAcquire::trigger " << (peer ? "havePeer" : "noPeer") << " no root";
|
||||
ripple::TMGetLedger tmGL;
|
||||
tmGL.set_ledgerhash(mHash.begin(), mHash.size());
|
||||
tmGL.set_itype(ripple::liTS_CANDIDATE);
|
||||
@@ -145,12 +144,12 @@ SMAddNode TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
|
||||
{
|
||||
if (mComplete)
|
||||
{
|
||||
cLog(lsTRACE) << "TX set complete";
|
||||
WriteLog (lsTRACE, TransactionAcquire) << "TX set complete";
|
||||
return SMAddNode();
|
||||
}
|
||||
if (mFailed)
|
||||
{
|
||||
cLog(lsTRACE) << "TX set failed";
|
||||
WriteLog (lsTRACE, TransactionAcquire) << "TX set failed";
|
||||
return SMAddNode();
|
||||
}
|
||||
try
|
||||
@@ -166,12 +165,12 @@ SMAddNode TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
|
||||
{
|
||||
if (mHaveRoot)
|
||||
{
|
||||
cLog(lsWARNING) << "Got root TXS node, already have it";
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Got root TXS node, already have it";
|
||||
return SMAddNode();
|
||||
}
|
||||
if (!mMap->addRootNode(getHash(), *nodeDatait, snfWIRE, NULL))
|
||||
{
|
||||
cLog(lsWARNING) << "TX acquire got bad root node";
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "TX acquire got bad root node";
|
||||
return SMAddNode::invalid();
|
||||
}
|
||||
else
|
||||
@@ -179,7 +178,7 @@ SMAddNode TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
|
||||
}
|
||||
else if (!mMap->addKnownNode(*nodeIDit, *nodeDatait, &sf))
|
||||
{
|
||||
cLog(lsWARNING) << "TX acquire got bad non-root node";
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "TX acquire got bad non-root node";
|
||||
return SMAddNode::invalid();
|
||||
}
|
||||
++nodeIDit;
|
||||
@@ -191,7 +190,7 @@ SMAddNode TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cLog(lsERROR) << "Peer sends us junky transaction node data";
|
||||
WriteLog (lsERROR, TransactionAcquire) << "Peer sends us junky transaction node data";
|
||||
return SMAddNode::invalid();
|
||||
}
|
||||
}
|
||||
@@ -204,7 +203,7 @@ void ConsensusTransSetSF::gotNode(bool fromFilter, const SHAMapNode& id, const u
|
||||
theApp->getTempNodeCache().store(nodeHash, nodeData);
|
||||
if ((type == SHAMapTreeNode::tnTRANSACTION_NM) && (nodeData.size() > 16))
|
||||
{ // this is a transaction, and we didn't have it
|
||||
cLog(lsDEBUG) << "Node on our acquiring TX set is TXN we don't have";
|
||||
WriteLog (lsDEBUG, TransactionAcquire) << "Node on our acquiring TX set is TXN we don't have";
|
||||
try
|
||||
{
|
||||
Serializer s(nodeData.begin() + 4, nodeData.end()); // skip prefix
|
||||
@@ -216,7 +215,7 @@ void ConsensusTransSetSF::gotNode(bool fromFilter, const SHAMapNode& id, const u
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cLog(lsWARNING) << "Fetched invalid transaction in proposed set";
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Fetched invalid transaction in proposed set";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,7 +229,7 @@ bool ConsensusTransSetSF::haveNode(const SHAMapNode& id, const uint256& nodeHash
|
||||
Transaction::pointer txn = Transaction::load(nodeHash);
|
||||
if (txn)
|
||||
{ // this is a transaction, and we have it
|
||||
cLog(lsDEBUG) << "Node in our acquiring TX set is TXN we have";
|
||||
WriteLog (lsDEBUG, TransactionAcquire) << "Node in our acquiring TX set is TXN we have";
|
||||
Serializer s;
|
||||
s.add32(sHP_TransactionID);
|
||||
txn->getSTransaction()->add(s, true);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#include "TransactionErr.h"
|
||||
#include "TransactionEngine.h"
|
||||
|
||||
// Double check a transaction's metadata to make sure no system invariants were broken
|
||||
// VFALCO: TODO, move this into TransactionEngine.cpp
|
||||
|
||||
SETUP_LOG();
|
||||
// Double check a transaction's metadata to make sure no system invariants were broken
|
||||
|
||||
bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction& txn, TransactionEngineParams params)
|
||||
{
|
||||
@@ -19,7 +19,7 @@ bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction&
|
||||
|
||||
if (!newSrcAct || !origSrcAct)
|
||||
{
|
||||
cLog(lsFATAL) << "Transaction created or destroyed its issuing account";
|
||||
WriteLog (lsFATAL, TransactionEngine) << "Transaction created or destroyed its issuing account";
|
||||
assert(false);
|
||||
return tefINTERNAL;
|
||||
}
|
||||
@@ -27,8 +27,8 @@ bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction&
|
||||
if ((newSrcAct->getFieldU32(sfSequence) != (txnSeq + 1)) ||
|
||||
(origSrcAct->getFieldU32(sfSequence) != txnSeq))
|
||||
{
|
||||
cLog(lsFATAL) << "Transaction mangles sequence numbers";
|
||||
cLog(lsFATAL) << "t:" << txnSeq << " o: " << origSrcAct->getFieldU32(sfSequence)
|
||||
WriteLog (lsFATAL, TransactionEngine) << "Transaction mangles sequence numbers";
|
||||
WriteLog (lsFATAL, TransactionEngine) << "t:" << txnSeq << " o: " << origSrcAct->getFieldU32(sfSequence)
|
||||
<< " n: " << newSrcAct->getFieldU32(sfSequence);
|
||||
assert(false);
|
||||
return tefINTERNAL;
|
||||
@@ -60,7 +60,7 @@ bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction&
|
||||
if (entry.mEntry->getFieldAmount(sfLowLimit).getIssuer() ==
|
||||
entry.mEntry->getFieldAmount(sfHighLimit).getIssuer())
|
||||
{
|
||||
cLog(lsFATAL) << "Ripple line to self";
|
||||
WriteLog (lsFATAL, TransactionEngine) << "Ripple line to self";
|
||||
assert(false);
|
||||
return tefINTERNAL;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction&
|
||||
}
|
||||
if (xrpChange != 0)
|
||||
{
|
||||
cLog(lsFATAL) << "Transaction creates/destroys XRP";
|
||||
WriteLog (lsFATAL, TransactionEngine) << "Transaction creates/destroys XRP";
|
||||
assert(false);
|
||||
return tefINTERNAL;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#include "TransactionFormats.h"
|
||||
#include "utils.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
DECLARE_INSTANCE(TransactionEngine);
|
||||
|
||||
void TransactionEngine::txnWrite()
|
||||
@@ -39,7 +37,7 @@ void TransactionEngine::txnWrite()
|
||||
|
||||
case taaCREATE:
|
||||
{
|
||||
cLog(lsINFO) << "applyTransaction: taaCREATE: " << sleEntry->getText();
|
||||
WriteLog (lsINFO, TransactionEngine) << "applyTransaction: taaCREATE: " << sleEntry->getText();
|
||||
|
||||
if (mLedger->writeBack(lepCREATE, sleEntry) & lepERROR)
|
||||
assert(false);
|
||||
@@ -48,7 +46,7 @@ void TransactionEngine::txnWrite()
|
||||
|
||||
case taaMODIFY:
|
||||
{
|
||||
cLog(lsINFO) << "applyTransaction: taaMODIFY: " << sleEntry->getText();
|
||||
WriteLog (lsINFO, TransactionEngine) << "applyTransaction: taaMODIFY: " << sleEntry->getText();
|
||||
|
||||
if (mLedger->writeBack(lepNONE, sleEntry) & lepERROR)
|
||||
assert(false);
|
||||
@@ -57,7 +55,7 @@ void TransactionEngine::txnWrite()
|
||||
|
||||
case taaDELETE:
|
||||
{
|
||||
cLog(lsINFO) << "applyTransaction: taaDELETE: " << sleEntry->getText();
|
||||
WriteLog (lsINFO, TransactionEngine) << "applyTransaction: taaDELETE: " << sleEntry->getText();
|
||||
|
||||
if (!mLedger->peekAccountStateMap()->delItem(it.first))
|
||||
assert(false);
|
||||
@@ -70,7 +68,7 @@ void TransactionEngine::txnWrite()
|
||||
TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, TransactionEngineParams params,
|
||||
bool& didApply)
|
||||
{
|
||||
cLog(lsTRACE) << "applyTransaction>";
|
||||
WriteLog (lsTRACE, TransactionEngine) << "applyTransaction>";
|
||||
didApply = false;
|
||||
assert(mLedger);
|
||||
mNodes.init(mLedger, txn.getTransactionID(), mLedger->getLedgerSeq(), params);
|
||||
@@ -84,10 +82,10 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
SerializedTransaction s2(sit);
|
||||
if (!s2.isEquivalent(txn))
|
||||
{
|
||||
cLog(lsFATAL) << "Transaction serdes mismatch";
|
||||
WriteLog (lsFATAL, TransactionEngine) << "Transaction serdes mismatch";
|
||||
Json::StyledStreamWriter ssw;
|
||||
cLog(lsINFO) << txn.getJson(0);
|
||||
cLog(lsFATAL) << s2.getJson(0);
|
||||
WriteLog (lsINFO, TransactionEngine) << txn.getJson(0);
|
||||
WriteLog (lsFATAL, TransactionEngine) << s2.getJson(0);
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -99,7 +97,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
uint256 txID = txn.getTransactionID();
|
||||
if (!txID)
|
||||
{
|
||||
cLog(lsWARNING) << "applyTransaction: invalid transaction id";
|
||||
WriteLog (lsWARNING, TransactionEngine) << "applyTransaction: invalid transaction id";
|
||||
|
||||
return temINVALID;
|
||||
}
|
||||
@@ -110,13 +108,13 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
|
||||
transResultInfo(terResult, strToken, strHuman);
|
||||
|
||||
cLog(lsINFO) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
|
||||
WriteLog (lsINFO, TransactionEngine) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
|
||||
|
||||
if (isTesSuccess(terResult))
|
||||
didApply = true;
|
||||
else if (isTecClaim(terResult) && !isSetBit(params, tapRETRY))
|
||||
{ // only claim the transaction fee
|
||||
cLog(lsDEBUG) << "Reprocessing to only claim fee";
|
||||
WriteLog (lsDEBUG, TransactionEngine) << "Reprocessing to only claim fee";
|
||||
mNodes.clear();
|
||||
|
||||
SLE::pointer txnAcct = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(txn.getSourceAccount()));
|
||||
@@ -149,16 +147,16 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
}
|
||||
}
|
||||
else
|
||||
cLog(lsDEBUG) << "Not applying transaction";
|
||||
WriteLog (lsDEBUG, TransactionEngine) << "Not applying transaction";
|
||||
|
||||
if (didApply)
|
||||
{
|
||||
if (!checkInvariants(terResult, txn, params))
|
||||
{
|
||||
cLog(lsFATAL) << "Transaction violates invariants";
|
||||
cLog(lsFATAL) << txn.getJson(0);
|
||||
cLog(lsFATAL) << transToken(terResult) << ": " << transHuman(terResult);
|
||||
cLog(lsFATAL) << mNodes.getJson(0);
|
||||
WriteLog (lsFATAL, TransactionEngine) << "Transaction violates invariants";
|
||||
WriteLog (lsFATAL, TransactionEngine) << txn.getJson(0);
|
||||
WriteLog (lsFATAL, TransactionEngine) << transToken(terResult) << ": " << transHuman(terResult);
|
||||
WriteLog (lsFATAL, TransactionEngine) << mNodes.getJson(0);
|
||||
didApply = false;
|
||||
terResult = tefINTERNAL;
|
||||
}
|
||||
@@ -177,7 +175,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
{
|
||||
if (!mLedger->addTransaction(txID, s))
|
||||
{
|
||||
cLog(lsFATAL) << "Tried to add transaction to open ledger that already had it";
|
||||
WriteLog (lsFATAL, TransactionEngine) << "Tried to add transaction to open ledger that already had it";
|
||||
assert(false);
|
||||
throw std::runtime_error("Duplicate transaction applied");
|
||||
}
|
||||
@@ -186,7 +184,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
{
|
||||
if (!mLedger->addTransaction(txID, s, m))
|
||||
{
|
||||
cLog(lsFATAL) << "Tried to add transaction to ledger that already had it";
|
||||
WriteLog (lsFATAL, TransactionEngine) << "Tried to add transaction to ledger that already had it";
|
||||
assert(false);
|
||||
throw std::runtime_error("Duplicate transaction applied to closed ledger");
|
||||
}
|
||||
@@ -210,7 +208,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsWARNING) << "applyTransaction: Invalid transaction: unknown transaction type";
|
||||
WriteLog (lsWARNING, TransactionEngine) << "applyTransaction: Invalid transaction: unknown transaction type";
|
||||
return temUNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "Log.h"
|
||||
#include "SerializedObject.h"
|
||||
|
||||
SETUP_LOG();
|
||||
// VFALCO: TODO, rename class to TransactionMeta
|
||||
|
||||
TransactionMetaSet::TransactionMetaSet(const uint256& txid, uint32 ledger, const std::vector<unsigned char>& vec) :
|
||||
mTransactionID(txid), mLedger(ledger), mNodes(sfAffectedNodes, 32)
|
||||
@@ -99,7 +99,7 @@ std::vector<RippleAddress> TransactionMetaSet::getAffectedAccounts()
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsFATAL) << "limit is not amount " << field.getJson(0);
|
||||
WriteLog (lsFATAL, TransactionMetaSet) << "limit is not amount " << field.getJson(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "TrustSetTransactor.h"
|
||||
#include "ChangeTransactor.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
UPTR_T<Transactor> Transactor::makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine)
|
||||
{
|
||||
switch(txn.getTxnType())
|
||||
@@ -63,7 +61,7 @@ TER Transactor::payFee()
|
||||
// Only check fee is sufficient when the ledger is open.
|
||||
if (isSetBit(mParams, tapOPEN_LEDGER) && saPaid < mFeeDue)
|
||||
{
|
||||
cLog(lsINFO) << boost::str(boost::format("applyTransaction: Insufficient fee paid: %s/%s")
|
||||
WriteLog (lsINFO, Transactor) << boost::str(boost::format("applyTransaction: Insufficient fee paid: %s/%s")
|
||||
% saPaid.getText()
|
||||
% mFeeDue.getText());
|
||||
|
||||
@@ -79,7 +77,7 @@ TER Transactor::payFee()
|
||||
// Will only write the account back, if the transaction succeeds.
|
||||
if (mSourceBalance < saPaid)
|
||||
{
|
||||
cLog(lsINFO)
|
||||
WriteLog (lsINFO, Transactor)
|
||||
<< boost::str(boost::format("applyTransaction: Delay: insufficient balance: balance=%s paid=%s")
|
||||
% mSourceBalance.getText()
|
||||
% saPaid.getText());
|
||||
@@ -109,13 +107,13 @@ TER Transactor::checkSig()
|
||||
}
|
||||
else if (mHasAuthKey)
|
||||
{
|
||||
cLog(lsINFO) << "applyTransaction: Delay: Not authorized to use account.";
|
||||
WriteLog (lsINFO, Transactor) << "applyTransaction: Delay: Not authorized to use account.";
|
||||
|
||||
return tefBAD_AUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "applyTransaction: Invalid: Not authorized to use account.";
|
||||
WriteLog (lsINFO, Transactor) << "applyTransaction: Invalid: Not authorized to use account.";
|
||||
|
||||
return temBAD_AUTH_MASTER;
|
||||
}
|
||||
@@ -128,13 +126,13 @@ TER Transactor::checkSeq()
|
||||
uint32 t_seq = mTxn.getSequence();
|
||||
uint32 a_seq = mTxnAccount->getFieldU32(sfSequence);
|
||||
|
||||
cLog(lsTRACE) << "Aseq=" << a_seq << ", Tseq=" << t_seq;
|
||||
WriteLog (lsTRACE, Transactor) << "Aseq=" << a_seq << ", Tseq=" << t_seq;
|
||||
|
||||
if (t_seq != a_seq)
|
||||
{
|
||||
if (a_seq < t_seq)
|
||||
{
|
||||
cLog(lsINFO) << "applyTransaction: future sequence number";
|
||||
WriteLog (lsINFO, Transactor) << "applyTransaction: future sequence number";
|
||||
|
||||
return terPRE_SEQ;
|
||||
}
|
||||
@@ -145,7 +143,7 @@ TER Transactor::checkSeq()
|
||||
return tefALREADY;
|
||||
}
|
||||
|
||||
cLog(lsWARNING) << "applyTransaction: past sequence number";
|
||||
WriteLog (lsWARNING, Transactor) << "applyTransaction: past sequence number";
|
||||
|
||||
return tefPAST_SEQ;
|
||||
}
|
||||
@@ -165,7 +163,7 @@ TER Transactor::preCheck()
|
||||
mTxnAccountID = mTxn.getSourceAccount().getAccountID();
|
||||
if (!mTxnAccountID)
|
||||
{
|
||||
cLog(lsWARNING) << "applyTransaction: bad source id";
|
||||
WriteLog (lsWARNING, Transactor) << "applyTransaction: bad source id";
|
||||
|
||||
return temBAD_SRC_ACCOUNT;
|
||||
}
|
||||
@@ -183,7 +181,7 @@ TER Transactor::preCheck()
|
||||
if (mTxn.isKnownBad() || (!isSetBit(mParams, tapNO_CHECK_SIGN) && !mTxn.checkSign(mSigningPubKey)))
|
||||
{
|
||||
mTxn.setGood();
|
||||
cLog(lsWARNING) << "applyTransaction: Invalid transaction: bad signature";
|
||||
WriteLog (lsWARNING, Transactor) << "applyTransaction: Invalid transaction: bad signature";
|
||||
return temINVALID;
|
||||
}
|
||||
mTxn.isKnownGood();
|
||||
@@ -211,7 +209,7 @@ TER Transactor::apply()
|
||||
{
|
||||
if (mustHaveValidAccount())
|
||||
{
|
||||
cLog(lsTRACE) << boost::str(boost::format("applyTransaction: Delay transaction: source account does not exist: %s") %
|
||||
WriteLog (lsTRACE, Transactor) << boost::str(boost::format("applyTransaction: Delay transaction: source account does not exist: %s") %
|
||||
mTxn.getSourceAccount().humanAccountID());
|
||||
|
||||
return terNO_ACCOUNT;
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
|
||||
#include "TrustSetTransactor.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
TER TrustSetTransactor::doApply()
|
||||
{
|
||||
TER terResult = tesSUCCESS;
|
||||
cLog(lsINFO) << "doTrustSet>";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet>";
|
||||
|
||||
const STAmount saLimitAmount = mTxn.getFieldAmount(sfLimitAmount);
|
||||
const bool bQualityIn = mTxn.isFieldPresent(sfQualityIn);
|
||||
@@ -29,7 +27,7 @@ TER TrustSetTransactor::doApply()
|
||||
|
||||
if (uTxFlags & tfTrustSetMask)
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Malformed transaction: Invalid flags set.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Malformed transaction: Invalid flags set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
@@ -38,14 +36,14 @@ TER TrustSetTransactor::doApply()
|
||||
|
||||
if (bSetAuth && !isSetBit(mTxnAccount->getFieldU32(sfFlags), lsfRequireAuth))
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Retry: Auth not required.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Retry: Auth not required.";
|
||||
|
||||
return tefNO_AUTH_REQUIRED;
|
||||
}
|
||||
|
||||
if (saLimitAmount.isNative())
|
||||
{
|
||||
cLog(lsINFO) << boost::str(boost::format("doTrustSet: Malformed transaction: Native credit limit: %s")
|
||||
WriteLog (lsINFO, TrustSetTransactor) << boost::str(boost::format("doTrustSet: Malformed transaction: Native credit limit: %s")
|
||||
% saLimitAmount.getFullText());
|
||||
|
||||
return temBAD_LIMIT;
|
||||
@@ -53,7 +51,7 @@ TER TrustSetTransactor::doApply()
|
||||
|
||||
if (saLimitAmount.isNegative())
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Malformed transaction: Negative credit limit.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Malformed transaction: Negative credit limit.";
|
||||
|
||||
return temBAD_LIMIT;
|
||||
}
|
||||
@@ -61,7 +59,7 @@ TER TrustSetTransactor::doApply()
|
||||
// Check if destination makes sense.
|
||||
if (!uDstAccountID || uDstAccountID == ACCOUNT_ONE)
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Malformed transaction: Destination account not specified.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Malformed transaction: Destination account not specified.";
|
||||
|
||||
return temDST_NEEDED;
|
||||
}
|
||||
@@ -72,13 +70,13 @@ TER TrustSetTransactor::doApply()
|
||||
|
||||
if (selDelete)
|
||||
{
|
||||
cLog(lsWARNING) << "doTrustSet: Clearing redundant line.";
|
||||
WriteLog (lsWARNING, TrustSetTransactor) << "doTrustSet: Clearing redundant line.";
|
||||
|
||||
return mEngine->getNodes().trustDelete(selDelete, mTxnAccountID, uDstAccountID);
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Malformed transaction: Can not extend credit to self.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Malformed transaction: Can not extend credit to self.";
|
||||
|
||||
return temDST_IS_SRC;
|
||||
}
|
||||
@@ -87,7 +85,7 @@ TER TrustSetTransactor::doApply()
|
||||
SLE::pointer sleDst = mEngine->entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uDstAccountID));
|
||||
if (!sleDst)
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Delay transaction: Destination account does not exist.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Delay transaction: Destination account does not exist.";
|
||||
|
||||
return tecNO_DST;
|
||||
}
|
||||
@@ -268,7 +266,7 @@ TER TrustSetTransactor::doApply()
|
||||
else if (bReserveIncrease
|
||||
&& mPriorBalance.getNValue() < uReserveCreate) // Reserve is not scaled by load.
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Delay transaction: Insufficent reserve to add trust line.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Delay transaction: Insufficent reserve to add trust line.";
|
||||
|
||||
// Another transaction could provide XRP to the account and then this transaction would succeed.
|
||||
terResult = tecINSUF_RESERVE_LINE;
|
||||
@@ -277,7 +275,7 @@ TER TrustSetTransactor::doApply()
|
||||
{
|
||||
mEngine->entryModify(sleRippleState);
|
||||
|
||||
cLog(lsINFO) << "doTrustSet: Modify ripple line";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Modify ripple line";
|
||||
}
|
||||
}
|
||||
// Line does not exist.
|
||||
@@ -285,13 +283,13 @@ TER TrustSetTransactor::doApply()
|
||||
&& (!bQualityIn || !uQualityIn) // Not setting quality in or setting default quality in.
|
||||
&& (!bQualityOut || !uQualityOut)) // Not setting quality out or setting default quality out.
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Redundant: Setting non-existent ripple line to defaults.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Redundant: Setting non-existent ripple line to defaults.";
|
||||
|
||||
return tecNO_LINE_REDUNDANT;
|
||||
}
|
||||
else if (mPriorBalance.getNValue() < uReserveCreate) // Reserve is not scaled by load.
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Delay transaction: Line does not exist. Insufficent reserve to create line.";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "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 = tecNO_LINE_INSUF_RESERVE;
|
||||
@@ -304,7 +302,7 @@ TER TrustSetTransactor::doApply()
|
||||
{
|
||||
STAmount saBalance = STAmount(uCurrencyID, ACCOUNT_ONE); // Zero balance in currency.
|
||||
|
||||
cLog(lsINFO) << "doTrustSet: Creating ripple line: "
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet: Creating ripple line: "
|
||||
<< Ledger::getRippleStateIndex(mTxnAccountID, uDstAccountID, uCurrencyID).ToString();
|
||||
|
||||
// Create a new ripple line.
|
||||
@@ -321,7 +319,7 @@ TER TrustSetTransactor::doApply()
|
||||
uQualityOut);
|
||||
}
|
||||
|
||||
cLog(lsINFO) << "doTrustSet<";
|
||||
WriteLog (lsINFO, TrustSetTransactor) << "doTrustSet<";
|
||||
|
||||
return terResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user