|
|
|
|
@@ -384,28 +384,27 @@ public:
|
|
|
|
|
bool binary, bool count, bool bAdmin);
|
|
|
|
|
|
|
|
|
|
// client information retrieval functions
|
|
|
|
|
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
|
|
|
|
getAccountTxs (
|
|
|
|
|
using NetworkOPs::AccountTxs;
|
|
|
|
|
AccountTxs getAccountTxs (
|
|
|
|
|
const RippleAddress& account,
|
|
|
|
|
std::int32_t minLedger, std::int32_t maxLedger, bool descending,
|
|
|
|
|
std::uint32_t offset, int limit, bool bAdmin);
|
|
|
|
|
|
|
|
|
|
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
|
|
|
|
getTxsAccount (
|
|
|
|
|
AccountTxs getTxsAccount (
|
|
|
|
|
const RippleAddress& account, std::int32_t minLedger,
|
|
|
|
|
std::int32_t maxLedger, bool forward, Json::Value& token, int limit,
|
|
|
|
|
bool bAdmin);
|
|
|
|
|
|
|
|
|
|
typedef std::tuple<std::string, std::string, std::uint32_t>
|
|
|
|
|
txnMetaLedgerType;
|
|
|
|
|
using NetworkOPs::txnMetaLedgerType;
|
|
|
|
|
using NetworkOPs::MetaTxsList;
|
|
|
|
|
|
|
|
|
|
std::vector<txnMetaLedgerType>
|
|
|
|
|
MetaTxsList
|
|
|
|
|
getAccountTxsB (
|
|
|
|
|
const RippleAddress& account, std::int32_t minLedger,
|
|
|
|
|
std::int32_t maxLedger, bool descending, std::uint32_t offset,
|
|
|
|
|
int limit, bool bAdmin);
|
|
|
|
|
|
|
|
|
|
std::vector<txnMetaLedgerType>
|
|
|
|
|
MetaTxsList
|
|
|
|
|
getTxsAccountB (
|
|
|
|
|
const RippleAddress& account, std::int32_t minLedger,
|
|
|
|
|
std::int32_t maxLedger, bool forward, Json::Value& token,
|
|
|
|
|
@@ -505,7 +504,7 @@ private:
|
|
|
|
|
|
|
|
|
|
LockType mLock;
|
|
|
|
|
|
|
|
|
|
OperatingMode mMode;
|
|
|
|
|
std::atomic<OperatingMode> mMode;
|
|
|
|
|
|
|
|
|
|
bool mNeedNetworkLedger;
|
|
|
|
|
bool mProposing;
|
|
|
|
|
@@ -589,7 +588,7 @@ void NetworkOPsImp::onDeadlineTimer (beast::DeadlineTimer& timer)
|
|
|
|
|
void NetworkOPsImp::processHeartbeatTimer ()
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
Application::ScopedLockType lock (getApp().getMasterLock ());
|
|
|
|
|
auto lock = getApp().masterLock();
|
|
|
|
|
|
|
|
|
|
// VFALCO NOTE This is for diagnosing a crash on exit
|
|
|
|
|
Application& app (getApp ());
|
|
|
|
|
@@ -792,17 +791,19 @@ bool NetworkOPsImp::isValidated (std::uint32_t seq, uint256 const& hash)
|
|
|
|
|
bool NetworkOPsImp::isValidated (std::uint32_t seq)
|
|
|
|
|
{
|
|
|
|
|
// use when ledger was retrieved by seq
|
|
|
|
|
return haveLedger (seq) && (seq <= m_ledgerMaster.getValidatedLedger ()->getLedgerSeq ());
|
|
|
|
|
return haveLedger (seq) &&
|
|
|
|
|
seq <= m_ledgerMaster.getValidatedLedger ()->getLedgerSeq ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetworkOPsImp::submitTransaction (Job&, SerializedTransaction::pointer iTrans, stCallback callback)
|
|
|
|
|
void NetworkOPsImp::submitTransaction (
|
|
|
|
|
Job&, SerializedTransaction::pointer iTrans, stCallback callback)
|
|
|
|
|
{
|
|
|
|
|
// this is an asynchronous interface
|
|
|
|
|
Serializer s;
|
|
|
|
|
iTrans->add (s);
|
|
|
|
|
|
|
|
|
|
SerializerIterator sit (s);
|
|
|
|
|
SerializedTransaction::pointer trans = std::make_shared<SerializedTransaction> (std::ref (sit));
|
|
|
|
|
auto trans = std::make_shared<SerializedTransaction> (std::ref (sit));
|
|
|
|
|
|
|
|
|
|
uint256 suppress = trans->getTransactionID ();
|
|
|
|
|
int flags;
|
|
|
|
|
@@ -899,7 +900,7 @@ void NetworkOPsImp::runTransactionQueue ()
|
|
|
|
|
jtTXN_PROC, "runTxnQ");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Application::ScopedLockType lock (getApp().getMasterLock ());
|
|
|
|
|
auto lock = getApp().masterLock();
|
|
|
|
|
|
|
|
|
|
auto dbtx = getApp().getMasterTransaction ().fetch (
|
|
|
|
|
txn->getID (), true);
|
|
|
|
|
@@ -1011,7 +1012,7 @@ Transaction::pointer NetworkOPsImp::processTransactionCb (
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Application::ScopedLockType lock (getApp().getMasterLock ());
|
|
|
|
|
auto lock = getApp().masterLock();
|
|
|
|
|
|
|
|
|
|
bool didApply;
|
|
|
|
|
TER r = m_ledgerMaster.doTransaction (
|
|
|
|
|
@@ -1177,7 +1178,9 @@ STVector256 NetworkOPsImp::getDirNodeInfo (
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_journal.info << "getDirNodeInfo: node index: NOT FOUND: " << to_string (uNodeIndex);
|
|
|
|
|
m_journal.info
|
|
|
|
|
<< "getDirNodeInfo: node index: NOT FOUND: "
|
|
|
|
|
<< to_string (uNodeIndex);
|
|
|
|
|
|
|
|
|
|
uNodePrevious = 0;
|
|
|
|
|
uNodeNext = 0;
|
|
|
|
|
@@ -1609,7 +1612,7 @@ void NetworkOPsImp::processTrustedProposal (
|
|
|
|
|
uint256 checkLedger, bool sigGood)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
Application::ScopedLockType lock (getApp().getMasterLock ());
|
|
|
|
|
auto lock = getApp().masterLock();
|
|
|
|
|
|
|
|
|
|
bool relay = true;
|
|
|
|
|
|
|
|
|
|
@@ -1833,8 +1836,9 @@ void NetworkOPsImp::setMode (OperatingMode om)
|
|
|
|
|
|
|
|
|
|
mMode = om;
|
|
|
|
|
|
|
|
|
|
m_journal.stream((om < mMode) ? beast::Journal::kWarning : beast::Journal::kInfo) <<
|
|
|
|
|
"STATE->" << strOperatingMode ();
|
|
|
|
|
m_journal.stream((om < mMode)
|
|
|
|
|
? beast::Journal::kWarning : beast::Journal::kInfo)
|
|
|
|
|
<< "STATE->" << strOperatingMode ();
|
|
|
|
|
pubServer ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1852,44 +1856,63 @@ NetworkOPsImp::transactionsSQL (
|
|
|
|
|
std::uint32_t numberOfResults;
|
|
|
|
|
|
|
|
|
|
if (count)
|
|
|
|
|
{
|
|
|
|
|
numberOfResults = 1000000000;
|
|
|
|
|
}
|
|
|
|
|
else if (limit < 0)
|
|
|
|
|
{
|
|
|
|
|
numberOfResults = binary ? BINARY_PAGE_LENGTH : NONBINARY_PAGE_LENGTH;
|
|
|
|
|
}
|
|
|
|
|
else if (!bAdmin)
|
|
|
|
|
{
|
|
|
|
|
numberOfResults = std::min (
|
|
|
|
|
binary ? BINARY_PAGE_LENGTH : NONBINARY_PAGE_LENGTH,
|
|
|
|
|
static_cast<std::uint32_t> (limit));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
numberOfResults = limit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string maxClause = "";
|
|
|
|
|
std::string minClause = "";
|
|
|
|
|
|
|
|
|
|
if (maxLedger != -1)
|
|
|
|
|
maxClause = boost::str (boost::format ("AND AccountTransactions.LedgerSeq <= '%u'") % maxLedger);
|
|
|
|
|
{
|
|
|
|
|
maxClause = boost::str (boost::format (
|
|
|
|
|
"AND AccountTransactions.LedgerSeq <= '%u'") % maxLedger);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (minLedger != -1)
|
|
|
|
|
minClause = boost::str (boost::format ("AND AccountTransactions.LedgerSeq >= '%u'") % minLedger);
|
|
|
|
|
{
|
|
|
|
|
minClause = boost::str (boost::format (
|
|
|
|
|
"AND AccountTransactions.LedgerSeq >= '%u'") % minLedger);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string sql;
|
|
|
|
|
|
|
|
|
|
if (count)
|
|
|
|
|
sql =
|
|
|
|
|
boost::str (boost::format ("SELECT %s FROM AccountTransactions WHERE Account = '%s' %s %s LIMIT %u, %u;")
|
|
|
|
|
% selection
|
|
|
|
|
% account.humanAccountID ()
|
|
|
|
|
% maxClause
|
|
|
|
|
% minClause
|
|
|
|
|
% beast::lexicalCastThrow <std::string> (offset)
|
|
|
|
|
% beast::lexicalCastThrow <std::string> (numberOfResults)
|
|
|
|
|
);
|
|
|
|
|
boost::str (boost::format (
|
|
|
|
|
"SELECT %s FROM AccountTransactions "
|
|
|
|
|
"WHERE Account = '%s' %s %s LIMIT %u, %u;")
|
|
|
|
|
% selection
|
|
|
|
|
% account.humanAccountID ()
|
|
|
|
|
% maxClause
|
|
|
|
|
% minClause
|
|
|
|
|
% beast::lexicalCastThrow <std::string> (offset)
|
|
|
|
|
% beast::lexicalCastThrow <std::string> (numberOfResults)
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
sql =
|
|
|
|
|
boost::str (boost::format ("SELECT %s FROM "
|
|
|
|
|
"AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID "
|
|
|
|
|
"WHERE Account = '%s' %s %s "
|
|
|
|
|
"ORDER BY AccountTransactions.LedgerSeq %s, AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s "
|
|
|
|
|
"LIMIT %u, %u;")
|
|
|
|
|
boost::str (boost::format (
|
|
|
|
|
"SELECT %s FROM "
|
|
|
|
|
"AccountTransactions INNER JOIN Transactions "
|
|
|
|
|
"ON Transactions.TransID = AccountTransactions.TransID "
|
|
|
|
|
"WHERE Account = '%s' %s %s "
|
|
|
|
|
"ORDER BY AccountTransactions.LedgerSeq %s, "
|
|
|
|
|
"AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s "
|
|
|
|
|
"LIMIT %u, %u;")
|
|
|
|
|
% selection
|
|
|
|
|
% account.humanAccountID ()
|
|
|
|
|
% maxClause
|
|
|
|
|
@@ -1912,8 +1935,9 @@ NetworkOPs::AccountTxs NetworkOPsImp::getAccountTxs (
|
|
|
|
|
// can be called with no locks
|
|
|
|
|
AccountTxs ret;
|
|
|
|
|
|
|
|
|
|
std::string sql = NetworkOPsImp::transactionsSQL ("AccountTransactions.LedgerSeq,Status,RawTxn,TxnMeta", account,
|
|
|
|
|
minLedger, maxLedger, descending, offset, limit, false, false, bAdmin);
|
|
|
|
|
std::string sql = NetworkOPsImp::transactionsSQL (
|
|
|
|
|
"AccountTransactions.LedgerSeq,Status,RawTxn,TxnMeta", account,
|
|
|
|
|
minLedger, maxLedger, descending, offset, limit, false, false, bAdmin);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Database* db = getApp().getTxnDB ()->getDB ();
|
|
|
|
|
@@ -1921,25 +1945,29 @@ NetworkOPs::AccountTxs NetworkOPsImp::getAccountTxs (
|
|
|
|
|
|
|
|
|
|
SQL_FOREACH (db, sql)
|
|
|
|
|
{
|
|
|
|
|
Transaction::pointer txn = Transaction::transactionFromSQL (db, false);
|
|
|
|
|
auto txn = Transaction::transactionFromSQL (db, false);
|
|
|
|
|
|
|
|
|
|
Serializer rawMeta;
|
|
|
|
|
int metaSize = 2048;
|
|
|
|
|
rawMeta.resize (metaSize);
|
|
|
|
|
metaSize = db->getBinary ("TxnMeta", &*rawMeta.begin (), rawMeta.getLength ());
|
|
|
|
|
metaSize = db->getBinary (
|
|
|
|
|
"TxnMeta", &*rawMeta.begin (), rawMeta.getLength ());
|
|
|
|
|
|
|
|
|
|
if (metaSize > rawMeta.getLength ())
|
|
|
|
|
{
|
|
|
|
|
rawMeta.resize (metaSize);
|
|
|
|
|
db->getBinary ("TxnMeta", &*rawMeta.begin (), rawMeta.getLength ());
|
|
|
|
|
db->getBinary (
|
|
|
|
|
"TxnMeta", &*rawMeta.begin (), rawMeta.getLength ());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
rawMeta.resize (metaSize);
|
|
|
|
|
|
|
|
|
|
if (rawMeta.getLength() == 0)
|
|
|
|
|
{ // Work around a bug that could leave the metadata missing
|
|
|
|
|
std::uint32_t seq = static_cast<std::uint32_t>(db->getBigInt("LedgerSeq"));
|
|
|
|
|
m_journal.warning << "Recovering ledger " << seq << ", txn " << txn->getID();
|
|
|
|
|
auto seq = static_cast<std::uint32_t>(
|
|
|
|
|
db->getBigInt("LedgerSeq"));
|
|
|
|
|
m_journal.warning << "Recovering ledger " << seq
|
|
|
|
|
<< ", txn " << txn->getID();
|
|
|
|
|
Ledger::pointer ledger = getLedgerBySeq(seq);
|
|
|
|
|
if (ledger)
|
|
|
|
|
ledger->pendSaveValidated(false, false);
|
|
|
|
|
@@ -1961,8 +1989,10 @@ std::vector<NetworkOPsImp::txnMetaLedgerType> NetworkOPsImp::getAccountTxsB (
|
|
|
|
|
// can be called with no locks
|
|
|
|
|
std::vector< txnMetaLedgerType> ret;
|
|
|
|
|
|
|
|
|
|
std::string sql = NetworkOPsImp::transactionsSQL ("AccountTransactions.LedgerSeq,Status,RawTxn,TxnMeta", account,
|
|
|
|
|
minLedger, maxLedger, descending, offset, limit, true/*binary*/, false, bAdmin);
|
|
|
|
|
std::string sql = NetworkOPsImp::transactionsSQL (
|
|
|
|
|
"AccountTransactions.LedgerSeq,Status,RawTxn,TxnMeta", account,
|
|
|
|
|
minLedger, maxLedger, descending, offset, limit, true/*binary*/, false,
|
|
|
|
|
bAdmin);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Database* db = getApp().getTxnDB ()->getDB ();
|
|
|
|
|
@@ -2003,12 +2033,12 @@ std::vector<NetworkOPsImp::txnMetaLedgerType> NetworkOPsImp::getAccountTxsB (
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
|
|
|
|
NetworkOPsImp::getTxsAccount (const RippleAddress& account, std::int32_t minLedger,
|
|
|
|
|
std::int32_t maxLedger, bool forward, Json::Value& token,
|
|
|
|
|
int limit, bool bAdmin)
|
|
|
|
|
NetworkOPsImp::AccountTxs NetworkOPsImp::getTxsAccount (
|
|
|
|
|
const RippleAddress& account, std::int32_t minLedger,
|
|
|
|
|
std::int32_t maxLedger, bool forward, Json::Value& token,
|
|
|
|
|
int limit, bool bAdmin)
|
|
|
|
|
{
|
|
|
|
|
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > ret;
|
|
|
|
|
AccountTxs ret;
|
|
|
|
|
|
|
|
|
|
std::uint32_t NONBINARY_PAGE_LENGTH = 200;
|
|
|
|
|
std::uint32_t EXTRA_LENGTH = 100;
|
|
|
|
|
@@ -2045,10 +2075,14 @@ NetworkOPsImp::getTxsAccount (const RippleAddress& account, std::int32_t minLedg
|
|
|
|
|
token = Json::nullValue;
|
|
|
|
|
|
|
|
|
|
std::string sql = boost::str (boost::format
|
|
|
|
|
("SELECT AccountTransactions.LedgerSeq,AccountTransactions.TxnSeq,Status,RawTxn,TxnMeta "
|
|
|
|
|
"FROM AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID "
|
|
|
|
|
"WHERE AccountTransactions.Account = '%s' AND AccountTransactions.LedgerSeq BETWEEN '%u' AND '%u' "
|
|
|
|
|
"ORDER BY AccountTransactions.LedgerSeq %s, AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s "
|
|
|
|
|
("SELECT AccountTransactions.LedgerSeq,AccountTransactions.TxnSeq,"
|
|
|
|
|
"Status,RawTxn,TxnMeta "
|
|
|
|
|
"FROM AccountTransactions INNER JOIN Transactions "
|
|
|
|
|
"ON Transactions.TransID = AccountTransactions.TransID "
|
|
|
|
|
"WHERE AccountTransactions.Account = '%s' "
|
|
|
|
|
"AND AccountTransactions.LedgerSeq BETWEEN '%u' AND '%u' "
|
|
|
|
|
"ORDER BY AccountTransactions.LedgerSeq %s, "
|
|
|
|
|
"AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s "
|
|
|
|
|
"LIMIT %u;")
|
|
|
|
|
% account.humanAccountID()
|
|
|
|
|
% ((forward && (findLedger != 0)) ? findLedger : minLedger)
|
|
|
|
|
@@ -2065,8 +2099,8 @@ NetworkOPsImp::getTxsAccount (const RippleAddress& account, std::int32_t minLedg
|
|
|
|
|
{
|
|
|
|
|
if (!foundResume)
|
|
|
|
|
{
|
|
|
|
|
if ((findLedger == db->getInt("LedgerSeq")) && (findSeq == db->getInt("TxnSeq")))
|
|
|
|
|
foundResume = true;
|
|
|
|
|
foundResume = (findLedger == db->getInt("LedgerSeq") &&
|
|
|
|
|
findSeq == db->getInt("TxnSeq"));
|
|
|
|
|
}
|
|
|
|
|
else if (numberOfResults == 0)
|
|
|
|
|
{
|
|
|
|
|
@@ -2078,25 +2112,30 @@ NetworkOPsImp::getTxsAccount (const RippleAddress& account, std::int32_t minLedg
|
|
|
|
|
|
|
|
|
|
if (foundResume)
|
|
|
|
|
{
|
|
|
|
|
Transaction::pointer txn = Transaction::transactionFromSQL (db, false);
|
|
|
|
|
auto txn = Transaction::transactionFromSQL (db, false);
|
|
|
|
|
|
|
|
|
|
Serializer rawMeta;
|
|
|
|
|
int metaSize = 2048;
|
|
|
|
|
rawMeta.resize (metaSize);
|
|
|
|
|
metaSize = db->getBinary ("TxnMeta", &*rawMeta.begin (), rawMeta.getLength ());
|
|
|
|
|
metaSize = db->getBinary (
|
|
|
|
|
"TxnMeta", &*rawMeta.begin (), rawMeta.getLength ());
|
|
|
|
|
|
|
|
|
|
if (metaSize > rawMeta.getLength ())
|
|
|
|
|
{
|
|
|
|
|
rawMeta.resize (metaSize);
|
|
|
|
|
db->getBinary ("TxnMeta", &*rawMeta.begin (), rawMeta.getLength ());
|
|
|
|
|
db->getBinary (
|
|
|
|
|
"TxnMeta", &*rawMeta.begin (), rawMeta.getLength ());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
rawMeta.resize (metaSize);
|
|
|
|
|
|
|
|
|
|
if (rawMeta.getLength() == 0)
|
|
|
|
|
{ // Work around a bug that could leave the metadata missing
|
|
|
|
|
std::uint32_t seq = static_cast<std::uint32_t>(db->getBigInt("LedgerSeq"));
|
|
|
|
|
m_journal.warning << "Recovering ledger " << seq << ", txn " << txn->getID();
|
|
|
|
|
{
|
|
|
|
|
// Work around a bug that could leave the metadata missing
|
|
|
|
|
auto seq = static_cast<std::uint32_t>(
|
|
|
|
|
db->getBigInt("LedgerSeq"));
|
|
|
|
|
m_journal.warning << "Recovering ledger " << seq
|
|
|
|
|
<< ", txn " << txn->getID();
|
|
|
|
|
Ledger::pointer ledger = getLedgerBySeq(seq);
|
|
|
|
|
if (ledger)
|
|
|
|
|
ledger->pendSaveValidated(false, false);
|
|
|
|
|
@@ -2105,7 +2144,8 @@ NetworkOPsImp::getTxsAccount (const RippleAddress& account, std::int32_t minLedg
|
|
|
|
|
--numberOfResults;
|
|
|
|
|
|
|
|
|
|
ret.emplace_back (std::move (txn),
|
|
|
|
|
std::make_shared<TransactionMetaSet> (txn->getID (), txn->getLedger (), rawMeta.getData ()));
|
|
|
|
|
std::make_shared<TransactionMetaSet> (
|
|
|
|
|
txn->getID (), txn->getLedger (), rawMeta.getData ()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -2113,12 +2153,12 @@ NetworkOPsImp::getTxsAccount (const RippleAddress& account, std::int32_t minLedg
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<NetworkOPsImp::txnMetaLedgerType>
|
|
|
|
|
NetworkOPsImp::getTxsAccountB (const RippleAddress& account, std::int32_t minLedger,
|
|
|
|
|
std::int32_t maxLedger, bool forward, Json::Value& token,
|
|
|
|
|
int limit, bool bAdmin)
|
|
|
|
|
NetworkOPsImp::MetaTxsList NetworkOPsImp::getTxsAccountB (
|
|
|
|
|
const RippleAddress& account, std::int32_t minLedger,
|
|
|
|
|
std::int32_t maxLedger, bool forward, Json::Value& token,
|
|
|
|
|
int limit, bool bAdmin)
|
|
|
|
|
{
|
|
|
|
|
std::vector<txnMetaLedgerType> ret;
|
|
|
|
|
MetaTxsList ret;
|
|
|
|
|
|
|
|
|
|
std::uint32_t BINARY_PAGE_LENGTH = 500;
|
|
|
|
|
std::uint32_t EXTRA_LENGTH = 100;
|
|
|
|
|
@@ -2153,10 +2193,14 @@ NetworkOPsImp::getTxsAccountB (const RippleAddress& account, std::int32_t minLed
|
|
|
|
|
token = Json::nullValue;
|
|
|
|
|
|
|
|
|
|
std::string sql = boost::str (boost::format
|
|
|
|
|
("SELECT AccountTransactions.LedgerSeq,AccountTransactions.TxnSeq,Status,RawTxn,TxnMeta "
|
|
|
|
|
"FROM AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID "
|
|
|
|
|
"WHERE AccountTransactions.Account = '%s' AND AccountTransactions.LedgerSeq BETWEEN '%u' AND '%u' "
|
|
|
|
|
"ORDER BY AccountTransactions.LedgerSeq %s, AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s "
|
|
|
|
|
("SELECT AccountTransactions.LedgerSeq,AccountTransactions.TxnSeq,"
|
|
|
|
|
"Status,RawTxn,TxnMeta "
|
|
|
|
|
"FROM AccountTransactions INNER JOIN Transactions "
|
|
|
|
|
"ON Transactions.TransID = AccountTransactions.TransID "
|
|
|
|
|
"WHERE AccountTransactions.Account = '%s' "
|
|
|
|
|
"AND AccountTransactions.LedgerSeq BETWEEN '%u' AND '%u' "
|
|
|
|
|
"ORDER BY AccountTransactions.LedgerSeq %s, "
|
|
|
|
|
"AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s "
|
|
|
|
|
"LIMIT %u;")
|
|
|
|
|
% account.humanAccountID()
|
|
|
|
|
% ((forward && (findLedger != 0)) ? findLedger : minLedger)
|
|
|
|
|
@@ -2173,8 +2217,11 @@ NetworkOPsImp::getTxsAccountB (const RippleAddress& account, std::int32_t minLed
|
|
|
|
|
{
|
|
|
|
|
if (!foundResume)
|
|
|
|
|
{
|
|
|
|
|
if ((findLedger == db->getInt("LedgerSeq")) && (findSeq == db->getInt("TxnSeq")))
|
|
|
|
|
if (findLedger == db->getInt("LedgerSeq") &&
|
|
|
|
|
findSeq == db->getInt("TxnSeq"))
|
|
|
|
|
{
|
|
|
|
|
foundResume = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (numberOfResults == 0)
|
|
|
|
|
{
|
|
|
|
|
@@ -2200,17 +2247,22 @@ NetworkOPsImp::getTxsAccountB (const RippleAddress& account, std::int32_t minLed
|
|
|
|
|
|
|
|
|
|
int metaSize = 2048;
|
|
|
|
|
Blob rawMeta (metaSize);
|
|
|
|
|
metaSize = db->getBinary ("TxnMeta", &rawMeta[0], rawMeta.size ());
|
|
|
|
|
metaSize = db->getBinary (
|
|
|
|
|
"TxnMeta", &rawMeta[0], rawMeta.size ());
|
|
|
|
|
|
|
|
|
|
if (metaSize > rawMeta.size ())
|
|
|
|
|
{
|
|
|
|
|
rawMeta.resize (metaSize);
|
|
|
|
|
db->getBinary ("TxnMeta", &*rawMeta.begin (), rawMeta.size ());
|
|
|
|
|
db->getBinary (
|
|
|
|
|
"TxnMeta", &*rawMeta.begin (), rawMeta.size ());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rawMeta.resize (metaSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret.emplace_back (strHex (rawTxn), strHex (rawMeta), db->getInt ("LedgerSeq"));
|
|
|
|
|
ret.emplace_back (strHex (rawTxn), strHex (rawMeta),
|
|
|
|
|
db->getInt ("LedgerSeq"));
|
|
|
|
|
--numberOfResults;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -2224,8 +2276,9 @@ std::vector<RippleAddress>
|
|
|
|
|
NetworkOPsImp::getLedgerAffectedAccounts (std::uint32_t ledgerSeq)
|
|
|
|
|
{
|
|
|
|
|
std::vector<RippleAddress> accounts;
|
|
|
|
|
std::string sql = str (boost::format
|
|
|
|
|
("SELECT DISTINCT Account FROM AccountTransactions INDEXED BY AcctLgrIndex WHERE LedgerSeq = '%u';")
|
|
|
|
|
std::string sql = str (boost::format (
|
|
|
|
|
"SELECT DISTINCT Account FROM AccountTransactions "
|
|
|
|
|
"INDEXED BY AcctLgrIndex WHERE LedgerSeq = '%u';")
|
|
|
|
|
% ledgerSeq);
|
|
|
|
|
RippleAddress acct;
|
|
|
|
|
{
|
|
|
|
|
@@ -2240,9 +2293,11 @@ NetworkOPsImp::getLedgerAffectedAccounts (std::uint32_t ledgerSeq)
|
|
|
|
|
return accounts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool NetworkOPsImp::recvValidation (SerializedValidation::ref val, const std::string& source)
|
|
|
|
|
bool NetworkOPsImp::recvValidation (
|
|
|
|
|
SerializedValidation::ref val, const std::string& source)
|
|
|
|
|
{
|
|
|
|
|
m_journal.debug << "recvValidation " << val->getLedgerHash () << " from " << source;
|
|
|
|
|
m_journal.debug << "recvValidation " << val->getLedgerHash ()
|
|
|
|
|
<< " from " << source;
|
|
|
|
|
return getApp().getValidations ().addValidation (val, source);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2266,9 +2321,12 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
|
|
|
|
{
|
|
|
|
|
if (! admin)
|
|
|
|
|
{
|
|
|
|
|
// For a non admin connection, hash the node ID into a single RFC1751 word
|
|
|
|
|
Blob const& addr (getApp().getLocalCredentials ().getNodePublic ().getNodePublic ());
|
|
|
|
|
info [jss::hostid] = RFC1751::getWordFromBlob (addr.data (), addr.size ());
|
|
|
|
|
// For a non admin connection, hash the node ID into a single
|
|
|
|
|
// RFC1751 word.
|
|
|
|
|
Blob const& addr (getApp().getLocalCredentials ().getNodePublic ().
|
|
|
|
|
getNodePublic ());
|
|
|
|
|
info [jss::hostid] = RFC1751::getWordFromBlob (
|
|
|
|
|
addr.data (), addr.size ());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@@ -2286,20 +2344,28 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
|
|
|
|
|
|
|
|
|
info[jss::validation_quorum] = m_ledgerMaster.getMinValidations ();
|
|
|
|
|
|
|
|
|
|
info["io_latency_ms"] = static_cast<Json::UInt> (getApp().getIOLatency().count());
|
|
|
|
|
info["io_latency_ms"] = static_cast<Json::UInt> (
|
|
|
|
|
getApp().getIOLatency().count());
|
|
|
|
|
|
|
|
|
|
if (admin)
|
|
|
|
|
{
|
|
|
|
|
if (getConfig ().VALIDATION_PUB.isValid ())
|
|
|
|
|
info[jss::pubkey_validator] = getConfig ().VALIDATION_PUB.humanNodePublic ();
|
|
|
|
|
{
|
|
|
|
|
info[jss::pubkey_validator] =
|
|
|
|
|
getConfig ().VALIDATION_PUB.humanNodePublic ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
info[jss::pubkey_validator] = jss::none;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
info[jss::pubkey_node] = getApp().getLocalCredentials ().getNodePublic ().humanNodePublic ();
|
|
|
|
|
info[jss::pubkey_node] =
|
|
|
|
|
getApp().getLocalCredentials ().getNodePublic ().humanNodePublic ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info[jss::complete_ledgers] = getApp().getLedgerMaster ().getCompleteLedgers ();
|
|
|
|
|
info[jss::complete_ledgers] =
|
|
|
|
|
getApp().getLedgerMaster ().getCompleteLedgers ();
|
|
|
|
|
|
|
|
|
|
if (m_amendmentBlocked)
|
|
|
|
|
info[jss::amendment_blocked] = true;
|
|
|
|
|
@@ -2315,9 +2381,15 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
|
|
|
|
lastClose[jss::proposers] = getApp().getOPs ().getPreviousProposers ();
|
|
|
|
|
|
|
|
|
|
if (human)
|
|
|
|
|
lastClose[jss::converge_time_s] = static_cast<double> (getApp().getOPs ().getPreviousConvergeTime ()) / 1000.0;
|
|
|
|
|
{
|
|
|
|
|
lastClose[jss::converge_time_s] = static_cast<double> (
|
|
|
|
|
getApp().getOPs ().getPreviousConvergeTime ()) / 1000.0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
lastClose[jss::converge_time] = Json::Int (getApp().getOPs ().getPreviousConvergeTime ());
|
|
|
|
|
{
|
|
|
|
|
lastClose[jss::converge_time] =
|
|
|
|
|
Json::Int (getApp().getOPs ().getPreviousConvergeTime ());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
info[jss::last_close] = lastClose;
|
|
|
|
|
|
|
|
|
|
@@ -2335,7 +2407,8 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
info[jss::load_factor] =
|
|
|
|
|
static_cast<double> (getApp().getFeeTrack ().getLoadFactor ()) / getApp().getFeeTrack ().getLoadBase ();
|
|
|
|
|
static_cast<double> (getApp().getFeeTrack ().getLoadFactor ()) /
|
|
|
|
|
getApp().getFeeTrack ().getLoadBase ();
|
|
|
|
|
if (admin)
|
|
|
|
|
{
|
|
|
|
|
std::uint32_t base = getApp().getFeeTrack().getLoadBase();
|
|
|
|
|
@@ -2367,23 +2440,30 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
|
|
|
|
std::uint64_t baseFee = lpClosed->getBaseFee ();
|
|
|
|
|
std::uint64_t baseRef = lpClosed->getReferenceFeeUnits ();
|
|
|
|
|
Json::Value l (Json::objectValue);
|
|
|
|
|
l[jss::seq] = Json::UInt (lpClosed->getLedgerSeq ());
|
|
|
|
|
l[jss::hash] = to_string (lpClosed->getHash ());
|
|
|
|
|
l[jss::seq] = Json::UInt (lpClosed->getLedgerSeq ());
|
|
|
|
|
l[jss::hash] = to_string (lpClosed->getHash ());
|
|
|
|
|
|
|
|
|
|
if (!human)
|
|
|
|
|
{
|
|
|
|
|
l[jss::base_fee] = Json::Value::UInt (baseFee);
|
|
|
|
|
l[jss::reserve_base] = Json::Value::UInt (lpClosed->getReserve (0));
|
|
|
|
|
l[jss::reserve_inc] = Json::Value::UInt (lpClosed->getReserveInc ());
|
|
|
|
|
l[jss::close_time] = Json::Value::UInt (lpClosed->getCloseTimeNC ());
|
|
|
|
|
l[jss::base_fee] = Json::Value::UInt (baseFee);
|
|
|
|
|
l[jss::reserve_base] = Json::Value::UInt (lpClosed->getReserve (0));
|
|
|
|
|
l[jss::reserve_inc] =
|
|
|
|
|
Json::Value::UInt (lpClosed->getReserveInc ());
|
|
|
|
|
l[jss::close_time] =
|
|
|
|
|
Json::Value::UInt (lpClosed->getCloseTimeNC ());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
l[jss::base_fee_xrp] = static_cast<double> (baseFee) / SYSTEM_CURRENCY_PARTS;
|
|
|
|
|
l[jss::base_fee_xrp] = static_cast<double> (baseFee) /
|
|
|
|
|
SYSTEM_CURRENCY_PARTS;
|
|
|
|
|
l[jss::reserve_base_xrp] =
|
|
|
|
|
static_cast<double> (Json::UInt (lpClosed->getReserve (0) * baseFee / baseRef)) / SYSTEM_CURRENCY_PARTS;
|
|
|
|
|
static_cast<double> (Json::UInt (
|
|
|
|
|
lpClosed->getReserve (0) * baseFee / baseRef))
|
|
|
|
|
/ SYSTEM_CURRENCY_PARTS;
|
|
|
|
|
l[jss::reserve_inc_xrp] =
|
|
|
|
|
static_cast<double> (Json::UInt (lpClosed->getReserveInc () * baseFee / baseRef)) / SYSTEM_CURRENCY_PARTS;
|
|
|
|
|
static_cast<double> (Json::UInt (
|
|
|
|
|
lpClosed->getReserveInc () * baseFee / baseRef))
|
|
|
|
|
/ SYSTEM_CURRENCY_PARTS;
|
|
|
|
|
|
|
|
|
|
std::uint32_t closeTime = getCloseTimeNC ();
|
|
|
|
|
std::uint32_t lCloseTime = lpClosed->getCloseTimeNC ();
|
|
|
|
|
@@ -2393,7 +2473,7 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
|
|
|
|
|
std::uint32_t age = closeTime - lCloseTime;
|
|
|
|
|
|
|
|
|
|
if (age < 1000000)
|
|
|
|
|
l[jss::age] = Json::UInt (age);
|
|
|
|
|
l[jss::age] = Json::UInt (age);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2426,7 +2506,8 @@ Json::Value NetworkOPsImp::getLedgerFetchInfo ()
|
|
|
|
|
// Monitoring: publisher side
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
Json::Value NetworkOPsImp::pubBootstrapAccountInfo (Ledger::ref lpAccepted, const RippleAddress& naAccountID)
|
|
|
|
|
Json::Value NetworkOPsImp::pubBootstrapAccountInfo (
|
|
|
|
|
Ledger::ref lpAccepted, const RippleAddress& naAccountID)
|
|
|
|
|
{
|
|
|
|
|
Json::Value jvObj (Json::objectValue);
|
|
|
|
|
|
|
|
|
|
@@ -2435,19 +2516,21 @@ Json::Value NetworkOPsImp::pubBootstrapAccountInfo (Ledger::ref lpAccepted, cons
|
|
|
|
|
jvObj["owner"] = getOwnerInfo (lpAccepted, naAccountID);
|
|
|
|
|
jvObj["ledger_index"] = lpAccepted->getLedgerSeq ();
|
|
|
|
|
jvObj["ledger_hash"] = to_string (lpAccepted->getHash ());
|
|
|
|
|
jvObj["ledger_time"] = Json::Value::UInt (utFromSeconds (lpAccepted->getCloseTimeNC ()));
|
|
|
|
|
jvObj["ledger_time"]
|
|
|
|
|
= Json::Value::UInt (utFromSeconds (lpAccepted->getCloseTimeNC ()));
|
|
|
|
|
|
|
|
|
|
return jvObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetworkOPsImp::pubProposedTransaction (Ledger::ref lpCurrent, SerializedTransaction::ref stTxn, TER terResult)
|
|
|
|
|
void NetworkOPsImp::pubProposedTransaction (
|
|
|
|
|
Ledger::ref lpCurrent, SerializedTransaction::ref stTxn, TER terResult)
|
|
|
|
|
{
|
|
|
|
|
Json::Value jvObj = transJson (*stTxn, terResult, false, lpCurrent);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ScopedLockType sl (mLock);
|
|
|
|
|
NetworkOPsImp::SubMapType::const_iterator it = mSubRTTransactions.begin ();
|
|
|
|
|
|
|
|
|
|
auto it = mSubRTTransactions.begin ();
|
|
|
|
|
while (it != mSubRTTransactions.end ())
|
|
|
|
|
{
|
|
|
|
|
InfoSub::pointer p = it->second.lock ();
|
|
|
|
|
@@ -2458,7 +2541,9 @@ void NetworkOPsImp::pubProposedTransaction (Ledger::ref lpCurrent, SerializedTra
|
|
|
|
|
++it;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
it = mSubRTTransactions.erase (it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
AcceptedLedgerTx alt (stTxn, terResult);
|
|
|
|
|
@@ -2471,7 +2556,7 @@ void NetworkOPsImp::pubLedger (Ledger::ref accepted)
|
|
|
|
|
// Ledgers are published only when they acquire sufficient validations
|
|
|
|
|
// Holes are filled across connection loss or other catastrophe
|
|
|
|
|
|
|
|
|
|
AcceptedLedger::pointer alpAccepted = AcceptedLedger::makeAcceptedLedger (accepted);
|
|
|
|
|
auto alpAccepted = AcceptedLedger::makeAcceptedLedger (accepted);
|
|
|
|
|
Ledger::ref lpAccepted = alpAccepted->getLedger ();
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
@@ -2481,27 +2566,30 @@ void NetworkOPsImp::pubLedger (Ledger::ref accepted)
|
|
|
|
|
{
|
|
|
|
|
Json::Value jvObj (Json::objectValue);
|
|
|
|
|
|
|
|
|
|
jvObj[jss::type] = jss::ledgerClosed;
|
|
|
|
|
jvObj[jss::ledger_index] = lpAccepted->getLedgerSeq ();
|
|
|
|
|
jvObj[jss::ledger_hash] = to_string (lpAccepted->getHash ());
|
|
|
|
|
jvObj[jss::ledger_time] = Json::Value::UInt (lpAccepted->getCloseTimeNC ());
|
|
|
|
|
jvObj[jss::type] = jss::ledgerClosed;
|
|
|
|
|
jvObj[jss::ledger_index] = lpAccepted->getLedgerSeq ();
|
|
|
|
|
jvObj[jss::ledger_hash] = to_string (lpAccepted->getHash ());
|
|
|
|
|
jvObj[jss::ledger_time]
|
|
|
|
|
= Json::Value::UInt (lpAccepted->getCloseTimeNC ());
|
|
|
|
|
|
|
|
|
|
jvObj[jss::fee_ref] = Json::UInt (lpAccepted->getReferenceFeeUnits ());
|
|
|
|
|
jvObj[jss::fee_base] = Json::UInt (lpAccepted->getBaseFee ());
|
|
|
|
|
jvObj[jss::reserve_base] = Json::UInt (lpAccepted->getReserve (0));
|
|
|
|
|
jvObj[jss::reserve_inc] = Json::UInt (lpAccepted->getReserveInc ());
|
|
|
|
|
jvObj[jss::fee_ref]
|
|
|
|
|
= Json::UInt (lpAccepted->getReferenceFeeUnits ());
|
|
|
|
|
jvObj[jss::fee_base] = Json::UInt (lpAccepted->getBaseFee ());
|
|
|
|
|
jvObj[jss::reserve_base] = Json::UInt (lpAccepted->getReserve (0));
|
|
|
|
|
jvObj[jss::reserve_inc] = Json::UInt (lpAccepted->getReserveInc ());
|
|
|
|
|
|
|
|
|
|
jvObj[jss::txn_count] = Json::UInt (alpAccepted->getTxnCount ());
|
|
|
|
|
jvObj[jss::txn_count] = Json::UInt (alpAccepted->getTxnCount ());
|
|
|
|
|
|
|
|
|
|
if (mMode >= omSYNCING)
|
|
|
|
|
jvObj[jss::validated_ledgers] = getApp().getLedgerMaster ().getCompleteLedgers ();
|
|
|
|
|
|
|
|
|
|
NetworkOPsImp::SubMapType::const_iterator it = mSubLedger.begin ();
|
|
|
|
|
{
|
|
|
|
|
jvObj[jss::validated_ledgers]
|
|
|
|
|
= getApp().getLedgerMaster ().getCompleteLedgers ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto it = mSubLedger.begin ();
|
|
|
|
|
while (it != mSubLedger.end ())
|
|
|
|
|
{
|
|
|
|
|
InfoSub::pointer p = it->second.lock ();
|
|
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
|
{
|
|
|
|
|
p->send (jvObj, true);
|
|
|
|
|
@@ -2527,13 +2615,17 @@ void NetworkOPsImp::reportFeeChange ()
|
|
|
|
|
(getApp().getFeeTrack ().getLoadFactor () == mLastLoadFactor))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
getApp().getJobQueue ().addJob (jtCLIENT, "reportFeeChange->pubServer", std::bind (&NetworkOPsImp::pubServer, this));
|
|
|
|
|
getApp().getJobQueue ().addJob (
|
|
|
|
|
jtCLIENT, "reportFeeChange->pubServer",
|
|
|
|
|
std::bind (&NetworkOPsImp::pubServer, this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Json::Value NetworkOPsImp::transJson (const SerializedTransaction& stTxn, TER terResult, bool bValidated,
|
|
|
|
|
Ledger::ref lpCurrent)
|
|
|
|
|
Json::Value NetworkOPsImp::transJson (
|
|
|
|
|
const SerializedTransaction& stTxn, TER terResult, bool bValidated,
|
|
|
|
|
Ledger::ref lpCurrent)
|
|
|
|
|
{
|
|
|
|
|
// This routine should only be used to publish accepted or validated transactions
|
|
|
|
|
// This routine should only be used to publish accepted or validated
|
|
|
|
|
// transactions.
|
|
|
|
|
Json::Value jvObj (Json::objectValue);
|
|
|
|
|
std::string sToken;
|
|
|
|
|
std::string sHuman;
|
|
|
|
|
@@ -2567,9 +2659,11 @@ Json::Value NetworkOPsImp::transJson (const SerializedTransaction& stTxn, TER te
|
|
|
|
|
return jvObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetworkOPsImp::pubValidatedTransaction (Ledger::ref alAccepted, const AcceptedLedgerTx& alTx)
|
|
|
|
|
void NetworkOPsImp::pubValidatedTransaction (
|
|
|
|
|
Ledger::ref alAccepted, const AcceptedLedgerTx& alTx)
|
|
|
|
|
{
|
|
|
|
|
Json::Value jvObj = transJson (*alTx.getTxn (), alTx.getResult (), true, alAccepted);
|
|
|
|
|
Json::Value jvObj = transJson (
|
|
|
|
|
*alTx.getTxn (), alTx.getResult (), true, alAccepted);
|
|
|
|
|
jvObj[jss::meta] = alTx.getMeta ()->getJson (0);
|
|
|
|
|
|
|
|
|
|
Json::FastWriter w;
|
|
|
|
|
@@ -2578,8 +2672,7 @@ void NetworkOPsImp::pubValidatedTransaction (Ledger::ref alAccepted, const Accep
|
|
|
|
|
{
|
|
|
|
|
ScopedLockType sl (mLock);
|
|
|
|
|
|
|
|
|
|
NetworkOPsImp::SubMapType::const_iterator it = mSubTransactions.begin ();
|
|
|
|
|
|
|
|
|
|
auto it = mSubTransactions.begin ();
|
|
|
|
|
while (it != mSubTransactions.end ())
|
|
|
|
|
{
|
|
|
|
|
InfoSub::pointer p = it->second.lock ();
|
|
|
|
|
@@ -2612,7 +2705,8 @@ void NetworkOPsImp::pubValidatedTransaction (Ledger::ref alAccepted, const Accep
|
|
|
|
|
pubAccountTransaction (alAccepted, alTx, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetworkOPsImp::pubAccountTransaction (Ledger::ref lpCurrent, const AcceptedLedgerTx& alTx, bool bAccepted)
|
|
|
|
|
void NetworkOPsImp::pubAccountTransaction (
|
|
|
|
|
Ledger::ref lpCurrent, const AcceptedLedgerTx& alTx, bool bAccepted)
|
|
|
|
|
{
|
|
|
|
|
hash_set<InfoSub::pointer> notify;
|
|
|
|
|
int iProposed = 0;
|
|
|
|
|
@@ -2627,8 +2721,8 @@ void NetworkOPsImp::pubAccountTransaction (Ledger::ref lpCurrent, const Accepted
|
|
|
|
|
{
|
|
|
|
|
for (auto const& affectedAccount: alTx.getAffected ())
|
|
|
|
|
{
|
|
|
|
|
auto simiIt = mSubRTAccount.find (affectedAccount.getAccountID ());
|
|
|
|
|
|
|
|
|
|
auto simiIt
|
|
|
|
|
= mSubRTAccount.find (affectedAccount.getAccountID ());
|
|
|
|
|
if (simiIt != mSubRTAccount.end ())
|
|
|
|
|
{
|
|
|
|
|
auto it = simiIt->second.begin ();
|
|
|
|
|
@@ -2654,8 +2748,7 @@ void NetworkOPsImp::pubAccountTransaction (Ledger::ref lpCurrent, const Accepted
|
|
|
|
|
|
|
|
|
|
if (simiIt != mSubAccount.end ())
|
|
|
|
|
{
|
|
|
|
|
NetworkOPsImp::SubMapType::const_iterator it = simiIt->second.begin ();
|
|
|
|
|
|
|
|
|
|
auto it = simiIt->second.begin ();
|
|
|
|
|
while (it != simiIt->second.end ())
|
|
|
|
|
{
|
|
|
|
|
InfoSub::pointer p = it->second.lock ();
|
|
|
|
|
@@ -2719,14 +2812,14 @@ void NetworkOPsImp::subAccount (InfoSub::ref isrListener,
|
|
|
|
|
|
|
|
|
|
BOOST_FOREACH (const RippleAddress & naAccountID, vnaAccountIDs)
|
|
|
|
|
{
|
|
|
|
|
SubInfoMapType::iterator simIterator = subMap.find (naAccountID.getAccountID ());
|
|
|
|
|
|
|
|
|
|
auto simIterator = subMap.find (naAccountID.getAccountID ());
|
|
|
|
|
if (simIterator == subMap.end ())
|
|
|
|
|
{
|
|
|
|
|
// Not found, note that account has a new single listner.
|
|
|
|
|
SubMapType usisElement;
|
|
|
|
|
usisElement[isrListener->getSeq ()] = isrListener;
|
|
|
|
|
subMap.insert (simIterator, make_pair (naAccountID.getAccountID (), usisElement));
|
|
|
|
|
subMap.insert (simIterator, make_pair (naAccountID.getAccountID (),
|
|
|
|
|
usisElement));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@@ -2736,9 +2829,10 @@ void NetworkOPsImp::subAccount (InfoSub::ref isrListener,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetworkOPsImp::unsubAccount (std::uint64_t uSeq,
|
|
|
|
|
const hash_set<RippleAddress>& vnaAccountIDs,
|
|
|
|
|
bool rt)
|
|
|
|
|
void NetworkOPsImp::unsubAccount (
|
|
|
|
|
std::uint64_t uSeq,
|
|
|
|
|
hash_set<RippleAddress> const& vnaAccountIDs,
|
|
|
|
|
bool rt)
|
|
|
|
|
{
|
|
|
|
|
SubInfoMapType& subMap = rt ? mSubRTAccount : mSubAccount;
|
|
|
|
|
|
|
|
|
|
@@ -2798,7 +2892,9 @@ void NetworkOPsImp::newLCL (
|
|
|
|
|
std::uint32_t NetworkOPsImp::acceptLedger ()
|
|
|
|
|
{
|
|
|
|
|
// accept the current transaction tree, return the new ledger's sequence
|
|
|
|
|
beginConsensus (m_ledgerMaster.getClosedLedger ()->getHash (), m_ledgerMaster.getCurrentLedger ());
|
|
|
|
|
beginConsensus (
|
|
|
|
|
m_ledgerMaster.getClosedLedger ()->getHash (),
|
|
|
|
|
m_ledgerMaster.getCurrentLedger ());
|
|
|
|
|
mConsensus->simulate ();
|
|
|
|
|
return m_ledgerMaster.getCurrentLedger ()->getLedgerSeq ();
|
|
|
|
|
}
|
|
|
|
|
@@ -2814,17 +2910,6 @@ void NetworkOPsImp::storeProposal (
|
|
|
|
|
props.push_back (proposal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
void NetworkOPsImp::subAccountChanges (
|
|
|
|
|
InfoSub* isrListener, const uint256 uLedgerHash)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetworkOPsImp::unsubAccountChanges (InfoSub* isrListener)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// <-- bool: true=added, false=already there
|
|
|
|
|
bool NetworkOPsImp::subLedger (InfoSub::ref isrListener, Json::Value& jvResult)
|
|
|
|
|
{
|
|
|
|
|
@@ -2834,15 +2919,20 @@ bool NetworkOPsImp::subLedger (InfoSub::ref isrListener, Json::Value& jvResult)
|
|
|
|
|
{
|
|
|
|
|
jvResult[jss::ledger_index] = lpClosed->getLedgerSeq ();
|
|
|
|
|
jvResult[jss::ledger_hash] = to_string (lpClosed->getHash ());
|
|
|
|
|
jvResult[jss::ledger_time] = Json::Value::UInt (lpClosed->getCloseTimeNC ());
|
|
|
|
|
jvResult[jss::fee_ref] = Json::UInt (lpClosed->getReferenceFeeUnits ());
|
|
|
|
|
jvResult[jss::ledger_time]
|
|
|
|
|
= Json::Value::UInt (lpClosed->getCloseTimeNC ());
|
|
|
|
|
jvResult[jss::fee_ref]
|
|
|
|
|
= Json::UInt (lpClosed->getReferenceFeeUnits ());
|
|
|
|
|
jvResult[jss::fee_base] = Json::UInt (lpClosed->getBaseFee ());
|
|
|
|
|
jvResult[jss::reserve_base] = Json::UInt (lpClosed->getReserve (0));
|
|
|
|
|
jvResult[jss::reserve_inc] = Json::UInt (lpClosed->getReserveInc ());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((mMode >= omSYNCING) && !isNeedNetworkLedger ())
|
|
|
|
|
jvResult[jss::validated_ledgers] = getApp().getLedgerMaster ().getCompleteLedgers ();
|
|
|
|
|
{
|
|
|
|
|
jvResult[jss::validated_ledgers]
|
|
|
|
|
= getApp().getLedgerMaster ().getCompleteLedgers ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScopedLockType sl (mLock);
|
|
|
|
|
return mSubLedger.emplace (isrListener->getSeq (), isrListener).second;
|
|
|
|
|
@@ -2885,7 +2975,8 @@ bool NetworkOPsImp::unsubServer (std::uint64_t uSeq)
|
|
|
|
|
bool NetworkOPsImp::subTransactions (InfoSub::ref isrListener)
|
|
|
|
|
{
|
|
|
|
|
ScopedLockType sl (mLock);
|
|
|
|
|
return mSubTransactions.emplace (isrListener->getSeq (), isrListener).second;
|
|
|
|
|
return mSubTransactions.emplace (
|
|
|
|
|
isrListener->getSeq (), isrListener).second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <-- bool: true=erased, false=was not there
|
|
|
|
|
@@ -2899,7 +2990,8 @@ bool NetworkOPsImp::unsubTransactions (std::uint64_t uSeq)
|
|
|
|
|
bool NetworkOPsImp::subRTTransactions (InfoSub::ref isrListener)
|
|
|
|
|
{
|
|
|
|
|
ScopedLockType sl (mLock);
|
|
|
|
|
return mSubRTTransactions.emplace (isrListener->getSeq (), isrListener).second;
|
|
|
|
|
return mSubRTTransactions.emplace (
|
|
|
|
|
isrListener->getSeq (), isrListener).second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <-- bool: true=erased, false=was not there
|
|
|
|
|
@@ -2921,7 +3013,8 @@ InfoSub::pointer NetworkOPsImp::findRpcSub (const std::string& strUrl)
|
|
|
|
|
return InfoSub::pointer ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InfoSub::pointer NetworkOPsImp::addRpcSub (const std::string& strUrl, InfoSub::ref rspEntry)
|
|
|
|
|
InfoSub::pointer NetworkOPsImp::addRpcSub (
|
|
|
|
|
const std::string& strUrl, InfoSub::ref rspEntry)
|
|
|
|
|
{
|
|
|
|
|
ScopedLockType sl (mLock);
|
|
|
|
|
|
|
|
|
|
@@ -2976,7 +3069,7 @@ void NetworkOPsImp::getBookPage (
|
|
|
|
|
if (iLeft == 0 || iLeft > 300)
|
|
|
|
|
iLeft = 300;
|
|
|
|
|
|
|
|
|
|
std::uint32_t uTransferRate = lesActive.rippleTransferRate (book.out.account);
|
|
|
|
|
auto uTransferRate = lesActive.rippleTransferRate (book.out.account);
|
|
|
|
|
|
|
|
|
|
while (! bDone && iLeft-- > 0)
|
|
|
|
|
{
|
|
|
|
|
|