mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Reduce scope of RPC locks and general cleanup (RIPD-458)
This commit is contained in:
@@ -72,9 +72,15 @@ public:
|
||||
*/
|
||||
typedef RippleRecursiveMutex LockType;
|
||||
typedef std::unique_lock <LockType> ScopedLockType;
|
||||
typedef std::unique_ptr <ScopedLockType> ScopedLock;
|
||||
|
||||
virtual LockType& getMasterLock () = 0;
|
||||
|
||||
ScopedLock masterLock()
|
||||
{
|
||||
return std::make_unique<ScopedLockType> (getMasterLock());
|
||||
}
|
||||
|
||||
public:
|
||||
Application ();
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -285,20 +285,17 @@ public:
|
||||
bool count, bool bAdmin) = 0;
|
||||
|
||||
// client information retrieval functions
|
||||
typedef std::vector<
|
||||
std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
||||
AccountTxs;
|
||||
typedef std::pair<Transaction::pointer, TransactionMetaSet::pointer>
|
||||
AccountTx;
|
||||
|
||||
typedef std::vector<AccountTx> AccountTxs;
|
||||
|
||||
virtual AccountTxs getAccountTxs (
|
||||
const RippleAddress& account,
|
||||
std::int32_t minLedger, std::int32_t maxLedger, bool descending,
|
||||
std::uint32_t offset, int limit, bool bAdmin) = 0;
|
||||
|
||||
typedef std::vector<
|
||||
std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
||||
TxsAccount;
|
||||
|
||||
virtual TxsAccount getTxsAccount (
|
||||
virtual AccountTxs getTxsAccount (
|
||||
const RippleAddress& account,
|
||||
std::int32_t minLedger, std::int32_t maxLedger, bool forward,
|
||||
Json::Value& token, int limit, bool bAdmin) = 0;
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
|
||||
ScopedLockType sl (mLock);
|
||||
|
||||
std::string s = boost::str (boost::format (f) % to_string (challenge) %
|
||||
std::string s = boost::str (boost::format (f) % to_string (challenge) %
|
||||
to_string (mTarget) % mIterations % now);
|
||||
std::string c = to_string (mSecret) + s;
|
||||
s += "-" + to_string (Serializer::getSHA512Half (c));
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
return powCORRUPT;
|
||||
}
|
||||
|
||||
std::string v = to_string (mSecret) + fields[0] + "-" +
|
||||
std::string v = to_string (mSecret) + fields[0] + "-" +
|
||||
fields[1] + "-" + fields[2] + "-" + fields[3];
|
||||
|
||||
if (fields[4] != to_string (Serializer::getSHA512Half (v)))
|
||||
@@ -354,9 +354,9 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
ProofOfWorkFactory* ProofOfWorkFactory::New ()
|
||||
std::unique_ptr<ProofOfWorkFactory> ProofOfWorkFactory::New ()
|
||||
{
|
||||
return new ProofOfWorkFactoryImp;
|
||||
return std::make_unique<ProofOfWorkFactoryImp>();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
ProofOfWork pow = gen.getProof ();
|
||||
|
||||
beast::String s;
|
||||
|
||||
|
||||
s << "solve difficulty " << beast::String (pow.getDifficulty ());
|
||||
|
||||
uint256 solution = pow.solve (16777216);
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
kMaxDifficulty = 30,
|
||||
};
|
||||
|
||||
static ProofOfWorkFactory* New ();
|
||||
static std::unique_ptr<ProofOfWorkFactory> New ();
|
||||
|
||||
virtual ~ProofOfWorkFactory () { }
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ void TransactionAcquire::onTimer (bool progress, ScopedLockType& psl)
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Ten timeouts on TX set " << getHash ();
|
||||
psl.unlock();
|
||||
{
|
||||
Application::ScopedLockType lock (getApp().getMasterLock ());
|
||||
auto lock = getApp().masterLock();
|
||||
|
||||
if (getApp().getOPs ().stillNeedTXSet (mHash))
|
||||
{
|
||||
|
||||
@@ -66,7 +66,8 @@ public:
|
||||
|
||||
public:
|
||||
RPCInternalHandler (const std::string& name, handler_t handler);
|
||||
static Json::Value runHandler (const std::string& name, const Json::Value& params);
|
||||
static Json::Value runHandler (
|
||||
const std::string& name, const Json::Value& params);
|
||||
|
||||
private:
|
||||
// VFALCO TODO Replace with a singleton with a well defined interface and
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace RPC {
|
||||
const int DEFAULT_AUTO_FILL_FEE_MULTIPLIER = 10;
|
||||
const int MAX_PATHFINDS_IN_PROGRESS = 2;
|
||||
const int MAX_PATHFIND_JOB_COUNT = 50;
|
||||
const int MAX_JOB_QUEUE_CLIENTS = 500;
|
||||
const int MAX_VALIDATED_LEDGER_AGE = 120;
|
||||
|
||||
// TODO(tom): Shouldn't DEFAULT_AUTO_FILL_FEE_MULTIPLIER be floating point?
|
||||
|
||||
|
||||
@@ -21,37 +21,40 @@ namespace ripple {
|
||||
|
||||
Json::Value doAccountCurrencies (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
// Get the current ledger
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult (RPC::lookupLedger (context.params_, lpLedger, context.netOps_));
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
auto& params = context.params_;
|
||||
|
||||
if (! context.params_.isMember ("account") && ! context.params_.isMember ("ident"))
|
||||
// Get the current ledger
|
||||
Ledger::pointer ledger;
|
||||
Json::Value result (RPC::lookupLedger (params, ledger, context.netOps_));
|
||||
|
||||
if (!ledger)
|
||||
return result;
|
||||
|
||||
if (!(params.isMember ("account") || params.isMember ("ident")))
|
||||
return RPC::missing_field_error ("account");
|
||||
|
||||
std::string const strIdent (context.params_.isMember ("account")
|
||||
? context.params_["account"].asString ()
|
||||
: context.params_["ident"].asString ());
|
||||
std::string const strIdent (params.isMember ("account")
|
||||
? params["account"].asString ()
|
||||
: params["ident"].asString ());
|
||||
|
||||
int const iIndex (context.params_.isMember ("account_index")
|
||||
? context.params_["account_index"].asUInt ()
|
||||
int const iIndex (params.isMember ("account_index")
|
||||
? params["account_index"].asUInt ()
|
||||
: 0);
|
||||
bool const bStrict (context.params_.isMember ("strict") && context.params_["strict"].asBool ());
|
||||
bool const bStrict = params.isMember ("strict") &&
|
||||
params["strict"].asBool ();
|
||||
|
||||
// Get info on account.
|
||||
bool bIndex; // out param
|
||||
RippleAddress naAccount; // out param
|
||||
Json::Value jvAccepted (RPC::accountFromString (
|
||||
lpLedger, naAccount, bIndex, strIdent, iIndex, bStrict, context.netOps_));
|
||||
ledger, naAccount, bIndex, strIdent, iIndex, bStrict, context.netOps_));
|
||||
|
||||
if (!jvAccepted.empty ())
|
||||
return jvAccepted;
|
||||
|
||||
std::set<Currency> send, receive;
|
||||
AccountItems rippleLines (
|
||||
naAccount.getAccountID (), lpLedger,
|
||||
naAccount.getAccountID (), ledger,
|
||||
AccountItem::pointer (new RippleState ()));
|
||||
for (auto item: rippleLines.getItems ())
|
||||
{
|
||||
@@ -64,22 +67,20 @@ Json::Value doAccountCurrencies (RPC::Context& context)
|
||||
send.insert (saBalance.getCurrency ());
|
||||
}
|
||||
|
||||
|
||||
send.erase (badCurrency());
|
||||
receive.erase (badCurrency());
|
||||
|
||||
Json::Value& sendCurrencies =
|
||||
(jvResult["send_currencies"] = Json::arrayValue);
|
||||
(result["send_currencies"] = Json::arrayValue);
|
||||
for (auto const& c: send)
|
||||
sendCurrencies.append (to_string (c));
|
||||
|
||||
Json::Value& recvCurrencies =
|
||||
(jvResult["receive_currencies"] = Json::arrayValue);
|
||||
(result["receive_currencies"] = Json::arrayValue);
|
||||
for (auto const& c: receive)
|
||||
recvCurrencies.append (to_string (c));
|
||||
|
||||
|
||||
return jvResult;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -28,45 +28,47 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doAccountInfo (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
auto& params = context.params_;
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
Ledger::pointer ledger;
|
||||
Json::Value result = RPC::lookupLedger (params, ledger, context.netOps_);
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
if (!ledger)
|
||||
return result;
|
||||
|
||||
if (!context.params_.isMember ("account") && !context.params_.isMember ("ident"))
|
||||
if (!params.isMember ("account") && !params.isMember ("ident"))
|
||||
return RPC::missing_field_error ("account");
|
||||
|
||||
std::string strIdent = context.params_.isMember ("account") ? context.params_["account"].asString () : context.params_["ident"].asString ();
|
||||
bool bIndex;
|
||||
int iIndex = context.params_.isMember ("account_index") ? context.params_["account_index"].asUInt () : 0;
|
||||
bool bStrict = context.params_.isMember ("strict") && context.params_["strict"].asBool ();
|
||||
RippleAddress naAccount;
|
||||
std::string strIdent = params.isMember ("account")
|
||||
? params["account"].asString () : params["ident"].asString ();
|
||||
bool bIndex;
|
||||
int iIndex = params.isMember ("account_index")
|
||||
? params["account_index"].asUInt () : 0;
|
||||
bool bStrict = params.isMember ("strict") && params["strict"].asBool ();
|
||||
RippleAddress naAccount;
|
||||
|
||||
// Get info on account.
|
||||
|
||||
Json::Value jvAccepted = RPC::accountFromString (lpLedger, naAccount, bIndex, strIdent, iIndex, bStrict, context.netOps_);
|
||||
Json::Value jvAccepted = RPC::accountFromString (
|
||||
ledger, naAccount, bIndex, strIdent, iIndex, bStrict, context.netOps_);
|
||||
|
||||
if (!jvAccepted.empty ())
|
||||
return jvAccepted;
|
||||
|
||||
AccountState::pointer asAccepted = context.netOps_.getAccountState (lpLedger, naAccount);
|
||||
auto asAccepted = context.netOps_.getAccountState (ledger, naAccount);
|
||||
|
||||
if (asAccepted)
|
||||
{
|
||||
asAccepted->addJson (jvAccepted);
|
||||
|
||||
jvResult["account_data"] = jvAccepted;
|
||||
result["account_data"] = jvAccepted;
|
||||
}
|
||||
else
|
||||
{
|
||||
jvResult["account"] = naAccount.humanAccountID ();
|
||||
jvResult = rpcError (rpcACT_NOT_FOUND, jvResult);
|
||||
result["account"] = naAccount.humanAccountID ();
|
||||
result = rpcError (rpcACT_NOT_FOUND, result);
|
||||
}
|
||||
|
||||
return jvResult;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -28,60 +28,66 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doAccountLines (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
auto& params = context.params_;
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
Ledger::pointer ledger;
|
||||
Json::Value result = RPC::lookupLedger (params, ledger, context.netOps_);
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
if (!ledger)
|
||||
return result;
|
||||
|
||||
if (!context.params_.isMember (jss::account))
|
||||
if (!params.isMember (jss::account))
|
||||
return RPC::missing_field_error ("account");
|
||||
|
||||
std::string strIdent = context.params_[jss::account].asString ();
|
||||
bool bIndex = context.params_.isMember (jss::account_index);
|
||||
int iIndex = bIndex ? context.params_[jss::account_index].asUInt () : 0;
|
||||
std::string strIdent = params[jss::account].asString ();
|
||||
bool bIndex = params.isMember (jss::account_index);
|
||||
int iIndex = bIndex ? params[jss::account_index].asUInt () : 0;
|
||||
|
||||
RippleAddress raAccount;
|
||||
|
||||
jvResult = RPC::accountFromString (lpLedger, raAccount, bIndex, strIdent, iIndex, false, context.netOps_);
|
||||
result = RPC::accountFromString (
|
||||
ledger, raAccount, bIndex, strIdent, iIndex, false, context.netOps_);
|
||||
|
||||
if (!jvResult.empty ())
|
||||
return jvResult;
|
||||
if (!result.empty ())
|
||||
return result;
|
||||
|
||||
std::string strPeer = context.params_.isMember (jss::peer) ? context.params_[jss::peer].asString () : "";
|
||||
bool bPeerIndex = context.params_.isMember (jss::peer_index);
|
||||
int iPeerIndex = bIndex ? context.params_[jss::peer_index].asUInt () : 0;
|
||||
std::string strPeer = params.isMember (jss::peer)
|
||||
? params[jss::peer].asString () : "";
|
||||
bool bPeerIndex = params.isMember (jss::peer_index);
|
||||
int iPeerIndex = bIndex ? params[jss::peer_index].asUInt () : 0;
|
||||
|
||||
RippleAddress raPeer;
|
||||
|
||||
if (!strPeer.empty ())
|
||||
{
|
||||
jvResult[jss::peer] = raAccount.humanAccountID ();
|
||||
result[jss::peer] = raAccount.humanAccountID ();
|
||||
|
||||
if (bPeerIndex)
|
||||
jvResult[jss::peer_index] = iPeerIndex;
|
||||
result[jss::peer_index] = iPeerIndex;
|
||||
|
||||
jvResult = RPC::accountFromString (lpLedger, raPeer, bPeerIndex, strPeer, iPeerIndex, false, context.netOps_);
|
||||
result = RPC::accountFromString (
|
||||
ledger, raPeer, bPeerIndex, strPeer, iPeerIndex, false,
|
||||
context.netOps_);
|
||||
|
||||
if (!jvResult.empty ())
|
||||
return jvResult;
|
||||
if (!result.empty ())
|
||||
return result;
|
||||
}
|
||||
|
||||
if (lpLedger->hasAccount (raAccount))
|
||||
if (ledger->hasAccount (raAccount))
|
||||
{
|
||||
AccountItems rippleLines (raAccount.getAccountID (), lpLedger, AccountItem::pointer (new RippleState ()));
|
||||
AccountItems rippleLines (raAccount.getAccountID (), ledger,
|
||||
AccountItem::pointer (new RippleState ()));
|
||||
|
||||
jvResult[jss::account] = raAccount.humanAccountID ();
|
||||
Json::Value& jsonLines = (jvResult[jss::lines] = Json::arrayValue);
|
||||
result[jss::account] = raAccount.humanAccountID ();
|
||||
Json::Value& jsonLines = (result[jss::lines] = Json::arrayValue);
|
||||
|
||||
|
||||
BOOST_FOREACH (AccountItem::ref item, rippleLines.getItems ())
|
||||
for (auto& item: rippleLines.getItems ())
|
||||
{
|
||||
RippleState* line = (RippleState*)item.get ();
|
||||
|
||||
if (!raPeer.isValid () || raPeer.getAccountID () == line->getAccountIDPeer ())
|
||||
if (!raPeer.isValid () ||
|
||||
raPeer.getAccountID () == line->getAccountIDPeer ())
|
||||
{
|
||||
const STAmount& saBalance = line->getBalance ();
|
||||
const STAmount& saLimit = line->getLimit ();
|
||||
@@ -90,14 +96,19 @@ Json::Value doAccountLines (RPC::Context& context)
|
||||
Json::Value& jPeer = jsonLines.append (Json::objectValue);
|
||||
|
||||
jPeer[jss::account] = to_string (line->getAccountIDPeer ());
|
||||
// Amount reported is positive if current account holds other account's IOUs.
|
||||
// Amount reported is negative if other account holds current account's IOUs.
|
||||
// Amount reported is positive if current account holds other
|
||||
// account's IOUs.
|
||||
//
|
||||
// Amount reported is negative if other account holds current
|
||||
// account's IOUs.
|
||||
jPeer[jss::balance] = saBalance.getText ();
|
||||
jPeer[jss::currency] = saBalance.getHumanCurrency ();
|
||||
jPeer[jss::limit] = saLimit.getText ();
|
||||
jPeer[jss::limit_peer] = saLimitPeer.getText ();
|
||||
jPeer[jss::quality_in] = static_cast<Json::UInt> (line->getQualityIn ());
|
||||
jPeer[jss::quality_out] = static_cast<Json::UInt> (line->getQualityOut ());
|
||||
jPeer[jss::quality_in]
|
||||
= static_cast<Json::UInt> (line->getQualityIn ());
|
||||
jPeer[jss::quality_out]
|
||||
= static_cast<Json::UInt> (line->getQualityOut ());
|
||||
if (line->getAuth())
|
||||
jPeer[jss::authorized] = true;
|
||||
if (line->getAuthPeer())
|
||||
@@ -117,10 +128,10 @@ Json::Value doAccountLines (RPC::Context& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
jvResult = rpcError (rpcACT_NOT_FOUND);
|
||||
result = rpcError (rpcACT_NOT_FOUND);
|
||||
}
|
||||
|
||||
return jvResult;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -40,46 +40,46 @@ static void offerAdder (Json::Value& jvLines, SLE::ref offer)
|
||||
// }
|
||||
Json::Value doAccountOffers (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
Ledger::pointer ledger;
|
||||
Json::Value result
|
||||
= RPC::lookupLedger (context.params_, ledger, context.netOps_);
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
if (!ledger)
|
||||
return result;
|
||||
|
||||
if (!context.params_.isMember (jss::account))
|
||||
return RPC::missing_field_error ("account");
|
||||
|
||||
std::string strIdent = context.params_[jss::account].asString ();
|
||||
bool bIndex = context.params_.isMember (jss::account_index);
|
||||
int iIndex = bIndex ? context.params_[jss::account_index].asUInt () : 0;
|
||||
std::string strIdent = context.params_[jss::account].asString ();
|
||||
bool bIndex = context.params_.isMember (jss::account_index);
|
||||
int iIndex = bIndex ? context.params_[jss::account_index].asUInt () : 0;
|
||||
|
||||
RippleAddress raAccount;
|
||||
|
||||
jvResult = RPC::accountFromString (lpLedger, raAccount, bIndex, strIdent, iIndex, false, context.netOps_);
|
||||
result = RPC::accountFromString (
|
||||
ledger, raAccount, bIndex, strIdent, iIndex, false, context.netOps_);
|
||||
|
||||
if (!jvResult.empty ())
|
||||
return jvResult;
|
||||
if (!result.empty ())
|
||||
return result;
|
||||
|
||||
// Get info on account.
|
||||
|
||||
jvResult[jss::account] = raAccount.humanAccountID ();
|
||||
result[jss::account] = raAccount.humanAccountID ();
|
||||
|
||||
if (bIndex)
|
||||
jvResult[jss::account_index] = iIndex;
|
||||
result[jss::account_index] = iIndex;
|
||||
|
||||
if (!lpLedger->hasAccount (raAccount))
|
||||
if (!ledger->hasAccount (raAccount))
|
||||
return rpcError (rpcACT_NOT_FOUND);
|
||||
|
||||
Json::Value& jvsOffers = (jvResult[jss::offers] = Json::arrayValue);
|
||||
lpLedger->visitAccountItems (raAccount.getAccountID (),
|
||||
std::bind (&offerAdder, std::ref (jvsOffers),
|
||||
std::placeholders::_1));
|
||||
Json::Value& jvsOffers = (result[jss::offers] = Json::arrayValue);
|
||||
ledger->visitAccountItems (raAccount.getAccountID (),
|
||||
std::bind (&offerAdder, std::ref (jvsOffers),
|
||||
std::placeholders::_1));
|
||||
|
||||
context.loadType_ = Resource::feeMediumBurdenRPC;
|
||||
|
||||
return jvResult;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -31,17 +31,19 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doAccountTx (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
auto& params = context.params_;
|
||||
|
||||
RippleAddress raAccount;
|
||||
int limit = context.params_.isMember (jss::limit) ? context.params_[jss::limit].asUInt () : -1;
|
||||
bool bBinary = context.params_.isMember ("binary") && context.params_["binary"].asBool ();
|
||||
bool bForward = context.params_.isMember ("forward") && context.params_["forward"].asBool ();
|
||||
int limit = params.isMember (jss::limit) ?
|
||||
params[jss::limit].asUInt () : -1;
|
||||
bool bBinary = params.isMember ("binary") && params["binary"].asBool ();
|
||||
bool bForward = params.isMember ("forward") && params["forward"].asBool ();
|
||||
std::uint32_t uLedgerMin;
|
||||
std::uint32_t uLedgerMax;
|
||||
std::uint32_t uValidatedMin;
|
||||
std::uint32_t uValidatedMax;
|
||||
bool bValidated = context.netOps_.getValidatedRange (uValidatedMin, uValidatedMax);
|
||||
bool bValidated = context.netOps_.getValidatedRange (
|
||||
uValidatedMin, uValidatedMax);
|
||||
|
||||
if (!bValidated)
|
||||
{
|
||||
@@ -49,32 +51,32 @@ Json::Value doAccountTx (RPC::Context& context)
|
||||
return rpcError (rpcLGR_IDXS_INVALID);
|
||||
}
|
||||
|
||||
if (!context.params_.isMember ("account"))
|
||||
if (!params.isMember ("account"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
|
||||
if (!raAccount.setAccountID (context.params_["account"].asString ()))
|
||||
if (!raAccount.setAccountID (params["account"].asString ()))
|
||||
return rpcError (rpcACT_MALFORMED);
|
||||
|
||||
context.loadType_ = Resource::feeMediumBurdenRPC;
|
||||
|
||||
if (context.params_.isMember ("ledger_index_min") || context.params_.isMember ("ledger_index_max"))
|
||||
if (params.isMember ("ledger_index_min") ||
|
||||
params.isMember ("ledger_index_max"))
|
||||
{
|
||||
std::int64_t iLedgerMin = context.params_.isMember ("ledger_index_min") ? context.params_["ledger_index_min"].asInt () : -1;
|
||||
std::int64_t iLedgerMax = context.params_.isMember ("ledger_index_max") ? context.params_["ledger_index_max"].asInt () : -1;
|
||||
|
||||
std::int64_t iLedgerMin = params.isMember ("ledger_index_min")
|
||||
? params["ledger_index_min"].asInt () : -1;
|
||||
std::int64_t iLedgerMax = params.isMember ("ledger_index_max")
|
||||
? params["ledger_index_max"].asInt () : -1;
|
||||
|
||||
uLedgerMin = iLedgerMin == -1 ? uValidatedMin : iLedgerMin;
|
||||
uLedgerMax = iLedgerMax == -1 ? uValidatedMax : iLedgerMax;
|
||||
|
||||
if (uLedgerMax < uLedgerMin)
|
||||
{
|
||||
return rpcError (rpcLGR_IDXS_INVALID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Ledger::pointer l;
|
||||
Json::Value ret = RPC::lookupLedger (context.params_, l, context.netOps_);
|
||||
Json::Value ret = RPC::lookupLedger (params, l, context.netOps_);
|
||||
|
||||
if (!l)
|
||||
return ret;
|
||||
@@ -84,10 +86,8 @@ Json::Value doAccountTx (RPC::Context& context)
|
||||
|
||||
Json::Value resumeToken;
|
||||
|
||||
if (context.params_.isMember(jss::marker))
|
||||
{
|
||||
resumeToken = context.params_[jss::marker];
|
||||
}
|
||||
if (params.isMember(jss::marker))
|
||||
resumeToken = params[jss::marker];
|
||||
|
||||
#ifndef BEAST_DEBUG
|
||||
|
||||
@@ -101,40 +101,47 @@ Json::Value doAccountTx (RPC::Context& context)
|
||||
|
||||
if (bBinary)
|
||||
{
|
||||
std::vector<NetworkOPs::txnMetaLedgerType> txns =
|
||||
context.netOps_.getTxsAccountB (raAccount, uLedgerMin, uLedgerMax, bForward, resumeToken, limit, context.role_ == Config::ADMIN);
|
||||
auto txns = context.netOps_.getTxsAccountB (
|
||||
raAccount, uLedgerMin, uLedgerMax, bForward, resumeToken, limit,
|
||||
context.role_ == Config::ADMIN);
|
||||
|
||||
for (std::vector<NetworkOPs::txnMetaLedgerType>::const_iterator it = txns.begin (), end = txns.end ();
|
||||
it != end; ++it)
|
||||
for (auto& it: txns)
|
||||
{
|
||||
Json::Value& jvObj = jvTxns.append (Json::objectValue);
|
||||
|
||||
std::uint32_t uLedgerIndex = std::get<2> (*it);
|
||||
jvObj["tx_blob"] = std::get<0> (*it);
|
||||
jvObj["meta"] = std::get<1> (*it);
|
||||
jvObj["ledger_index"] = uLedgerIndex;
|
||||
jvObj[jss::validated] = bValidated && uValidatedMin <= uLedgerIndex && uValidatedMax >= uLedgerIndex;
|
||||
std::uint32_t uLedgerIndex = std::get<2> (it);
|
||||
jvObj["tx_blob"] = std::get<0> (it);
|
||||
jvObj["meta"] = std::get<1> (it);
|
||||
jvObj["ledger_index"] = uLedgerIndex;
|
||||
jvObj[jss::validated]
|
||||
= bValidated
|
||||
&& uValidatedMin <= uLedgerIndex
|
||||
&& uValidatedMax >= uLedgerIndex;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > txns =
|
||||
context.netOps_.getTxsAccount (raAccount, uLedgerMin, uLedgerMax, bForward, resumeToken, limit, context.role_ == Config::ADMIN);
|
||||
auto txns = context.netOps_.getTxsAccount (
|
||||
raAccount, uLedgerMin, uLedgerMax, bForward, resumeToken, limit,
|
||||
context.role_ == Config::ADMIN);
|
||||
|
||||
for (std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >::iterator it = txns.begin (), end = txns.end (); it != end; ++it)
|
||||
for (auto& it: txns)
|
||||
{
|
||||
Json::Value& jvObj = jvTxns.append (Json::objectValue);
|
||||
Json::Value& jvObj = jvTxns.append (Json::objectValue);
|
||||
|
||||
if (it->first)
|
||||
jvObj[jss::tx] = it->first->getJson (1);
|
||||
if (it.first)
|
||||
jvObj[jss::tx] = it.first->getJson (1);
|
||||
|
||||
if (it->second)
|
||||
if (it.second)
|
||||
{
|
||||
std::uint32_t uLedgerIndex = it->second->getLgrSeq ();
|
||||
std::uint32_t uLedgerIndex = it.second->getLgrSeq ();
|
||||
|
||||
jvObj[jss::meta] = it->second->getJson (0);
|
||||
jvObj[jss::validated] = bValidated && uValidatedMin <= uLedgerIndex && uValidatedMax >= uLedgerIndex;
|
||||
jvObj[jss::meta] = it.second->getJson (0);
|
||||
jvObj[jss::validated]
|
||||
= bValidated
|
||||
&& uValidatedMin <= uLedgerIndex
|
||||
&& uValidatedMax >= uLedgerIndex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -143,7 +150,7 @@ Json::Value doAccountTx (RPC::Context& context)
|
||||
//Add information about the original query
|
||||
ret[jss::ledger_index_min] = uLedgerMin;
|
||||
ret[jss::ledger_index_max] = uLedgerMax;
|
||||
if (context.params_.isMember (jss::limit))
|
||||
if (params.isMember (jss::limit))
|
||||
ret[jss::limit] = limit;
|
||||
if (!resumeToken.isNull())
|
||||
ret[jss::marker] = resumeToken;
|
||||
|
||||
@@ -32,19 +32,24 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doAccountTxOld (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
RippleAddress raAccount;
|
||||
std::uint32_t offset = context.params_.isMember ("offset") ? context.params_["offset"].asUInt () : 0;
|
||||
int limit = context.params_.isMember ("limit") ? context.params_["limit"].asUInt () : -1;
|
||||
bool bBinary = context.params_.isMember ("binary") && context.params_["binary"].asBool ();
|
||||
bool bDescending = context.params_.isMember ("descending") && context.params_["descending"].asBool ();
|
||||
bool bCount = context.params_.isMember ("count") && context.params_["count"].asBool ();
|
||||
std::uint32_t offset
|
||||
= context.params_.isMember ("offset")
|
||||
? context.params_["offset"].asUInt () : 0;
|
||||
int limit = context.params_.isMember ("limit")
|
||||
? context.params_["limit"].asUInt () : -1;
|
||||
bool bBinary = context.params_.isMember ("binary")
|
||||
&& context.params_["binary"].asBool ();
|
||||
bool bDescending = context.params_.isMember ("descending")
|
||||
&& context.params_["descending"].asBool ();
|
||||
bool bCount = context.params_.isMember ("count")
|
||||
&& context.params_["count"].asBool ();
|
||||
std::uint32_t uLedgerMin;
|
||||
std::uint32_t uLedgerMax;
|
||||
std::uint32_t uValidatedMin;
|
||||
std::uint32_t uValidatedMax;
|
||||
bool bValidated = context.netOps_.getValidatedRange (uValidatedMin, uValidatedMax);
|
||||
bool bValidated = context.netOps_.getValidatedRange (
|
||||
uValidatedMin, uValidatedMax);
|
||||
|
||||
if (!context.params_.isMember ("account"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -71,10 +76,13 @@ Json::Value doAccountTxOld (RPC::Context& context)
|
||||
bDescending = true;
|
||||
}
|
||||
|
||||
if (context.params_.isMember ("ledger_index_min") || context.params_.isMember ("ledger_index_max"))
|
||||
if (context.params_.isMember ("ledger_index_min")
|
||||
|| context.params_.isMember ("ledger_index_max"))
|
||||
{
|
||||
std::int64_t iLedgerMin = context.params_.isMember ("ledger_index_min") ? context.params_["ledger_index_min"].asInt () : -1;
|
||||
std::int64_t iLedgerMax = context.params_.isMember ("ledger_index_max") ? context.params_["ledger_index_max"].asInt () : -1;
|
||||
std::int64_t iLedgerMin = context.params_.isMember ("ledger_index_min")
|
||||
? context.params_["ledger_index_min"].asInt () : -1;
|
||||
std::int64_t iLedgerMax = context.params_.isMember ("ledger_index_max")
|
||||
? context.params_["ledger_index_max"].asInt () : -1;
|
||||
|
||||
if (!bValidated && (iLedgerMin == -1 || iLedgerMax == -1))
|
||||
{
|
||||
@@ -116,11 +124,11 @@ Json::Value doAccountTxOld (RPC::Context& context)
|
||||
|
||||
if (bBinary)
|
||||
{
|
||||
std::vector<NetworkOPs::txnMetaLedgerType> txns =
|
||||
context.netOps_.getAccountTxsB (raAccount, uLedgerMin, uLedgerMax, bDescending, offset, limit, context.role_ == Config::ADMIN);
|
||||
auto txns = context.netOps_.getAccountTxsB (
|
||||
raAccount, uLedgerMin, uLedgerMax, bDescending, offset, limit,
|
||||
context.role_ == Config::ADMIN);
|
||||
|
||||
for (std::vector<NetworkOPs::txnMetaLedgerType>::const_iterator it = txns.begin (), end = txns.end ();
|
||||
it != end; ++it)
|
||||
for (auto it = txns.begin (), end = txns.end (); it != end; ++it)
|
||||
{
|
||||
++count;
|
||||
Json::Value& jvObj = jvTxns.append (Json::objectValue);
|
||||
@@ -129,15 +137,20 @@ Json::Value doAccountTxOld (RPC::Context& context)
|
||||
jvObj["tx_blob"] = std::get<0> (*it);
|
||||
jvObj["meta"] = std::get<1> (*it);
|
||||
jvObj["ledger_index"] = uLedgerIndex;
|
||||
jvObj["validated"] = bValidated && uValidatedMin <= uLedgerIndex && uValidatedMax >= uLedgerIndex;
|
||||
jvObj["validated"]
|
||||
= bValidated
|
||||
&& uValidatedMin <= uLedgerIndex
|
||||
&& uValidatedMax >= uLedgerIndex;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > txns = context.netOps_.getAccountTxs (raAccount, uLedgerMin, uLedgerMax, bDescending, offset, limit, context.role_ == Config::ADMIN);
|
||||
auto txns = context.netOps_.getAccountTxs (
|
||||
raAccount, uLedgerMin, uLedgerMax, bDescending, offset, limit,
|
||||
context.role_ == Config::ADMIN);
|
||||
|
||||
for (std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >::iterator it = txns.begin (), end = txns.end (); it != end; ++it)
|
||||
for (auto it = txns.begin (), end = txns.end (); it != end; ++it)
|
||||
{
|
||||
++count;
|
||||
Json::Value& jvObj = jvTxns.append (Json::objectValue);
|
||||
@@ -150,7 +163,10 @@ Json::Value doAccountTxOld (RPC::Context& context)
|
||||
std::uint32_t uLedgerIndex = it->second->getLgrSeq ();
|
||||
|
||||
jvObj["meta"] = it->second->getJson (0);
|
||||
jvObj["validated"] = bValidated && uValidatedMin <= uLedgerIndex && uValidatedMax >= uLedgerIndex;
|
||||
jvObj["validated"]
|
||||
= bValidated
|
||||
&& uValidatedMin <= uLedgerIndex
|
||||
&& uValidatedMax >= uLedgerIndex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -159,11 +175,15 @@ Json::Value doAccountTxOld (RPC::Context& context)
|
||||
//Add information about the original query
|
||||
ret["ledger_index_min"] = uLedgerMin;
|
||||
ret["ledger_index_max"] = uLedgerMax;
|
||||
ret["validated"] = bValidated && uValidatedMin <= uLedgerMin && uValidatedMax >= uLedgerMax;
|
||||
ret["validated"]
|
||||
= bValidated
|
||||
&& uValidatedMin <= uLedgerMin
|
||||
&& uValidatedMax >= uLedgerMax;
|
||||
ret["offset"] = offset;
|
||||
|
||||
// We no longer return the full count but only the count of returned transactions
|
||||
// Computing this count was two expensive and this API is deprecated anyway
|
||||
// We no longer return the full count but only the count of returned
|
||||
// transactions. Computing this count was two expensive and this API is
|
||||
// deprecated anyway.
|
||||
if (bCount)
|
||||
ret["count"] = count;
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace ripple {
|
||||
|
||||
Json::Value doBlackList (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock();
|
||||
auto& rm = getApp().getResourceManager();
|
||||
if (context.params_.isMember("threshold"))
|
||||
return getApp().getResourceManager().getJson(context.params_["threshold"].asInt());
|
||||
return rm.getJson(context.params_["threshold"].asInt());
|
||||
else
|
||||
return getApp().getResourceManager().getJson();
|
||||
return rm.getJson();
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -21,8 +21,6 @@ namespace ripple {
|
||||
|
||||
Json::Value doBookOffers (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
// VFALCO TODO Here is a terrible place for this kind of business
|
||||
// logic. It needs to be moved elsewhere and documented,
|
||||
// and encapsulated into a function.
|
||||
@@ -30,7 +28,8 @@ Json::Value doBookOffers (RPC::Context& context)
|
||||
return rpcError (rpcTOO_BUSY);
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult (RPC::lookupLedger (context.params_, lpLedger, context.netOps_));
|
||||
Json::Value jvResult (
|
||||
RPC::lookupLedger (context.params_, lpLedger, context.netOps_));
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
@@ -103,8 +102,9 @@ Json::Value doBookOffers (RPC::Context& context)
|
||||
}
|
||||
|
||||
if (isXRP (pay_currency) && ! isXRP (pay_issuer))
|
||||
return RPC::make_error (rpcSRC_ISR_MALFORMED,
|
||||
"Unneeded field 'taker_pays.issuer' for XRP currency specification.");
|
||||
return RPC::make_error (
|
||||
rpcSRC_ISR_MALFORMED, "Unneeded field 'taker_pays.issuer' for "
|
||||
"XRP currency specification.");
|
||||
|
||||
if (!isXRP (pay_currency) && isXRP (pay_issuer))
|
||||
return RPC::make_error (rpcSRC_ISR_MALFORMED,
|
||||
@@ -134,7 +134,8 @@ Json::Value doBookOffers (RPC::Context& context)
|
||||
|
||||
if (isXRP (get_currency) && ! isXRP (get_issuer))
|
||||
return RPC::make_error (rpcDST_ISR_MALFORMED,
|
||||
"Unneeded field 'taker_gets.issuer' for XRP currency specification.");
|
||||
"Unneeded field 'taker_gets.issuer' for "
|
||||
"XRP currency specification.");
|
||||
|
||||
if (!isXRP (get_currency) && isXRP (get_issuer))
|
||||
return RPC::make_error (rpcDST_ISR_MALFORMED,
|
||||
|
||||
@@ -28,14 +28,18 @@ namespace ripple {
|
||||
// XXX Might allow domain for manual connections.
|
||||
Json::Value doConnect (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
if (getConfig ().RUN_STANDALONE)
|
||||
return "cannot connect in standalone mode";
|
||||
|
||||
if (!context.params_.isMember ("ip"))
|
||||
return RPC::missing_field_error ("ip");
|
||||
|
||||
if (context.params_.isMember ("port") && !context.params_["port"].isConvertibleTo (Json::intValue))
|
||||
if (context.params_.isMember ("port") &&
|
||||
!context.params_["port"].isConvertibleTo (Json::intValue))
|
||||
{
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
}
|
||||
|
||||
int iPort;
|
||||
|
||||
@@ -44,7 +48,8 @@ Json::Value doConnect (RPC::Context& context)
|
||||
else
|
||||
iPort = SYSTEM_PEER_PORT;
|
||||
|
||||
beast::IP::Endpoint ip (beast::IP::Endpoint::from_string(context.params_["ip"].asString ()));
|
||||
auto ip = beast::IP::Endpoint::from_string(
|
||||
context.params_["ip"].asString ());
|
||||
|
||||
if (! is_unspecified (ip))
|
||||
getApp().overlay ().connect (ip.at_port(iPort));
|
||||
|
||||
@@ -23,7 +23,10 @@ Json::Value doConsensusInfo (RPC::Context& context)
|
||||
{
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
ret["info"] = context.netOps_.getConsensusInfo ();
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
ret["info"] = context.netOps_.getConsensusInfo ();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
static void textTime (std::string& text, int& seconds, const char* unitName, int unitVal)
|
||||
static void textTime (
|
||||
std::string& text, int& seconds, const char* unitName, int unitVal)
|
||||
{
|
||||
int i = seconds / unitVal;
|
||||
|
||||
@@ -49,7 +50,9 @@ Json::Value doFeature (RPC::Context& context)
|
||||
return jvReply;
|
||||
}
|
||||
|
||||
uint256 uFeature = getApp().getAmendmentTable ().get(context.params_["feature"].asString());
|
||||
uint256 uFeature
|
||||
= getApp().getAmendmentTable ().get(
|
||||
context.params_["feature"].asString());
|
||||
|
||||
if (uFeature.isZero ())
|
||||
{
|
||||
|
||||
@@ -22,8 +22,6 @@ namespace ripple {
|
||||
|
||||
Json::Value doFetchInfo (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
if (context.params_.isMember("clear") && context.params_["clear"].asBool())
|
||||
|
||||
@@ -26,12 +26,14 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doGetCounts (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
|
||||
int minCount = 10;
|
||||
|
||||
if (context.params_.isMember ("min_count"))
|
||||
minCount = context.params_["min_count"].asUInt ();
|
||||
|
||||
CountedObjects::List objectCounts = CountedObjects::getInstance ().getCounts (minCount);
|
||||
auto objectCounts = CountedObjects::getInstance ().getCounts (minCount);
|
||||
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
|
||||
@@ -27,10 +27,12 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doLedger (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
if (!context.params_.isMember ("ledger") && !context.params_.isMember ("ledger_hash") && !context.params_.isMember ("ledger_index"))
|
||||
if (!context.params_.isMember ("ledger")
|
||||
&& !context.params_.isMember ("ledger_hash")
|
||||
&& !context.params_.isMember ("ledger_index"))
|
||||
{
|
||||
Json::Value ret (Json::objectValue), current (Json::objectValue), closed (Json::objectValue);
|
||||
Json::Value ret (Json::objectValue), current (Json::objectValue),
|
||||
closed (Json::objectValue);
|
||||
|
||||
getApp().getLedgerMaster ().getCurrentLedger ()->addJson (current, 0);
|
||||
getApp().getLedgerMaster ().getClosedLedger ()->addJson (closed, 0);
|
||||
@@ -42,15 +44,20 @@ Json::Value doLedger (RPC::Context& context)
|
||||
}
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
Json::Value jvResult = RPC::lookupLedger (
|
||||
context.params_, lpLedger, context.netOps_);
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
|
||||
bool bFull = context.params_.isMember ("full") && context.params_["full"].asBool ();
|
||||
bool bTransactions = context.params_.isMember ("transactions") && context.params_["transactions"].asBool ();
|
||||
bool bAccounts = context.params_.isMember ("accounts") && context.params_["accounts"].asBool ();
|
||||
bool bExpand = context.params_.isMember ("expand") && context.params_["expand"].asBool ();
|
||||
bool bFull = context.params_.isMember ("full")
|
||||
&& context.params_["full"].asBool ();
|
||||
bool bTransactions = context.params_.isMember ("transactions")
|
||||
&& context.params_["transactions"].asBool ();
|
||||
bool bAccounts = context.params_.isMember ("accounts")
|
||||
&& context.params_["accounts"].asBool ();
|
||||
bool bExpand = context.params_.isMember ("expand")
|
||||
&& context.params_["expand"].asBool ();
|
||||
int iOptions = (bFull ? LEDGER_JSON_FULL : 0)
|
||||
| (bExpand ? LEDGER_JSON_EXPAND : 0)
|
||||
| (bTransactions ? LEDGER_JSON_DUMP_TXRP : 0)
|
||||
@@ -61,12 +68,13 @@ Json::Value doLedger (RPC::Context& context)
|
||||
|
||||
if (context.role_ != Config::ADMIN)
|
||||
{
|
||||
// Until some sane way to get full ledgers has been implemented, disallow
|
||||
// retrieving all state nodes
|
||||
// Until some sane way to get full ledgers has been implemented,
|
||||
// disallow retrieving all state nodes.
|
||||
return rpcError (rpcNO_PERMISSION);
|
||||
}
|
||||
|
||||
if (getApp().getFeeTrack().isLoadedLocal() && (context.role_ != Config::ADMIN))
|
||||
if (getApp().getFeeTrack().isLoadedLocal() &&
|
||||
context.role_ != Config::ADMIN)
|
||||
{
|
||||
WriteLog (lsDEBUG, Peer) << "Too busy to give full ledger";
|
||||
return rpcError(rpcTOO_BUSY);
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace ripple {
|
||||
|
||||
Json::Value doLedgerAccept (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
Json::Value jvResult;
|
||||
|
||||
if (!getConfig ().RUN_STANDALONE)
|
||||
@@ -32,7 +33,8 @@ Json::Value doLedgerAccept (RPC::Context& context)
|
||||
{
|
||||
context.netOps_.acceptLedger ();
|
||||
|
||||
jvResult["ledger_current_index"] = context.netOps_.getCurrentLedgerID ();
|
||||
jvResult["ledger_current_index"]
|
||||
= context.netOps_.getCurrentLedgerID ();
|
||||
}
|
||||
|
||||
return jvResult;
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace ripple {
|
||||
|
||||
Json::Value doLedgerCleaner (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock();
|
||||
getApp().getLedgerMaster().doLedgerCleaner (context.params_);
|
||||
return "Cleaner configured";
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace ripple {
|
||||
|
||||
Json::Value doLedgerClosed (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
Json::Value jvResult;
|
||||
|
||||
uint256 uLedger = context.netOps_.getClosedLedgerHash ();
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace ripple {
|
||||
|
||||
Json::Value doLedgerCurrent (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
Json::Value jvResult;
|
||||
|
||||
jvResult["ledger_current_index"] = context.netOps_.getCurrentLedgerID ();
|
||||
|
||||
@@ -32,14 +32,13 @@ namespace ripple {
|
||||
// marker: resume point, if any
|
||||
Json::Value doLedgerData (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
int const BINARY_PAGE_LENGTH = 256;
|
||||
int const JSON_PAGE_LENGTH = 2048;
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
Json::Value jvResult = RPC::lookupLedger (
|
||||
context.params_, lpLedger, context.netOps_);
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
|
||||
@@ -80,7 +79,7 @@ Json::Value doLedgerData (RPC::Context& context)
|
||||
Json::Value jvReply = Json::objectValue;
|
||||
|
||||
jvReply["ledger_hash"] = to_string (lpLedger->getHash());
|
||||
jvReply["ledger_index"] = beast::lexicalCastThrow <std::string> (lpLedger->getLedgerSeq ());
|
||||
jvReply["ledger_index"] = std::to_string( lpLedger->getLedgerSeq ());
|
||||
|
||||
Json::Value& nodes = (jvReply["state"] = Json::arrayValue);
|
||||
SHAMap& map = *(lpLedger->peekAccountStateMap ());
|
||||
@@ -102,7 +101,8 @@ Json::Value doLedgerData (RPC::Context& context)
|
||||
if (isBinary)
|
||||
{
|
||||
Json::Value& entry = nodes.append (Json::objectValue);
|
||||
entry["data"] = strHex (item->peekData().begin(), item->peekData().size());
|
||||
entry["data"] = strHex (
|
||||
item->peekData().begin(), item->peekData().size());
|
||||
entry["index"] = to_string (item->getTag ());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -27,10 +27,9 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doLedgerEntry (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (
|
||||
context.params_, lpLedger, context.netOps_);
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
@@ -48,14 +47,16 @@ Json::Value doLedgerEntry (RPC::Context& context)
|
||||
{
|
||||
RippleAddress naAccount;
|
||||
|
||||
if (!naAccount.setAccountID (context.params_["account_root"].asString ())
|
||||
|| !naAccount.getAccountID ())
|
||||
if (!naAccount.setAccountID (
|
||||
context.params_["account_root"].asString ())
|
||||
|| !naAccount.getAccountID ())
|
||||
{
|
||||
jvResult["error"] = "malformedAddress";
|
||||
}
|
||||
else
|
||||
{
|
||||
uNodeIndex = Ledger::getAccountRootIndex (naAccount.getAccountID ());
|
||||
uNodeIndex
|
||||
= Ledger::getAccountRootIndex (naAccount.getAccountID ());
|
||||
}
|
||||
}
|
||||
else if (context.params_.isMember ("directory"))
|
||||
@@ -71,9 +72,9 @@ Json::Value doLedgerEntry (RPC::Context& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::uint64_t uSubIndex = context.params_["directory"].isMember ("sub_index")
|
||||
? context.params_["directory"]["sub_index"].asUInt ()
|
||||
: 0;
|
||||
std::uint64_t uSubIndex
|
||||
= context.params_["directory"].isMember ("sub_index")
|
||||
? context.params_["directory"]["sub_index"].asUInt () : 0;
|
||||
|
||||
if (context.params_["directory"].isMember ("dir_root"))
|
||||
{
|
||||
@@ -87,14 +88,16 @@ Json::Value doLedgerEntry (RPC::Context& context)
|
||||
{
|
||||
RippleAddress naOwnerID;
|
||||
|
||||
if (!naOwnerID.setAccountID (context.params_["directory"]["owner"].asString ()))
|
||||
if (!naOwnerID.setAccountID (
|
||||
context.params_["directory"]["owner"].asString ()))
|
||||
{
|
||||
jvResult["error"] = "malformedAddress";
|
||||
}
|
||||
else
|
||||
{
|
||||
uint256 uDirRoot = Ledger::getOwnerDirIndex (naOwnerID.getAccountID ());
|
||||
|
||||
uint256 uDirRoot
|
||||
= Ledger::getOwnerDirIndex (
|
||||
naOwnerID.getAccountID ());
|
||||
uNodeIndex = Ledger::getDirNodeIndex (uDirRoot, uSubIndex);
|
||||
}
|
||||
}
|
||||
@@ -116,14 +119,16 @@ Json::Value doLedgerEntry (RPC::Context& context)
|
||||
{
|
||||
jvResult["error"] = "malformedRequest";
|
||||
}
|
||||
else if (!naGeneratorID.setSeedGeneric (context.params_["generator"]["regular_seed"].asString ()))
|
||||
else if (!naGeneratorID.setSeedGeneric (
|
||||
context.params_["generator"]["regular_seed"].asString ()))
|
||||
{
|
||||
jvResult["error"] = "malformedAddress";
|
||||
}
|
||||
else
|
||||
{
|
||||
RippleAddress na0Public; // To find the generator's index.
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic (naGeneratorID);
|
||||
RippleAddress na0Public; // To find the generator's index.
|
||||
RippleAddress naGenerator
|
||||
= RippleAddress::createGeneratorPublic (naGeneratorID);
|
||||
|
||||
na0Public.setAccountPublic (naGenerator, 0);
|
||||
|
||||
@@ -144,15 +149,16 @@ Json::Value doLedgerEntry (RPC::Context& context)
|
||||
{
|
||||
jvResult["error"] = "malformedRequest";
|
||||
}
|
||||
else if (!naAccountID.setAccountID (context.params_["offer"]["account"].asString ()))
|
||||
else if (!naAccountID.setAccountID (
|
||||
context.params_["offer"]["account"].asString ()))
|
||||
{
|
||||
jvResult["error"] = "malformedAddress";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::uint32_t uSequence = context.params_["offer"]["seq"].asUInt ();
|
||||
|
||||
uNodeIndex = Ledger::getOfferIndex (naAccountID.getAccountID (), uSequence);
|
||||
auto uSequence = context.params_["offer"]["seq"].asUInt ();
|
||||
uNodeIndex = Ledger::getOfferIndex (
|
||||
naAccountID.getAccountID (), uSequence);
|
||||
}
|
||||
}
|
||||
else if (context.params_.isMember ("ripple_state"))
|
||||
@@ -163,19 +169,22 @@ Json::Value doLedgerEntry (RPC::Context& context)
|
||||
Json::Value jvRippleState = context.params_["ripple_state"];
|
||||
|
||||
if (!jvRippleState.isObject ()
|
||||
|| !jvRippleState.isMember ("currency")
|
||||
|| !jvRippleState.isMember ("accounts")
|
||||
|| !jvRippleState["accounts"].isArray ()
|
||||
|| 2 != jvRippleState["accounts"].size ()
|
||||
|| !jvRippleState["accounts"][0u].isString ()
|
||||
|| !jvRippleState["accounts"][1u].isString ()
|
||||
|| jvRippleState["accounts"][0u].asString () == jvRippleState["accounts"][1u].asString ()
|
||||
|| !jvRippleState.isMember ("currency")
|
||||
|| !jvRippleState.isMember ("accounts")
|
||||
|| !jvRippleState["accounts"].isArray ()
|
||||
|| 2 != jvRippleState["accounts"].size ()
|
||||
|| !jvRippleState["accounts"][0u].isString ()
|
||||
|| !jvRippleState["accounts"][1u].isString ()
|
||||
|| (jvRippleState["accounts"][0u].asString ()
|
||||
== jvRippleState["accounts"][1u].asString ())
|
||||
)
|
||||
{
|
||||
jvResult["error"] = "malformedRequest";
|
||||
}
|
||||
else if (!naA.setAccountID (jvRippleState["accounts"][0u].asString ())
|
||||
|| !naB.setAccountID (jvRippleState["accounts"][1u].asString ()))
|
||||
else if (!naA.setAccountID (
|
||||
jvRippleState["accounts"][0u].asString ())
|
||||
|| !naB.setAccountID (
|
||||
jvRippleState["accounts"][1u].asString ()))
|
||||
{
|
||||
jvResult["error"] = "malformedAddress";
|
||||
}
|
||||
@@ -196,7 +205,7 @@ Json::Value doLedgerEntry (RPC::Context& context)
|
||||
|
||||
if (uNodeIndex.isNonZero ())
|
||||
{
|
||||
SLE::pointer sleNode = context.netOps_.getSLEi (lpLedger, uNodeIndex);
|
||||
auto sleNode = context.netOps_.getSLEi (lpLedger, uNodeIndex);
|
||||
|
||||
if (context.params_.isMember("binary"))
|
||||
bNodeBinary = context.params_["binary"].asBool();
|
||||
|
||||
@@ -26,10 +26,9 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doLedgerHeader (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (
|
||||
context.params_, lpLedger, context.netOps_);
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
@@ -40,7 +39,8 @@ Json::Value doLedgerHeader (RPC::Context& context)
|
||||
|
||||
jvResult["ledger_data"] = strHex (s.peekData ());
|
||||
|
||||
// This information isn't verified, they should only use it if they trust us.
|
||||
// This information isn't verified: they should only use it if they trust
|
||||
// us.
|
||||
lpLedger->addJson (jvResult, 0);
|
||||
|
||||
return jvResult;
|
||||
|
||||
@@ -26,8 +26,6 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doLedgerRequest (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
auto const hasHash = context.params_.isMember (jss::ledger_hash);
|
||||
auto const hasIndex = context.params_.isMember (jss::ledger_index);
|
||||
|
||||
@@ -75,8 +73,10 @@ Json::Value doLedgerRequest (RPC::Context& context)
|
||||
{
|
||||
// We don't have the ledger we need to figure out which ledger
|
||||
// they want. Try to get it.
|
||||
Json::Value jvResult = getApp().getInboundLedgers().findCreate (
|
||||
refHash, refIndex, InboundLedger::fcGENERIC)->getJson (0);
|
||||
Json::Value jvResult
|
||||
= getApp().getInboundLedgers().findCreate (
|
||||
refHash, refIndex, InboundLedger::fcGENERIC)
|
||||
->getJson (0);
|
||||
|
||||
jvResult[jss::error] = "ledgerNotFound";
|
||||
return jvResult;
|
||||
|
||||
@@ -29,7 +29,8 @@ Json::Value doLogLevel (RPC::Context& context)
|
||||
Json::Value ret (Json::objectValue);
|
||||
Json::Value lev (Json::objectValue);
|
||||
|
||||
lev["base"] = Logs::toString(Logs::fromSeverity(deprecatedLogs().severity()));
|
||||
lev["base"] =
|
||||
Logs::toString(Logs::fromSeverity(deprecatedLogs().severity()));
|
||||
std::vector< std::pair<std::string, std::string> > logTable (
|
||||
deprecatedLogs().partition_severities());
|
||||
typedef std::map<std::string, std::string>::value_type stringPair;
|
||||
@@ -40,16 +41,18 @@ Json::Value doLogLevel (RPC::Context& context)
|
||||
return ret;
|
||||
}
|
||||
|
||||
LogSeverity const sv (Logs::fromString (context.params_["severity"].asString ()));
|
||||
LogSeverity const sv (
|
||||
Logs::fromString (context.params_["severity"].asString ()));
|
||||
|
||||
if (sv == lsINVALID)
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
|
||||
auto severity = Logs::toSeverity(sv);
|
||||
// log_level severity
|
||||
if (!context.params_.isMember ("partition"))
|
||||
{
|
||||
// set base log severity
|
||||
deprecatedLogs().severity(Logs::toSeverity(sv));
|
||||
deprecatedLogs().severity(severity);
|
||||
return Json::objectValue;
|
||||
}
|
||||
|
||||
@@ -60,9 +63,9 @@ Json::Value doLogLevel (RPC::Context& context)
|
||||
std::string partition (context.params_["partition"].asString ());
|
||||
|
||||
if (boost::iequals (partition, "base"))
|
||||
deprecatedLogs().severity (Logs::toSeverity(sv));
|
||||
deprecatedLogs().severity (severity);
|
||||
else
|
||||
deprecatedLogs().get(partition).severity(Logs::toSeverity(sv));
|
||||
deprecatedLogs().get(partition).severity(severity);
|
||||
|
||||
return Json::objectValue;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace ripple {
|
||||
|
||||
Json::Value doLogRotate (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
return deprecatedLogs().rotate();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
namespace ripple {
|
||||
|
||||
#if 0
|
||||
// XXX Needs to be revised for new paradigm
|
||||
// nickname_info <nickname>
|
||||
// Note: Nicknames are not automatically looked up by commands as they are advisory and can be changed.
|
||||
// XXX Needs to be revised for new paradigm nickname_info <nickname> Note:
|
||||
// Nicknames are not automatically looked up by commands as they are advisory
|
||||
// and can be changed.
|
||||
Json::Value doNicknameInfo (Json::Value params)
|
||||
{
|
||||
std::string strNickname = context.params_[0u].asString ();
|
||||
@@ -34,7 +34,7 @@ Json::Value doNicknameInfo (Json::Value params)
|
||||
return rpcError (rpcNICKNAME_MALFORMED);
|
||||
}
|
||||
|
||||
NicknameState::pointer nsSrc = context.netOps_.getNicknameState (uint256 (0), strNickname);
|
||||
auto nsSrc = context.netOps_.getNicknameState (uint256 (0), strNickname);
|
||||
|
||||
if (!nsSrc)
|
||||
{
|
||||
|
||||
@@ -27,25 +27,36 @@ namespace ripple {
|
||||
// XXX This would be better if it took the ledger.
|
||||
Json::Value doOwnerInfo (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
if (!context.params_.isMember ("account") && !context.params_.isMember ("ident"))
|
||||
return RPC::missing_field_error ("account");
|
||||
|
||||
std::string strIdent = context.params_.isMember ("account") ? context.params_["account"].asString () : context.params_["ident"].asString ();
|
||||
bool bIndex;
|
||||
int iIndex = context.params_.isMember ("account_index") ? context.params_["account_index"].asUInt () : 0;
|
||||
RippleAddress raAccount;
|
||||
std::string strIdent = context.params_.isMember ("account")
|
||||
? context.params_["account"].asString ()
|
||||
: context.params_["ident"].asString ();
|
||||
bool bIndex;
|
||||
int iIndex = context.params_.isMember ("account_index")
|
||||
? context.params_["account_index"].asUInt () : 0;
|
||||
RippleAddress raAccount;
|
||||
|
||||
Json::Value ret;
|
||||
Json::Value ret;
|
||||
|
||||
// Get info on account.
|
||||
|
||||
Json::Value jAccepted = RPC::accountFromString (context.netOps_.getClosedLedger (), raAccount, bIndex, strIdent, iIndex, false, context.netOps_);
|
||||
Json::Value jAccepted = RPC::accountFromString (
|
||||
context.netOps_.getClosedLedger (), raAccount, bIndex, strIdent, iIndex,
|
||||
false, context.netOps_);
|
||||
|
||||
ret["accepted"] = jAccepted.empty () ? context.netOps_.getOwnerInfo (context.netOps_.getClosedLedger (), raAccount) : jAccepted;
|
||||
ret["accepted"] = jAccepted.empty ()
|
||||
? context.netOps_.getOwnerInfo (
|
||||
context.netOps_.getClosedLedger (), raAccount) : jAccepted;
|
||||
|
||||
Json::Value jCurrent = RPC::accountFromString (context.netOps_.getCurrentLedger (), raAccount, bIndex, strIdent, iIndex, false, context.netOps_);
|
||||
Json::Value jCurrent = RPC::accountFromString (
|
||||
context.netOps_.getCurrentLedger (), raAccount, bIndex, strIdent, iIndex,
|
||||
false, context.netOps_);
|
||||
|
||||
ret["current"] = jCurrent.empty () ? context.netOps_.getOwnerInfo (context.netOps_.getCurrentLedger (), raAccount) : jCurrent;
|
||||
ret["current"] = jCurrent.empty () ? context.netOps_.getOwnerInfo (
|
||||
context.netOps_.getCurrentLedger (), raAccount) : jCurrent;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,12 @@ namespace ripple {
|
||||
Json::Value doPathFind (RPC::Context& context)
|
||||
{
|
||||
Ledger::pointer lpLedger = context.netOps_.getClosedLedger();
|
||||
context.lock_.unlock();
|
||||
|
||||
if (!context.params_.isMember ("subcommand") || !context.params_["subcommand"].isString ())
|
||||
if (!context.params_.isMember ("subcommand") ||
|
||||
!context.params_["subcommand"].isString ())
|
||||
{
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
}
|
||||
|
||||
if (!context.infoSub_)
|
||||
return rpcError (rpcNO_EVENTS);
|
||||
@@ -37,7 +39,8 @@ Json::Value doPathFind (RPC::Context& context)
|
||||
{
|
||||
context.loadType_ = Resource::feeHighBurdenRPC;
|
||||
context.infoSub_->clearPathRequest ();
|
||||
return getApp().getPathRequests().makePathRequest (context.infoSub_, lpLedger, context.params_);
|
||||
return getApp().getPathRequests().makePathRequest (
|
||||
context.infoSub_, lpLedger, context.params_);
|
||||
}
|
||||
|
||||
if (sSubCommand == "close")
|
||||
|
||||
@@ -23,11 +23,15 @@ namespace ripple {
|
||||
|
||||
Json::Value doPeers (RPC::Context& context)
|
||||
{
|
||||
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
|
||||
jvResult["peers"] = getApp().overlay ().json ();
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
|
||||
getApp().getUNL().addClusterStatus(jvResult);
|
||||
jvResult["peers"] = getApp().overlay ().json ();
|
||||
getApp().getUNL().addClusterStatus(jvResult);
|
||||
}
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
@@ -22,13 +22,17 @@ namespace ripple {
|
||||
|
||||
Json::Value doPrint (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
JsonPropertyStream stream;
|
||||
if (context.params_.isObject() && context.params_["params"].isArray() && context.params_["params"][0u].isString ())
|
||||
if (context.params_.isObject()
|
||||
&& context.params_["params"].isArray()
|
||||
&& context.params_["params"][0u].isString ())
|
||||
{
|
||||
getApp().write (stream, context.params_["params"][0u].asString());
|
||||
}
|
||||
else
|
||||
{
|
||||
getApp().write (stream);
|
||||
}
|
||||
|
||||
return stream.top();
|
||||
}
|
||||
|
||||
@@ -20,11 +20,18 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// profile offers <pass_a> <account_a> <currency_offer_a> <account_b> <currency_offer_b> <count> [submit]
|
||||
// profile 0:offers 1:pass_a 2:account_a 3:currency_offer_a 4:account_b 5:currency_offer_b 6:<count> 7:[submit]
|
||||
// profile offers <pass_a> <account_a> <currency_offer_a> <account_b>
|
||||
// <currency_offer_b> <count> [submit]
|
||||
//
|
||||
// profile 0:offers 1:pass_a 2:account_a 3:currency_offer_a 4:account_b
|
||||
// 5:currency_offer_b 6:<count> 7:[submit]
|
||||
//
|
||||
// issuer is the offering account
|
||||
//
|
||||
// --> submit: 'submit|true|false': defaults to false
|
||||
// Prior to running allow each to have a credit line of what they will be getting from the other account.
|
||||
//
|
||||
// Prior to running allow each to have a credit line of what they will be
|
||||
// getting from the other account.
|
||||
Json::Value doProfile (RPC::Context& context)
|
||||
{
|
||||
/* need to fix now that sharedOfferCreate is gone
|
||||
|
||||
@@ -28,15 +28,14 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doProofCreate (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
// XXX: Add ability to create proof with arbitrary time
|
||||
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
|
||||
if (context.params_.isMember ("difficulty") || context.params_.isMember ("secret"))
|
||||
if (context.params_.isMember ("difficulty") ||
|
||||
context.params_.isMember ("secret"))
|
||||
{
|
||||
// VFALCO TODO why aren't we using the app's factory?
|
||||
std::unique_ptr <ProofOfWorkFactory> pgGen (ProofOfWorkFactory::New ());
|
||||
auto pgGen = ProofOfWorkFactory::New ();
|
||||
|
||||
if (context.params_.isMember ("difficulty"))
|
||||
{
|
||||
@@ -45,8 +44,11 @@ Json::Value doProofCreate (RPC::Context& context)
|
||||
|
||||
int const iDifficulty (context.params_["difficulty"].asInt ());
|
||||
|
||||
if (iDifficulty < 0 || iDifficulty > ProofOfWorkFactory::kMaxDifficulty)
|
||||
if (iDifficulty < 0 ||
|
||||
iDifficulty > ProofOfWorkFactory::kMaxDifficulty)
|
||||
{
|
||||
return RPC::invalid_field_error ("difficulty");
|
||||
}
|
||||
|
||||
pgGen->setDifficulty (iDifficulty);
|
||||
}
|
||||
@@ -62,7 +64,8 @@ Json::Value doProofCreate (RPC::Context& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
jvResult["token"] = getApp().getProofOfWorkFactory ().getProof ().getToken ();
|
||||
jvResult["token"]
|
||||
= getApp().getProofOfWorkFactory ().getProof ().getToken ();
|
||||
}
|
||||
|
||||
return jvResult;
|
||||
|
||||
@@ -25,22 +25,20 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doProofSolve (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
Json::Value jvResult;
|
||||
Json::Value jvResult;
|
||||
|
||||
if (!context.params_.isMember ("token"))
|
||||
return RPC::missing_field_error ("token");
|
||||
|
||||
std::string strToken = context.params_["token"].asString ();
|
||||
std::string strToken = context.params_["token"].asString ();
|
||||
|
||||
if (!ProofOfWork::validateToken (strToken))
|
||||
return RPC::invalid_field_error ("token");
|
||||
|
||||
ProofOfWork powProof (strToken);
|
||||
uint256 uSolution = powProof.solve ();
|
||||
ProofOfWork powProof (strToken);
|
||||
uint256 uSolution = powProof.solve ();
|
||||
|
||||
jvResult["solution"] = to_string (uSolution);
|
||||
jvResult["solution"] = to_string (uSolution);
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
@@ -29,10 +29,9 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doProofVerify (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
// XXX Add ability to check proof against arbitrary time
|
||||
|
||||
Json::Value jvResult;
|
||||
Json::Value jvResult;
|
||||
|
||||
if (!context.params_.isMember ("token"))
|
||||
return RPC::missing_field_error ("token");
|
||||
@@ -40,15 +39,16 @@ Json::Value doProofVerify (RPC::Context& context)
|
||||
if (!context.params_.isMember ("solution"))
|
||||
return RPC::missing_field_error ("solution");
|
||||
|
||||
std::string strToken = context.params_["token"].asString ();
|
||||
uint256 uSolution (context.params_["solution"].asString ());
|
||||
std::string strToken = context.params_["token"].asString ();
|
||||
uint256 uSolution (context.params_["solution"].asString ());
|
||||
|
||||
PowResult prResult;
|
||||
PowResult prResult;
|
||||
|
||||
if (context.params_.isMember ("difficulty") || context.params_.isMember ("secret"))
|
||||
if (context.params_.isMember ("difficulty") ||
|
||||
context.params_.isMember ("secret"))
|
||||
{
|
||||
// VFALCO TODO why aren't we using the app's factory?
|
||||
std::unique_ptr <ProofOfWorkFactory> pgGen (ProofOfWorkFactory::New ());
|
||||
auto pgGen (ProofOfWorkFactory::New ());
|
||||
|
||||
if (context.params_.isMember ("difficulty"))
|
||||
{
|
||||
@@ -57,8 +57,11 @@ Json::Value doProofVerify (RPC::Context& context)
|
||||
|
||||
int iDifficulty = context.params_["difficulty"].asInt ();
|
||||
|
||||
if (iDifficulty < 0 || iDifficulty > ProofOfWorkFactory::kMaxDifficulty)
|
||||
if (iDifficulty < 0 ||
|
||||
iDifficulty > ProofOfWorkFactory::kMaxDifficulty)
|
||||
{
|
||||
return RPC::missing_field_error ("difficulty");
|
||||
}
|
||||
|
||||
pgGen->setDifficulty (iDifficulty);
|
||||
}
|
||||
@@ -70,13 +73,13 @@ Json::Value doProofVerify (RPC::Context& context)
|
||||
}
|
||||
|
||||
prResult = pgGen->checkProof (strToken, uSolution);
|
||||
|
||||
jvResult["secret"] = to_string (pgGen->getSecret ());
|
||||
}
|
||||
else
|
||||
{
|
||||
// XXX Proof should not be marked as used from this
|
||||
prResult = getApp().getProofOfWorkFactory ().checkProof (strToken, uSolution);
|
||||
prResult = getApp().getProofOfWorkFactory ().checkProof (
|
||||
strToken, uSolution);
|
||||
}
|
||||
|
||||
std::string sToken;
|
||||
|
||||
@@ -26,17 +26,14 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doRandom (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
uint256 uRandom;
|
||||
uint256 rand;
|
||||
|
||||
try
|
||||
{
|
||||
RandomNumbers::getInstance ().fillBytes (uRandom.begin (), uRandom.size ());
|
||||
RandomNumbers::getInstance ().fillBytes (rand.begin (), rand.size ());
|
||||
|
||||
Json::Value jvResult;
|
||||
|
||||
jvResult["random"] = to_string (uRandom);
|
||||
|
||||
jvResult["random"] = to_string (rand);
|
||||
return jvResult;
|
||||
}
|
||||
catch (...)
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace ripple {
|
||||
// This interface is deprecated.
|
||||
Json::Value doRipplePathFind (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
RPC::LegacyPathFind lpf (context.role_ == Config::ADMIN);
|
||||
if (!lpf.isOk ())
|
||||
return rpcError (rpcTOO_BUSY);
|
||||
@@ -39,9 +37,14 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
|
||||
Json::Value jvResult;
|
||||
|
||||
if (getConfig().RUN_STANDALONE || context.params_.isMember("ledger") || context.params_.isMember("ledger_index") || context.params_.isMember("ledger_hash"))
|
||||
{ // The caller specified a ledger
|
||||
jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
if (getConfig().RUN_STANDALONE
|
||||
|| context.params_.isMember("ledger")
|
||||
|| context.params_.isMember("ledger_index")
|
||||
|| context.params_.isMember("ledger_hash"))
|
||||
{
|
||||
// The caller specified a ledger
|
||||
jvResult = RPC::lookupLedger (
|
||||
context.params_, lpLedger, context.netOps_);
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
}
|
||||
@@ -51,7 +54,8 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
jvResult = rpcError (rpcSRC_ACT_MISSING);
|
||||
}
|
||||
else if (!context.params_["source_account"].isString ()
|
||||
|| !raSrc.setAccountID (context.params_["source_account"].asString ()))
|
||||
|| !raSrc.setAccountID (
|
||||
context.params_["source_account"].asString ()))
|
||||
{
|
||||
jvResult = rpcError (rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
@@ -60,7 +64,8 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
jvResult = rpcError (rpcDST_ACT_MISSING);
|
||||
}
|
||||
else if (!context.params_["destination_account"].isString ()
|
||||
|| !raDst.setAccountID (context.params_["destination_account"].asString ()))
|
||||
|| !raDst.setAccountID (
|
||||
context.params_["destination_account"].asString ()))
|
||||
{
|
||||
jvResult = rpcError (rpcDST_ACT_MALFORMED);
|
||||
}
|
||||
@@ -69,7 +74,9 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
!context.params_.isMember ("destination_amount")
|
||||
|| !saDstAmount.bSetJson (context.params_["destination_amount"])
|
||||
|| saDstAmount <= zero
|
||||
|| (!!saDstAmount.getCurrency () && (!saDstAmount.getIssuer () || noAccount() == saDstAmount.getIssuer ())))
|
||||
|| (!!saDstAmount.getCurrency () &&
|
||||
(!saDstAmount.getIssuer ()
|
||||
|| noAccount() == saDstAmount.getIssuer ())))
|
||||
{
|
||||
WriteLog (lsINFO, RPCHandler) << "Bad destination_amount.";
|
||||
jvResult = rpcError (rpcINVALID_PARAMS);
|
||||
@@ -78,8 +85,8 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
// Checks on source_currencies.
|
||||
context.params_.isMember ("source_currencies")
|
||||
&& (!context.params_["source_currencies"].isArray ()
|
||||
|| !context.params_["source_currencies"].size ()) // Don't allow empty currencies.
|
||||
)
|
||||
|| !context.params_["source_currencies"].size ()))
|
||||
// Don't allow empty currencies.
|
||||
{
|
||||
WriteLog (lsINFO, RPCHandler) << "Bad source_currencies.";
|
||||
jvResult = rpcError (rpcINVALID_PARAMS);
|
||||
@@ -160,24 +167,29 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
|
||||
// Parse optional issuer.
|
||||
if (jvSource.isMember ("issuer") &&
|
||||
((!jvSource["issuer"].isString () ||
|
||||
!to_issuer (uSrcIssuerID, jvSource["issuer"].asString ())) ||
|
||||
(uSrcIssuerID.isZero () != uSrcCurrencyID.isZero ()) ||
|
||||
(noAccount() == uSrcIssuerID)))
|
||||
((!jvSource["issuer"].isString () ||
|
||||
!to_issuer (uSrcIssuerID, jvSource["issuer"].asString ())) ||
|
||||
(uSrcIssuerID.isZero () != uSrcCurrencyID.isZero ()) ||
|
||||
(noAccount() == uSrcIssuerID)))
|
||||
{
|
||||
WriteLog (lsINFO, RPCHandler) << "Bad issuer.";
|
||||
|
||||
return rpcError (rpcSRC_ISR_MALFORMED);
|
||||
}
|
||||
|
||||
STPathSet spsComputed;
|
||||
bool bValid;
|
||||
Pathfinder pf (cache, raSrc, raDst, uSrcCurrencyID, uSrcIssuerID, saDstAmount, bValid);
|
||||
STPathSet spsComputed;
|
||||
bool bValid;
|
||||
Pathfinder pf (
|
||||
cache, raSrc, raDst, uSrcCurrencyID, uSrcIssuerID, saDstAmount, bValid);
|
||||
|
||||
int level = getConfig().PATH_SEARCH_OLD;
|
||||
if ((getConfig().PATH_SEARCH_MAX > level) && !getApp().getFeeTrack().isLoadedLocal())
|
||||
if ((getConfig().PATH_SEARCH_MAX > level)
|
||||
&& !getApp().getFeeTrack().isLoadedLocal())
|
||||
{
|
||||
++level;
|
||||
if (context.params_.isMember("depth") && context.params_["depth"].isIntegral())
|
||||
}
|
||||
if (context.params_.isMember("depth")
|
||||
&& context.params_["depth"].isIntegral())
|
||||
{
|
||||
int rLev = context.params_["search_depth"].asInt ();
|
||||
if ((rLev < level) || (context.role_ == Config::ADMIN))
|
||||
@@ -196,7 +208,8 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
STPath extraPath;
|
||||
if (!bValid || !pf.findPaths (level, 4, spsComputed, extraPath))
|
||||
{
|
||||
WriteLog (lsWARNING, RPCHandler) << "ripple_path_find: No paths found.";
|
||||
WriteLog (lsWARNING, RPCHandler)
|
||||
<< "ripple_path_find: No paths found.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -248,11 +261,23 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
spsComputed.addPath(extraPath);
|
||||
pathStateList.clear ();
|
||||
lesSandbox.clear ();
|
||||
terResult = path::rippleCalculate (lesSandbox, saMaxAmountAct, saDstAmountAct,
|
||||
pathStateList, saMaxAmount, saDstAmount,
|
||||
raDst.getAccountID (), raSrc.getAccountID (),
|
||||
spsComputed, false, false, false, true);
|
||||
WriteLog (lsDEBUG, PathRequest) << "Extra path element gives " << transHuman (terResult);
|
||||
terResult = path::rippleCalculate (
|
||||
lesSandbox,
|
||||
saMaxAmountAct,
|
||||
saDstAmountAct,
|
||||
pathStateList,
|
||||
saMaxAmount,
|
||||
saDstAmount,
|
||||
raDst.getAccountID (),
|
||||
raSrc.getAccountID (),
|
||||
spsComputed,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true);
|
||||
WriteLog (lsDEBUG, PathRequest)
|
||||
<< "Extra path element gives "
|
||||
<< transHuman (terResult);
|
||||
}
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
@@ -261,13 +286,14 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
|
||||
STPathSet spsCanonical;
|
||||
|
||||
// Reuse the expanded as it would need to be calcuated anyway to produce the canonical.
|
||||
// (At least unless we make a direct canonical.)
|
||||
// Reuse the expanded as it would need to be calcuated
|
||||
// anyway to produce the canonical. (At least unless we
|
||||
// make a direct canonical.)
|
||||
|
||||
jvEntry["source_amount"] = saMaxAmountAct.getJson (0);
|
||||
// jvEntry["paths_expanded"] = pathStateList.getJson(0);
|
||||
jvEntry["paths_canonical"] = Json::arrayValue; // spsCanonical.getJson(0);
|
||||
jvEntry["paths_computed"] = spsComputed.getJson (0);
|
||||
jvEntry["source_amount"] = saMaxAmountAct.getJson (0);
|
||||
jvEntry["paths_canonical"]
|
||||
= Json::arrayValue; // spsCanonical.getJson(0);
|
||||
jvEntry["paths_computed"] = spsComputed.getJson (0);
|
||||
|
||||
jvArray.append (jvEntry);
|
||||
}
|
||||
@@ -279,10 +305,10 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
transResultInfo (terResult, strToken, strHuman);
|
||||
|
||||
WriteLog (lsDEBUG, RPCHandler)
|
||||
<< boost::str (boost::format ("ripple_path_find: %s %s %s")
|
||||
% strToken
|
||||
% strHuman
|
||||
% spsComputed.getJson (0));
|
||||
<< "ripple_path_find: "
|
||||
<< strToken << " "
|
||||
<< strHuman << " "
|
||||
<< spsComputed.getJson (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace ripple {
|
||||
|
||||
Json::Value doSMS (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
if (!context.params_.isMember ("text"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
|
||||
HTTPClient::sendSMS (getApp().getIOService (), context.params_["text"].asString ());
|
||||
HTTPClient::sendSMS (
|
||||
getApp().getIOService (), context.params_["text"].asString ());
|
||||
|
||||
return "sms dispatched";
|
||||
}
|
||||
|
||||
@@ -22,9 +22,11 @@ namespace ripple {
|
||||
|
||||
Json::Value doServerInfo (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
ret["info"] = context.netOps_.getServerInfo (true, context.role_ == Config::ADMIN);
|
||||
ret["info"] = context.netOps_.getServerInfo (
|
||||
true, context.role_ == Config::ADMIN);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,11 @@ namespace ripple {
|
||||
|
||||
Json::Value doServerState (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
ret["state"] = context.netOps_.getServerInfo (false, context.role_ == Config::ADMIN);
|
||||
ret["state"] = context.netOps_.getServerInfo (
|
||||
false, context.role_ == Config::ADMIN);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doSign (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
context.loadType_ = Resource::feeHighBurdenRPC;
|
||||
bool bFailHard = context.params_.isMember ("fail_hard") && context.params_["fail_hard"].asBool ();
|
||||
return RPC::transactionSign (context.params_, false, bFailHard, context.lock_, context.netOps_, context.role_);
|
||||
bool bFailHard = context.params_.isMember ("fail_hard")
|
||||
&& context.params_["fail_hard"].asBool ();
|
||||
return RPC::transactionSign (
|
||||
context.params_, false, bFailHard, context.netOps_, context.role_);
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace ripple {
|
||||
|
||||
Json::Value doStop (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
getApp().signalStop ();
|
||||
|
||||
return SYSTEM_NAME " server stopping";
|
||||
|
||||
@@ -26,14 +26,14 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doSubmit (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
context.loadType_ = Resource::feeMediumBurdenRPC;
|
||||
|
||||
if (!context.params_.isMember ("tx_blob"))
|
||||
{
|
||||
bool bFailHard = context.params_.isMember ("fail_hard") && context.params_["fail_hard"].asBool ();
|
||||
return RPC::transactionSign (context.params_, true, bFailHard, context.lock_, context.netOps_, context.role_);
|
||||
bool bFailHard = context.params_.isMember ("fail_hard")
|
||||
&& context.params_["fail_hard"].asBool ();
|
||||
return RPC::transactionSign (
|
||||
context.params_, true, bFailHard, context.netOps_, context.role_);
|
||||
}
|
||||
|
||||
Json::Value jvResult;
|
||||
@@ -76,8 +76,10 @@ Json::Value doSubmit (RPC::Context& context)
|
||||
|
||||
try
|
||||
{
|
||||
(void) context.netOps_.processTransaction (tpTrans, context.role_ == Config::ADMIN, true,
|
||||
context.params_.isMember ("fail_hard") && context.params_["fail_hard"].asBool ());
|
||||
(void) context.netOps_.processTransaction (
|
||||
tpTrans, context.role_ == Config::ADMIN, true,
|
||||
context.params_.isMember ("fail_hard")
|
||||
&& context.params_["fail_hard"].asBool ());
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
@@ -90,8 +92,9 @@ Json::Value doSubmit (RPC::Context& context)
|
||||
|
||||
try
|
||||
{
|
||||
jvResult[jss::tx_json] = tpTrans->getJson (0);
|
||||
jvResult[jss::tx_blob] = strHex (tpTrans->getSTransaction ()->getSerializer ().peekData ());
|
||||
jvResult[jss::tx_json] = tpTrans->getJson (0);
|
||||
jvResult[jss::tx_blob] = strHex (
|
||||
tpTrans->getSTransaction ()->getSerializer ().peekData ());
|
||||
|
||||
if (temUNCERTAIN != tpTrans->getResult ())
|
||||
{
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace ripple {
|
||||
|
||||
Json::Value doSubscribe (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
|
||||
// FIXME: This needs to release the master lock immediately
|
||||
// Subscriptions need to be protected by their own lock
|
||||
|
||||
@@ -262,8 +264,8 @@ Json::Value doSubscribe (RPC::Context& context)
|
||||
if (book.in.currency == book.out.currency
|
||||
&& book.in.account == book.out.account)
|
||||
{
|
||||
WriteLog (lsINFO, RPCHandler) << "taker_gets same as taker_pays.";
|
||||
|
||||
WriteLog (lsINFO, RPCHandler)
|
||||
<< "taker_gets same as taker_pays.";
|
||||
return rpcError (rpcBAD_MARKET);
|
||||
}
|
||||
|
||||
@@ -289,7 +291,7 @@ Json::Value doSubscribe (RPC::Context& context)
|
||||
{
|
||||
if (bHaveMasterLock)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
lock->unlock ();
|
||||
bHaveMasterLock = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,14 @@ namespace ripple {
|
||||
// ledger_hash : <ledger>,
|
||||
// ledger_index : <ledger_index>
|
||||
// }
|
||||
// XXX In this case, not specify either ledger does not mean ledger current. It means any ledger.
|
||||
//
|
||||
// XXX In this case, not specify either ledger does not mean ledger current. It
|
||||
// means any ledger.
|
||||
Json::Value doTransactionEntry (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
Json::Value jvResult
|
||||
= RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
@@ -39,16 +40,19 @@ Json::Value doTransactionEntry (RPC::Context& context)
|
||||
{
|
||||
jvResult["error"] = "fieldNotFoundTransaction";
|
||||
}
|
||||
else if (!context.params_.isMember ("ledger_hash") && !context.params_.isMember ("ledger_index"))
|
||||
else if (!context.params_.isMember ("ledger_hash")
|
||||
&& !context.params_.isMember ("ledger_index"))
|
||||
{
|
||||
// We don't work on ledger current.
|
||||
|
||||
jvResult["error"] = "notYetImplemented"; // XXX We don't support any transaction yet.
|
||||
// XXX We don't support any transaction yet.
|
||||
jvResult["error"] = "notYetImplemented";
|
||||
}
|
||||
else
|
||||
{
|
||||
uint256 uTransID;
|
||||
// XXX Relying on trusted WSS client. Would be better to have a strict routine, returning success or failure.
|
||||
uint256 uTransID;
|
||||
// XXX Relying on trusted WSS client. Would be better to have a strict
|
||||
// routine, returning success or failure.
|
||||
uTransID.SetHex (context.params_["tx_hash"].asString ());
|
||||
|
||||
if (!lpLedger)
|
||||
|
||||
@@ -25,12 +25,11 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doTx (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
if (!context.params_.isMember (jss::transaction))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
|
||||
bool binary = context.params_.isMember (jss::binary) && context.params_[jss::binary].asBool ();
|
||||
bool binary = context.params_.isMember (jss::binary)
|
||||
&& context.params_[jss::binary].asBool ();
|
||||
|
||||
std::string strTransaction = context.params_[jss::transaction].asString ();
|
||||
|
||||
@@ -39,7 +38,7 @@ Json::Value doTx (RPC::Context& context)
|
||||
// transaction by ID
|
||||
uint256 txid (strTransaction);
|
||||
|
||||
Transaction::pointer txn = getApp().getMasterTransaction ().fetch (txid, true);
|
||||
auto txn = getApp().getMasterTransaction ().fetch (txid, true);
|
||||
|
||||
if (!txn)
|
||||
return rpcError (rpcTXN_NOT_FOUND);
|
||||
@@ -53,7 +52,7 @@ Json::Value doTx (RPC::Context& context)
|
||||
|
||||
if (txn->getLedger () != 0)
|
||||
{
|
||||
Ledger::pointer lgr = context.netOps_.getLedgerBySeq (txn->getLedger ());
|
||||
auto lgr = context.netOps_.getLedgerBySeq (txn->getLedger ());
|
||||
|
||||
if (lgr)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doTxHistory (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
context.loadType_ = Resource::feeMediumBurdenRPC;
|
||||
|
||||
if (!context.params_.isMember ("start"))
|
||||
@@ -42,7 +41,8 @@ Json::Value doTxHistory (RPC::Context& context)
|
||||
obj["index"] = startIndex;
|
||||
|
||||
std::string sql =
|
||||
boost::str (boost::format ("SELECT * FROM Transactions ORDER BY LedgerSeq desc LIMIT %u,20")
|
||||
boost::str (boost::format (
|
||||
"SELECT * FROM Transactions ORDER BY LedgerSeq desc LIMIT %u,20")
|
||||
% startIndex);
|
||||
|
||||
{
|
||||
@@ -51,9 +51,8 @@ Json::Value doTxHistory (RPC::Context& context)
|
||||
|
||||
SQL_FOREACH (db, sql)
|
||||
{
|
||||
Transaction::pointer trans = Transaction::transactionFromSQL (db, false);
|
||||
|
||||
if (trans) txs.append (trans->getJson (0));
|
||||
if (auto trans = Transaction::transactionFromSQL (db, false))
|
||||
txs.append (trans->getJson (0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,20 +26,26 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doUnlAdd (RPC::Context& context)
|
||||
{
|
||||
std::string strNode = context.params_.isMember ("node") ? context.params_["node"].asString () : "";
|
||||
std::string strComment = context.params_.isMember ("comment") ? context.params_["comment"].asString () : "";
|
||||
auto lock = getApp().masterLock();
|
||||
|
||||
std::string strNode = context.params_.isMember ("node")
|
||||
? context.params_["node"].asString () : "";
|
||||
std::string strComment = context.params_.isMember ("comment")
|
||||
? context.params_["comment"].asString () : "";
|
||||
|
||||
RippleAddress raNodePublic;
|
||||
|
||||
if (raNodePublic.setNodePublic (strNode))
|
||||
{
|
||||
getApp().getUNL ().nodeAddPublic (raNodePublic, UniqueNodeList::vsManual, strComment);
|
||||
getApp().getUNL ().nodeAddPublic (
|
||||
raNodePublic, UniqueNodeList::vsManual, strComment);
|
||||
|
||||
return "adding node by public key";
|
||||
}
|
||||
else
|
||||
{
|
||||
getApp().getUNL ().nodeAddDomain (strNode, UniqueNodeList::vsManual, strComment);
|
||||
getApp().getUNL ().nodeAddDomain (
|
||||
strNode, UniqueNodeList::vsManual, strComment);
|
||||
|
||||
return "adding node by domain";
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doUnlDelete (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
|
||||
if (!context.params_.isMember ("node"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace ripple {
|
||||
|
||||
Json::Value doUnlList (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
Json::Value obj (Json::objectValue);
|
||||
|
||||
obj["unl"] = getApp().getUNL ().getUnlJson ();
|
||||
|
||||
@@ -23,7 +23,10 @@ namespace ripple {
|
||||
// Populate the UNL from a local validators.txt file.
|
||||
Json::Value doUnlLoad (RPC::Context& context)
|
||||
{
|
||||
if (getConfig ().VALIDATORS_FILE.empty () || !getApp().getUNL ().nodeLoad (getConfig ().VALIDATORS_FILE))
|
||||
auto lock = getApp().masterLock();
|
||||
|
||||
if (getConfig ().VALIDATORS_FILE.empty ()
|
||||
|| !getApp().getUNL ().nodeLoad (getConfig ().VALIDATORS_FILE))
|
||||
{
|
||||
return rpcError (rpcLOAD_FAILED);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace ripple {
|
||||
// Populate the UNL from ripple.com's validators.txt file.
|
||||
Json::Value doUnlNetwork (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
getApp().getUNL ().nodeNetwork ();
|
||||
|
||||
return "fetching";
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace ripple {
|
||||
|
||||
Json::Value doUnlReset (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
getApp().getUNL ().nodeReset ();
|
||||
|
||||
return "removing nodes";
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace ripple {
|
||||
// unl_score
|
||||
Json::Value doUnlScore (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
getApp().getUNL ().nodeScore ();
|
||||
|
||||
return "scoring requested";
|
||||
|
||||
@@ -20,9 +20,12 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// FIXME: This leaks RPCSub objects for JSON-RPC. Shouldn't matter for anyone sane.
|
||||
// FIXME: This leaks RPCSub objects for JSON-RPC. Shouldn't matter for anyone
|
||||
// sane.
|
||||
Json::Value doUnsubscribe (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
|
||||
InfoSub::pointer ispSub;
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
|
||||
@@ -51,33 +54,27 @@ Json::Value doUnsubscribe (RPC::Context& context)
|
||||
|
||||
if (context.params_.isMember ("streams"))
|
||||
{
|
||||
for (Json::Value::iterator it = context.params_["streams"].begin (); it != context.params_["streams"].end (); it++)
|
||||
for (auto& it: context.params_["streams"])
|
||||
{
|
||||
if ((*it).isString ())
|
||||
if (it.isString ())
|
||||
{
|
||||
std::string streamName = (*it).asString ();
|
||||
std::string streamName = it.asString ();
|
||||
|
||||
if (streamName == "server")
|
||||
{
|
||||
context.netOps_.unsubServer (ispSub->getSeq ());
|
||||
}
|
||||
|
||||
else if (streamName == "ledger")
|
||||
{
|
||||
context.netOps_.unsubLedger (ispSub->getSeq ());
|
||||
}
|
||||
|
||||
else if (streamName == "transactions")
|
||||
{
|
||||
context.netOps_.unsubTransactions (ispSub->getSeq ());
|
||||
}
|
||||
|
||||
else if (streamName == "transactions_proposed"
|
||||
|| streamName == "rt_transactions") // DEPRECATED
|
||||
{
|
||||
context.netOps_.unsubRTTransactions (ispSub->getSeq ());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
jvResult["error"] = str (boost::format ("Unknown stream: %s") % streamName);
|
||||
}
|
||||
jvResult["error"] = "Unknown stream: " + streamName;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -86,35 +83,28 @@ Json::Value doUnsubscribe (RPC::Context& context)
|
||||
}
|
||||
}
|
||||
|
||||
if (context.params_.isMember ("accounts_proposed") || context.params_.isMember ("rt_accounts"))
|
||||
if (context.params_.isMember ("accounts_proposed")
|
||||
|| context.params_.isMember ("rt_accounts"))
|
||||
{
|
||||
hash_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (
|
||||
auto accounts = RPC::parseAccountIds (
|
||||
context.params_.isMember ("accounts_proposed")
|
||||
? context.params_["accounts_proposed"]
|
||||
: context.params_["rt_accounts"]); // DEPRECATED
|
||||
: context.params_["rt_accounts"]); // DEPRECATED
|
||||
|
||||
if (usnaAccoundIds.empty ())
|
||||
{
|
||||
if (accounts.empty ())
|
||||
jvResult["error"] = "malformedAccount";
|
||||
}
|
||||
else
|
||||
{
|
||||
context.netOps_.unsubAccount (ispSub->getSeq (), usnaAccoundIds, true);
|
||||
}
|
||||
context.netOps_.unsubAccount (ispSub->getSeq (), accounts, true);
|
||||
}
|
||||
|
||||
if (context.params_.isMember ("accounts"))
|
||||
{
|
||||
hash_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]);
|
||||
auto accounts = RPC::parseAccountIds (context.params_["accounts"]);
|
||||
|
||||
if (usnaAccoundIds.empty ())
|
||||
{
|
||||
if (accounts.empty ())
|
||||
jvResult["error"] = "malformedAccount";
|
||||
}
|
||||
else
|
||||
{
|
||||
context.netOps_.unsubAccount (ispSub->getSeq (), usnaAccoundIds, false);
|
||||
}
|
||||
context.netOps_.unsubAccount (ispSub->getSeq (), accounts, false);
|
||||
}
|
||||
|
||||
if (!context.params_.isMember ("books"))
|
||||
@@ -126,10 +116,8 @@ Json::Value doUnsubscribe (RPC::Context& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Json::Value::iterator it = context.params_["books"].begin (); it != context.params_["books"].end (); it++)
|
||||
for (auto& jvSubRequest: context.params_["books"])
|
||||
{
|
||||
Json::Value& jvSubRequest = *it;
|
||||
|
||||
if (!jvSubRequest.isObject ()
|
||||
|| !jvSubRequest.isMember ("taker_pays")
|
||||
|| !jvSubRequest.isMember ("taker_gets")
|
||||
|
||||
@@ -24,7 +24,8 @@ namespace ripple {
|
||||
// secret: <string> // optional
|
||||
// }
|
||||
//
|
||||
// This command requires Config::ADMIN access because it makes no sense to ask an untrusted server for this.
|
||||
// This command requires Config::ADMIN access because it makes no sense to ask
|
||||
// an untrusted server for this.
|
||||
Json::Value doValidationCreate (RPC::Context& context)
|
||||
{
|
||||
RippleAddress raSeed;
|
||||
@@ -41,9 +42,10 @@ Json::Value doValidationCreate (RPC::Context& context)
|
||||
return rpcError (rpcBAD_SEED);
|
||||
}
|
||||
|
||||
obj["validation_public_key"] = RippleAddress::createNodePublic (raSeed).humanNodePublic ();
|
||||
obj["validation_seed"] = raSeed.humanSeed ();
|
||||
obj["validation_key"] = raSeed.humanSeed1751 ();
|
||||
obj["validation_public_key"]
|
||||
= RippleAddress::createNodePublic (raSeed).humanNodePublic ();
|
||||
obj["validation_seed"] = raSeed.humanSeed ();
|
||||
obj["validation_key"] = raSeed.humanSeed1751 ();
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doValidationSeed (RPC::Context& context)
|
||||
{
|
||||
auto lock = getApp().masterLock();
|
||||
Json::Value obj (Json::objectValue);
|
||||
|
||||
if (!context.params_.isMember ("secret"))
|
||||
@@ -35,7 +36,8 @@ Json::Value doValidationSeed (RPC::Context& context)
|
||||
getConfig ().VALIDATION_PUB.clear ();
|
||||
getConfig ().VALIDATION_PRIV.clear ();
|
||||
}
|
||||
else if (!getConfig ().VALIDATION_SEED.setSeedGeneric (context.params_["secret"].asString ()))
|
||||
else if (!getConfig ().VALIDATION_SEED.setSeedGeneric (
|
||||
context.params_["secret"].asString ()))
|
||||
{
|
||||
getConfig ().VALIDATION_PUB.clear ();
|
||||
getConfig ().VALIDATION_PRIV.clear ();
|
||||
@@ -44,12 +46,15 @@ Json::Value doValidationSeed (RPC::Context& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
getConfig ().VALIDATION_PUB = RippleAddress::createNodePublic (getConfig ().VALIDATION_SEED);
|
||||
getConfig ().VALIDATION_PRIV = RippleAddress::createNodePrivate (getConfig ().VALIDATION_SEED);
|
||||
auto& seed = getConfig ().VALIDATION_SEED;
|
||||
auto& pub = getConfig ().VALIDATION_PUB;
|
||||
|
||||
obj["validation_public_key"] = getConfig ().VALIDATION_PUB.humanNodePublic ();
|
||||
obj["validation_seed"] = getConfig ().VALIDATION_SEED.humanSeed ();
|
||||
obj["validation_key"] = getConfig ().VALIDATION_SEED.humanSeed1751 ();
|
||||
pub = RippleAddress::createNodePublic (seed);
|
||||
getConfig ().VALIDATION_PRIV = RippleAddress::createNodePrivate (seed);
|
||||
|
||||
obj["validation_public_key"] = pub.humanNodePublic ();
|
||||
obj["validation_seed"] = seed.humanSeed ();
|
||||
obj["validation_key"] = seed.humanSeed1751 ();
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
@@ -27,34 +27,39 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doWalletAccounts (RPC::Context& context)
|
||||
{
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = RPC::lookupLedger (context.params_, lpLedger, context.netOps_);
|
||||
Ledger::pointer ledger;
|
||||
Json::Value jvResult
|
||||
= RPC::lookupLedger (context.params_, ledger, context.netOps_);
|
||||
|
||||
if (!lpLedger)
|
||||
if (!ledger)
|
||||
return jvResult;
|
||||
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!context.params_.isMember ("seed") || !naSeed.setSeedGeneric (context.params_["seed"].asString ()))
|
||||
if (!context.params_.isMember ("seed")
|
||||
|| !naSeed.setSeedGeneric (context.params_["seed"].asString ()))
|
||||
{
|
||||
return rpcError (rpcBAD_SEED);
|
||||
}
|
||||
|
||||
// Try the seed as a master seed.
|
||||
RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic (naSeed);
|
||||
RippleAddress naMasterGenerator
|
||||
= RippleAddress::createGeneratorPublic (naSeed);
|
||||
|
||||
Json::Value jsonAccounts = RPC::accounts (lpLedger, naMasterGenerator, context.netOps_);
|
||||
Json::Value jsonAccounts
|
||||
= RPC::accounts (ledger, naMasterGenerator, context.netOps_);
|
||||
|
||||
if (jsonAccounts.empty ())
|
||||
{
|
||||
// No account via seed as master, try seed a regular.
|
||||
Json::Value ret = RPC::getMasterGenerator (lpLedger, naSeed, naMasterGenerator, context.netOps_);
|
||||
Json::Value ret = RPC::getMasterGenerator (
|
||||
ledger, naSeed, naMasterGenerator, context.netOps_);
|
||||
|
||||
if (!ret.empty ())
|
||||
return ret;
|
||||
|
||||
ret["accounts"] = RPC::accounts (lpLedger, naMasterGenerator, context.netOps_);
|
||||
|
||||
ret["accounts"]
|
||||
= RPC::accounts (ledger, naMasterGenerator, context.netOps_);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,8 +25,6 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doWalletPropose (RPC::Context& context)
|
||||
{
|
||||
context.lock_.unlock ();
|
||||
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naAccount;
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace ripple {
|
||||
// }
|
||||
Json::Value doWalletSeed (RPC::Context& context)
|
||||
{
|
||||
RippleAddress raSeed;
|
||||
bool bSecret = context.params_.isMember ("secret");
|
||||
RippleAddress seed;
|
||||
bool bSecret = context.params_.isMember ("secret");
|
||||
|
||||
if (bSecret && !raSeed.setSeedGeneric (context.params_["secret"].asString ()))
|
||||
if (bSecret && !seed.setSeedGeneric (context.params_["secret"].asString ()))
|
||||
{
|
||||
return rpcError (rpcBAD_SEED);
|
||||
}
|
||||
@@ -37,17 +37,17 @@ Json::Value doWalletSeed (RPC::Context& context)
|
||||
|
||||
if (!bSecret)
|
||||
{
|
||||
raSeed.setSeedRandom ();
|
||||
seed.setSeedRandom ();
|
||||
}
|
||||
|
||||
RippleAddress raGenerator = RippleAddress::createGeneratorPublic (raSeed);
|
||||
RippleAddress raGenerator = RippleAddress::createGeneratorPublic (seed);
|
||||
|
||||
raAccount.setAccountPublic (raGenerator, 0);
|
||||
|
||||
Json::Value obj (Json::objectValue);
|
||||
|
||||
obj["seed"] = raSeed.humanSeed ();
|
||||
obj["key"] = raSeed.humanSeed1751 ();
|
||||
obj["seed"] = seed.humanSeed ();
|
||||
obj["key"] = seed.humanSeed1751 ();
|
||||
obj["deprecated"] = "Use wallet_propose instead";
|
||||
|
||||
return obj;
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace RPC {
|
||||
struct Context {
|
||||
Json::Value params_;
|
||||
Resource::Charge& loadType_;
|
||||
Application::ScopedLockType& lock_;
|
||||
NetworkOPs& netOps_;
|
||||
InfoSub::pointer infoSub_;
|
||||
Config::Role role_;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <ripple/module/app/main/RPCHTTPServer.h>
|
||||
#include <ripple/module/rpc/RPCHandler.h>
|
||||
#include <ripple/module/rpc/RPCServerHandler.h>
|
||||
#include <ripple/module/rpc/Tuning.h>
|
||||
#include <ripple/module/rpc/impl/Context.h>
|
||||
#include <ripple/module/rpc/impl/Handler.h>
|
||||
|
||||
@@ -51,8 +52,8 @@ RPCHandler::RPCHandler (NetworkOPs& netOps, InfoSub::pointer infoSub)
|
||||
// transport for a command and a request object. The command is the method. The
|
||||
// request object is supplied as the first element of the params.
|
||||
Json::Value RPCHandler::doRpcCommand (
|
||||
const std::string& strMethod, Json::Value const& jvParams, Config::Role iRole,
|
||||
Resource::Charge& loadType)
|
||||
const std::string& strMethod, Json::Value const& jvParams,
|
||||
Config::Role iRole, Resource::Charge& loadType)
|
||||
{
|
||||
WriteLog (lsTRACE, RPCHandler)
|
||||
<< "doRpcCommand:" << strMethod << ":" << jvParams;
|
||||
@@ -105,8 +106,7 @@ Json::Value RPCHandler::doCommand (
|
||||
// VFALCO NOTE Should we also add up the jtRPC jobs?
|
||||
//
|
||||
int jc = getApp().getJobQueue ().getJobCountGE (jtCLIENT);
|
||||
|
||||
if (jc > 500)
|
||||
if (jc > RPC::MAX_JOB_QUEUE_CLIENTS)
|
||||
{
|
||||
WriteLog (lsDEBUG, RPCHandler) << "Too busy for command: " << jc;
|
||||
return rpcError (rpcTOO_BUSY);
|
||||
@@ -131,8 +131,6 @@ Json::Value RPCHandler::doCommand (
|
||||
if (handler->role_ == Config::ADMIN && mRole != Config::ADMIN)
|
||||
return rpcError (rpcNO_PERMISSION);
|
||||
|
||||
Application::ScopedLockType lock (getApp().getMasterLock ());
|
||||
|
||||
if ((handler->condition_ & RPC::NEEDS_NETWORK_CONNECTION) &&
|
||||
(mNetOps->getOperatingMode () < NetworkOPs::omSYNCING))
|
||||
{
|
||||
@@ -145,7 +143,8 @@ Json::Value RPCHandler::doCommand (
|
||||
|
||||
if (!getConfig ().RUN_STANDALONE
|
||||
&& (handler->condition_ & RPC::NEEDS_CURRENT_LEDGER)
|
||||
&& (getApp().getLedgerMaster().getValidatedLedgerAge() > 120))
|
||||
&& (getApp().getLedgerMaster().getValidatedLedgerAge() >
|
||||
RPC::MAX_VALIDATED_LEDGER_AGE))
|
||||
{
|
||||
return rpcError (rpcNO_CURRENT);
|
||||
}
|
||||
@@ -159,25 +158,19 @@ Json::Value RPCHandler::doCommand (
|
||||
try
|
||||
{
|
||||
LoadEvent::autoptr ev = getApp().getJobQueue().getLoadEventAP(
|
||||
jtGENERIC, std::string("cmd:") + strCommand);
|
||||
RPC::Context context{params, loadType, lock, *mNetOps, mInfoSub, mRole};
|
||||
jtGENERIC, "cmd:" + strCommand);
|
||||
RPC::Context context{params, loadType, *mNetOps, mInfoSub, mRole};
|
||||
Json::Value jvRaw = handler->method_(context);
|
||||
|
||||
// Regularize result.
|
||||
if (jvRaw.isObject ())
|
||||
{
|
||||
// Got an object.
|
||||
return jvRaw;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Probably got a string.
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
|
||||
jvResult[jss::message] = jvRaw;
|
||||
// Probably got a string.
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
jvResult[jss::message] = jvRaw;
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
return jvResult;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
@@ -204,8 +197,7 @@ RPCInternalHandler::RPCInternalHandler (
|
||||
Json::Value RPCInternalHandler::runHandler (
|
||||
const std::string& name, const Json::Value& params)
|
||||
{
|
||||
RPCInternalHandler* h = sHeadHandler;
|
||||
while (h != nullptr)
|
||||
for (RPCInternalHandler* h = sHeadHandler; h != nullptr; )
|
||||
{
|
||||
if (name == h->mName)
|
||||
{
|
||||
|
||||
@@ -179,8 +179,8 @@ static Json::Value signPayment(
|
||||
// submit the tranaction
|
||||
//
|
||||
Json::Value transactionSign (
|
||||
Json::Value params, bool bSubmit, bool bFailHard,
|
||||
Application::ScopedLockType& mlh, NetworkOPs& netOps, int role)
|
||||
Json::Value params, bool bSubmit, bool bFailHard, NetworkOPs& netOps,
|
||||
int role)
|
||||
{
|
||||
Json::Value jvResult;
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ Json::Value transactionSign (
|
||||
Json::Value jvRequest,
|
||||
bool bSubmit,
|
||||
bool bFailHard,
|
||||
Application::ScopedLockType& mlh,
|
||||
NetworkOPs& netOps,
|
||||
int role);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user