mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -451,9 +451,11 @@ void Ledger::saveAcceptedLedger(bool fromConsensus, LoadEvent::pointer event)
|
|||||||
std::string escMeta(sqlEscape(rawMeta.peekData()));
|
std::string escMeta(sqlEscape(rawMeta.peekData()));
|
||||||
|
|
||||||
SerializerIterator txnIt(rawTxn);
|
SerializerIterator txnIt(rawTxn);
|
||||||
|
|
||||||
SerializedTransaction txn(txnIt);
|
SerializedTransaction txn(txnIt);
|
||||||
assert(txn.getTransactionID() == item->getTag());
|
assert(txn.getTransactionID() == item->getTag());
|
||||||
TransactionMetaSet meta(item->getTag(), mLedgerSeq, rawMeta.peekData());
|
TransactionMetaSet meta(item->getTag(), mLedgerSeq, rawMeta.peekData());
|
||||||
|
theApp->getMasterTransaction().inLedger(item->getTag(), mLedgerSeq);
|
||||||
|
|
||||||
// Make sure transaction is in AccountTransactions.
|
// Make sure transaction is in AccountTransactions.
|
||||||
if (!SQL_EXISTS(db, boost::str(AcctTransExists % item->getTag().GetHex())))
|
if (!SQL_EXISTS(db, boost::str(AcctTransExists % item->getTag().GetHex())))
|
||||||
|
|||||||
@@ -1025,7 +1025,7 @@ uint32 LedgerEntrySet::rippleQualityIn(const uint160& uToAccountID, const uint16
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cLog(lsINFO) << boost::str(boost::format("rippleQuality: %s uToAccountID=%s uFromAccountID=%s uCurrencyID=%s bLine=%d uQuality=%f")
|
cLog(lsTRACE) << boost::str(boost::format("rippleQuality: %s uToAccountID=%s uFromAccountID=%s uCurrencyID=%s bLine=%d uQuality=%f")
|
||||||
% (sfLow == sfLowQualityIn ? "in" : "out")
|
% (sfLow == sfLowQualityIn ? "in" : "out")
|
||||||
% RippleAddress::createHumanAccountID(uToAccountID)
|
% RippleAddress::createHumanAccountID(uToAccountID)
|
||||||
% RippleAddress::createHumanAccountID(uFromAccountID)
|
% RippleAddress::createHumanAccountID(uFromAccountID)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ TER PathState::pushImply(
|
|||||||
const PaymentNode& pnPrv = vpnNodes.back();
|
const PaymentNode& pnPrv = vpnNodes.back();
|
||||||
TER terResult = tesSUCCESS;
|
TER terResult = tesSUCCESS;
|
||||||
|
|
||||||
cLog(lsINFO) << "pushImply> "
|
cLog(lsTRACE) << "pushImply> "
|
||||||
<< RippleAddress::createHumanAccountID(uAccountID)
|
<< RippleAddress::createHumanAccountID(uAccountID)
|
||||||
<< " " << STAmount::createHumanCurrency(uCurrencyID)
|
<< " " << STAmount::createHumanCurrency(uCurrencyID)
|
||||||
<< " " << RippleAddress::createHumanAccountID(uIssuerID);
|
<< " " << RippleAddress::createHumanAccountID(uIssuerID);
|
||||||
@@ -107,7 +107,7 @@ TER PathState::pushImply(
|
|||||||
uIssuerID);
|
uIssuerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
cLog(lsINFO) << boost::str(boost::format("pushImply< : %s") % transToken(terResult));
|
cLog(lsTRACE) << boost::str(boost::format("pushImply< : %s") % transToken(terResult));
|
||||||
|
|
||||||
return terResult;
|
return terResult;
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ TER PathState::pushNode(
|
|||||||
const bool bIssuer = isSetBit(iType, STPathElement::typeIssuer);
|
const bool bIssuer = isSetBit(iType, STPathElement::typeIssuer);
|
||||||
TER terResult = tesSUCCESS;
|
TER terResult = tesSUCCESS;
|
||||||
|
|
||||||
cLog(lsDEBUG) << "pushNode> "
|
cLog(lsTRACE) << "pushNode> "
|
||||||
<< iType
|
<< iType
|
||||||
<< ": " << (bAccount ? RippleAddress::createHumanAccountID(uAccountID) : "-")
|
<< ": " << (bAccount ? RippleAddress::createHumanAccountID(uAccountID) : "-")
|
||||||
<< " " << (bCurrency ? STAmount::createHumanCurrency(uCurrencyID) : "-")
|
<< " " << (bCurrency ? STAmount::createHumanCurrency(uCurrencyID) : "-")
|
||||||
@@ -209,7 +209,7 @@ TER PathState::pushNode(
|
|||||||
|
|
||||||
if (!sleRippleState)
|
if (!sleRippleState)
|
||||||
{
|
{
|
||||||
cLog(lsINFO) << "pushNode: No credit line between "
|
cLog(lsTRACE) << "pushNode: No credit line between "
|
||||||
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
||||||
<< " and "
|
<< " and "
|
||||||
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
||||||
@@ -217,13 +217,13 @@ TER PathState::pushNode(
|
|||||||
<< STAmount::createHumanCurrency(pnCur.uCurrencyID)
|
<< STAmount::createHumanCurrency(pnCur.uCurrencyID)
|
||||||
<< "." ;
|
<< "." ;
|
||||||
|
|
||||||
cLog(lsINFO) << getJson();
|
cLog(lsTRACE) << getJson();
|
||||||
|
|
||||||
terResult = terNO_LINE;
|
terResult = terNO_LINE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cLog(lsINFO) << "pushNode: Credit line found between "
|
cLog(lsDEBUG) << "pushNode: Credit line found between "
|
||||||
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
||||||
<< " and "
|
<< " and "
|
||||||
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
||||||
@@ -280,7 +280,7 @@ TER PathState::pushNode(
|
|||||||
vpnNodes.push_back(pnCur);
|
vpnNodes.push_back(pnCur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cLog(lsINFO) << boost::str(boost::format("pushNode< : %s") % transToken(terResult));
|
cLog(lsDEBUG) << boost::str(boost::format("pushNode< : %s") % transToken(terResult));
|
||||||
|
|
||||||
return terResult;
|
return terResult;
|
||||||
}
|
}
|
||||||
@@ -1660,7 +1660,7 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, c
|
|||||||
? lesActive.rippleOwed(uCurAccountID, uNxtAccountID, uCurrencyID)
|
? lesActive.rippleOwed(uCurAccountID, uNxtAccountID, uCurrencyID)
|
||||||
: STAmount(uCurrencyID, uCurAccountID);
|
: STAmount(uCurrencyID, uCurAccountID);
|
||||||
|
|
||||||
cLog(lsDEBUG) << boost::str(boost::format("calcNodeAccountRev> uNode=%d/%d uPrvAccountID=%s uCurAccountID=%s uNxtAccountID=%s uCurrencyID=%s uQualityIn=%d uQualityOut=%d saPrvOwed=%s saPrvLimit=%s")
|
cLog(lsTRACE) << boost::str(boost::format("calcNodeAccountRev> uNode=%d/%d uPrvAccountID=%s uCurAccountID=%s uNxtAccountID=%s uCurrencyID=%s uQualityIn=%d uQualityOut=%d saPrvOwed=%s saPrvLimit=%s")
|
||||||
% uNode
|
% uNode
|
||||||
% uLast
|
% uLast
|
||||||
% RippleAddress::createHumanAccountID(uPrvAccountID)
|
% RippleAddress::createHumanAccountID(uPrvAccountID)
|
||||||
@@ -1695,14 +1695,14 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, c
|
|||||||
const STAmount& saCurDeliverReq = pnCur.saRevDeliver;
|
const STAmount& saCurDeliverReq = pnCur.saRevDeliver;
|
||||||
STAmount saCurDeliverAct(saCurDeliverReq.getCurrency(), saCurDeliverReq.getIssuer());
|
STAmount saCurDeliverAct(saCurDeliverReq.getCurrency(), saCurDeliverReq.getIssuer());
|
||||||
|
|
||||||
cLog(lsDEBUG) << boost::str(boost::format("calcNodeAccountRev: saPrvRedeemReq=%s saPrvIssueReq=%s saCurRedeemReq=%s saCurIssueReq=%s saNxtOwed=%s")
|
cLog(lsTRACE) << boost::str(boost::format("calcNodeAccountRev: saPrvRedeemReq=%s saPrvIssueReq=%s saCurRedeemReq=%s saCurIssueReq=%s saNxtOwed=%s")
|
||||||
% saPrvRedeemReq.getFullText()
|
% saPrvRedeemReq.getFullText()
|
||||||
% saPrvIssueReq.getFullText()
|
% saPrvIssueReq.getFullText()
|
||||||
% saCurRedeemReq.getFullText()
|
% saCurRedeemReq.getFullText()
|
||||||
% saCurIssueReq.getFullText()
|
% saCurIssueReq.getFullText()
|
||||||
% saNxtOwed.getFullText());
|
% saNxtOwed.getFullText());
|
||||||
|
|
||||||
cLog(lsDEBUG) << psCur.getJson();
|
cLog(lsTRACE) << psCur.getJson();
|
||||||
|
|
||||||
assert(!saCurRedeemReq || (-saNxtOwed) >= saCurRedeemReq); // Current redeem req can't be more than IOUs on hand.
|
assert(!saCurRedeemReq || (-saNxtOwed) >= saCurRedeemReq); // Current redeem req can't be more than IOUs on hand.
|
||||||
assert(!saCurIssueReq // If not issuing, fine.
|
assert(!saCurIssueReq // If not issuing, fine.
|
||||||
|
|||||||
@@ -11,24 +11,32 @@ AccountItem::pointer RippleState::makeItem(const uint160& accountID, SerializedL
|
|||||||
}
|
}
|
||||||
|
|
||||||
RippleState::RippleState(SerializedLedgerEntry::ref ledgerEntry) : AccountItem(ledgerEntry),
|
RippleState::RippleState(SerializedLedgerEntry::ref ledgerEntry) : AccountItem(ledgerEntry),
|
||||||
mValid(false),
|
mValid(false), mViewLowest(true)
|
||||||
mViewLowest(true)
|
|
||||||
{
|
{
|
||||||
mFlags = mLedgerEntry->getFieldU32(sfFlags);
|
for (int i = 0, iMax = mLedgerEntry->getCount(); i < iMax; ++i)
|
||||||
|
{
|
||||||
|
const SerializedType* entry = mLedgerEntry->peekAtPIndex(i);
|
||||||
|
assert(entry);
|
||||||
|
|
||||||
mLowLimit = mLedgerEntry->getFieldAmount(sfLowLimit);
|
if (entry->getFName() == sfFlags)
|
||||||
mHighLimit = mLedgerEntry->getFieldAmount(sfHighLimit);
|
mFlags = static_cast<const STUInt32*>(entry)->getValue();
|
||||||
|
else if (entry->getFName() == sfLowLimit)
|
||||||
mLowID = RippleAddress::createAccountID(mLowLimit.getIssuer());
|
{
|
||||||
mHighID = RippleAddress::createAccountID(mHighLimit.getIssuer());
|
mLowLimit = *static_cast<const STAmount*>(entry);
|
||||||
|
mLowID = RippleAddress::createAccountID(mLowLimit.getIssuer());
|
||||||
mLowQualityIn = mLedgerEntry->getFieldU32(sfLowQualityIn);
|
}
|
||||||
mLowQualityOut = mLedgerEntry->getFieldU32(sfLowQualityOut);
|
else if (entry->getFName() == sfHighLimit)
|
||||||
|
{
|
||||||
mHighQualityIn = mLedgerEntry->getFieldU32(sfHighQualityIn);
|
mHighLimit = *static_cast<const STAmount*>(entry);
|
||||||
mHighQualityOut = mLedgerEntry->getFieldU32(sfHighQualityOut);
|
mHighID = RippleAddress::createAccountID(mHighLimit.getIssuer());
|
||||||
|
}
|
||||||
mBalance = mLedgerEntry->getFieldAmount(sfBalance);
|
else if (entry->getFName() == sfLowQualityIn)
|
||||||
|
mLowQualityIn = static_cast<const STUInt32*>(entry)->getValue();
|
||||||
|
else if (entry->getFName() == sfHighQualityIn)
|
||||||
|
mHighQualityIn = static_cast<const STUInt32*>(entry)->getValue();
|
||||||
|
else if (entry->getFName() == sfBalance)
|
||||||
|
mBalance = *static_cast<const STAmount*>(entry);
|
||||||
|
}
|
||||||
|
|
||||||
mValid = true;
|
mValid = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,24 @@ TransactionMaster::TransactionMaster() : mCache("TransactionCache", CACHED_TRANS
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TransactionMaster::inLedger(const uint256& hash, uint32 ledger)
|
||||||
|
{
|
||||||
|
Transaction::pointer txn = mCache.fetch(hash);
|
||||||
|
if (!txn)
|
||||||
|
return false;
|
||||||
|
txn->setStatus(COMMITTED, ledger);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Transaction::pointer TransactionMaster::fetch(const uint256& txnID, bool checkDisk)
|
Transaction::pointer TransactionMaster::fetch(const uint256& txnID, bool checkDisk)
|
||||||
{
|
{
|
||||||
Transaction::pointer txn = mCache.fetch(txnID);
|
Transaction::pointer txn = mCache.fetch(txnID);
|
||||||
if (!checkDisk || txn) return txn;
|
if (!checkDisk || txn)
|
||||||
|
return txn;
|
||||||
|
|
||||||
txn = Transaction::load(txnID);
|
txn = Transaction::load(txnID);
|
||||||
if (!txn) return txn;
|
if (!txn)
|
||||||
|
return txn;
|
||||||
|
|
||||||
mCache.canonicalize(txnID, txn);
|
mCache.canonicalize(txnID, txn);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public:
|
|||||||
bool checkDisk, uint32 uCommitLedger);
|
bool checkDisk, uint32 uCommitLedger);
|
||||||
|
|
||||||
// return value: true = we had the transaction already
|
// return value: true = we had the transaction already
|
||||||
|
bool inLedger(const uint256& hash, uint32 ledger);
|
||||||
bool canonicalize(Transaction::pointer& txn, bool maybeNew);
|
bool canonicalize(Transaction::pointer& txn, bool maybeNew);
|
||||||
void sweep(void) { mCache.sweep(); }
|
void sweep(void) { mCache.sweep(); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -293,11 +293,10 @@ void ValidationCollection::condWrite()
|
|||||||
if (mWriting)
|
if (mWriting)
|
||||||
return;
|
return;
|
||||||
mWriting = true;
|
mWriting = true;
|
||||||
boost::thread thread(boost::bind(&ValidationCollection::doWrite, this));
|
theApp->getJobQueue().addJob(jtWRITE, boost::bind(&ValidationCollection::doWrite, this, _1));
|
||||||
thread.detach();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidationCollection::doWrite()
|
void ValidationCollection::doWrite(Job&)
|
||||||
{
|
{
|
||||||
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtDISK));
|
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtDISK));
|
||||||
static boost::format insVal("INSERT INTO Validations "
|
static boost::format insVal("INSERT INTO Validations "
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "SerializedValidation.h"
|
#include "SerializedValidation.h"
|
||||||
#include "TaggedCache.h"
|
#include "TaggedCache.h"
|
||||||
|
#include "JobQueue.h"
|
||||||
|
|
||||||
typedef boost::unordered_map<uint160, SerializedValidation::pointer> ValidationSet;
|
typedef boost::unordered_map<uint160, SerializedValidation::pointer> ValidationSet;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ protected:
|
|||||||
|
|
||||||
bool mWriting;
|
bool mWriting;
|
||||||
|
|
||||||
void doWrite();
|
void doWrite(Job&);
|
||||||
void condWrite();
|
void condWrite();
|
||||||
|
|
||||||
boost::shared_ptr<ValidationSet> findCreateSet(const uint256& ledgerHash);
|
boost::shared_ptr<ValidationSet> findCreateSet(const uint256& ledgerHash);
|
||||||
|
|||||||
Reference in New Issue
Block a user