mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 21:45:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -876,14 +876,15 @@ void NetworkOPs::setMode(OperatingMode om)
|
||||
mMode = om;
|
||||
}
|
||||
|
||||
std::vector< std::pair<uint32, uint256> >
|
||||
NetworkOPs::getAffectedAccounts(const RippleAddress& account, uint32 minLedger, uint32 maxLedger)
|
||||
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
||||
NetworkOPs::getAccountTxs(const RippleAddress& account, uint32 minLedger, uint32 maxLedger)
|
||||
{
|
||||
std::vector< std::pair<uint32, uint256> > affectedAccounts;
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > ret;
|
||||
|
||||
std::string sql =
|
||||
str(boost::format("SELECT LedgerSeq,TransID FROM AccountTransactions INDEXED BY AcctTxIndex "
|
||||
" WHERE Account = '%s' AND LedgerSeq <= '%d' AND LedgerSeq >= '%d' ORDER BY LedgerSeq LIMIT 1000;")
|
||||
str(boost::format("SELECT LedgerSeq,Status,RawTxn,TxnMeta FROM Transactions where TransID in (SELECT TransID from AccountTransactions "
|
||||
" WHERE Account = '%s' AND LedgerSeq <= '%d' AND LedgerSeq >= '%d' LIMIT 1000) ORDER BY LedgerSeq;")
|
||||
% account.humanAccountID() % maxLedger % minLedger);
|
||||
|
||||
{
|
||||
@@ -892,11 +893,24 @@ std::vector< std::pair<uint32, uint256> >
|
||||
|
||||
SQL_FOREACH(db, sql)
|
||||
{
|
||||
affectedAccounts.push_back(std::make_pair<uint32, uint256>(db->getInt("LedgerSeq"), uint256(db->getStrBinary("TransID"))));
|
||||
Transaction::pointer txn=Transaction::transactionFromSQL(db,false);
|
||||
|
||||
Serializer rawMeta;
|
||||
int metaSize = 2048;
|
||||
rawMeta.resize(metaSize);
|
||||
metaSize = db->getBinary("RawTxn", &*rawMeta.begin(), rawMeta.getLength());
|
||||
if (metaSize > rawMeta.getLength())
|
||||
{
|
||||
rawMeta.resize(metaSize);
|
||||
db->getBinary("RawTxn", &*rawMeta.begin(), rawMeta.getLength());
|
||||
}else rawMeta.resize(metaSize);
|
||||
|
||||
TransactionMetaSet::pointer meta= boost::make_shared<TransactionMetaSet>(txn->getID(), txn->getLedger(), rawMeta.getData());
|
||||
ret.push_back(std::make_pair<Transaction::pointer, TransactionMetaSet::pointer>(txn,meta));
|
||||
}
|
||||
}
|
||||
|
||||
return affectedAccounts;
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<RippleAddress>
|
||||
@@ -1076,6 +1090,7 @@ Json::Value NetworkOPs::transJson(const SerializedTransaction& stTxn, TER terRes
|
||||
void NetworkOPs::pubAcceptedTransaction(Ledger::ref lpCurrent, const SerializedTransaction& stTxn, TER terResult,TransactionMetaSet::pointer& meta)
|
||||
{
|
||||
Json::Value jvObj = transJson(stTxn, terResult, true, lpCurrent, "transaction");
|
||||
if(meta) jvObj["meta"]=meta->getJson(0);
|
||||
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||
|
||||
@@ -230,8 +230,8 @@ public:
|
||||
uint256 getConsensusLCL();
|
||||
|
||||
// client information retrieval functions
|
||||
std::vector< std::pair<uint32, uint256> >
|
||||
getAffectedAccounts(const RippleAddress& account, uint32 minLedger, uint32 maxLedger);
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
||||
getAccountTxs(const RippleAddress& account, uint32 minLedger, uint32 maxLedger);
|
||||
std::vector<RippleAddress> getLedgerAffectedAccounts(uint32 ledgerSeq);
|
||||
std::vector<SerializedTransaction> getLedgerTransactions(uint32 ledgerSeq);
|
||||
|
||||
|
||||
@@ -1292,25 +1292,18 @@ Json::Value RPCHandler::doAccountTransactions(const Json::Value& params)
|
||||
try
|
||||
{
|
||||
#endif
|
||||
std::vector< std::pair<uint32, uint256> > txns = mNetOps->getAffectedAccounts(account, minLedger, maxLedger);
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > txns = mNetOps->getAccountTxs(account, minLedger, maxLedger);
|
||||
Json::Value ret(Json::objectValue);
|
||||
ret["account"] = account.humanAccountID();
|
||||
Json::Value ledgers(Json::arrayValue);
|
||||
|
||||
// uint32 currentLedger = 0;
|
||||
for (std::vector< std::pair<uint32, uint256> >::iterator it = txns.begin(), end = txns.end(); it != end; ++it)
|
||||
for (std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >::iterator it = txns.begin(), end = txns.end(); it != end; ++it)
|
||||
{
|
||||
Transaction::pointer txn = theApp->getMasterTransaction().fetch(it->second, true);
|
||||
if (!txn)
|
||||
{
|
||||
ret["transactions"].append(it->second.GetHex());
|
||||
}
|
||||
else
|
||||
{
|
||||
txn->setLedger(it->first);
|
||||
ret["transactions"].append(txn->getJson(1));
|
||||
}
|
||||
|
||||
Json::Value obj(Json::objectValue);
|
||||
if(it->first) obj["tx"]=it->first->getJson(1);
|
||||
if(it->second) obj["meta"]=it->second->getJson(0);
|
||||
ret["transactions"].append(obj);
|
||||
}
|
||||
return ret;
|
||||
#ifndef DEBUG
|
||||
|
||||
@@ -246,6 +246,7 @@ Transaction::pointer Transaction::transactionFromSQL(const std::string& sql)
|
||||
return tr;
|
||||
}
|
||||
|
||||
|
||||
Transaction::pointer Transaction::load(const uint256& id)
|
||||
{
|
||||
std::string sql = "SELECT LedgerSeq,Status,RawTxn FROM Transactions WHERE TransID='";
|
||||
|
||||
Reference in New Issue
Block a user