mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 14:05:51 +00:00
Handle an edge case.
This commit is contained in:
@@ -415,29 +415,34 @@ void Ledger::saveAcceptedLedger(bool fromConsensus, LoadEvent::pointer event)
|
|||||||
if (!SQL_EXISTS(db, boost::str(AcctTransExists % item->getTag().GetHex())))
|
if (!SQL_EXISTS(db, boost::str(AcctTransExists % item->getTag().GetHex())))
|
||||||
{
|
{
|
||||||
// Transaction not in AccountTransactions
|
// Transaction not in AccountTransactions
|
||||||
std::vector<RippleAddress> accts = meta.getAffectedAccounts();
|
const std::vector<RippleAddress> accts = meta.getAffectedAccounts();
|
||||||
|
if (!accts.empty())
|
||||||
std::string sql = "INSERT INTO AccountTransactions (TransID, Account, LedgerSeq) VALUES ";
|
|
||||||
bool first = true;
|
|
||||||
for (std::vector<RippleAddress>::iterator it = accts.begin(), end = accts.end(); it != end; ++it)
|
|
||||||
{
|
{
|
||||||
if (!first)
|
|
||||||
sql += ", ('";
|
std::string sql = "INSERT INTO AccountTransactions (TransID, Account, LedgerSeq) VALUES ";
|
||||||
else
|
bool first = true;
|
||||||
|
for (std::vector<RippleAddress>::const_iterator it = accts.begin(), end = accts.end(); it != end; ++it)
|
||||||
{
|
{
|
||||||
sql += "('";
|
if (!first)
|
||||||
first = false;
|
sql += ", ('";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql += "('";
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
sql += txn.getTransactionID().GetHex();
|
||||||
|
sql += "','";
|
||||||
|
sql += it->humanAccountID();
|
||||||
|
sql += "',";
|
||||||
|
sql += boost::lexical_cast<std::string>(getLedgerSeq());
|
||||||
|
sql += ")";
|
||||||
}
|
}
|
||||||
sql += txn.getTransactionID().GetHex();
|
sql += ";";
|
||||||
sql += "','";
|
Log(lsTRACE) << "ActTx: " << sql;
|
||||||
sql += it->humanAccountID();
|
db->executeSQL(sql); // may already be in there
|
||||||
sql += "',";
|
|
||||||
sql += boost::lexical_cast<std::string>(getLedgerSeq());
|
|
||||||
sql += ")";
|
|
||||||
}
|
}
|
||||||
sql += ";";
|
else
|
||||||
Log(lsTRACE) << "ActTx: " << sql;
|
cLog(lsWARNING) << "Transaaction in ledger " << mLedgerSeq << " affects not accounts";
|
||||||
db->executeSQL(sql); // may already be in there
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SQL_EXISTS(db, boost::str(transExists % txn.getTransactionID().GetHex())))
|
if (SQL_EXISTS(db, boost::str(transExists % txn.getTransactionID().GetHex())))
|
||||||
|
|||||||
Reference in New Issue
Block a user