mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
New MasterLockType which tracks ownership
This commit is contained in:
@@ -42,50 +42,53 @@ NetworkOPs::NetworkOPs (LedgerMaster* pLedgerMaster)
|
||||
|
||||
void NetworkOPs::processNetTimer ()
|
||||
{
|
||||
ScopedLock sl (getApp().getMasterLock ());
|
||||
|
||||
Application& app (getApp ());
|
||||
ILoadManager& mgr (app.getLoadManager ());
|
||||
|
||||
getApp().getLoadManager ().resetDeadlockDetector ();
|
||||
|
||||
std::size_t const numPeers = getApp().getPeers ().getPeerVector ().size ();
|
||||
|
||||
// do we have sufficient peers? If not, we are disconnected.
|
||||
if (numPeers < theConfig.NETWORK_QUORUM)
|
||||
{
|
||||
if (mMode != omDISCONNECTED)
|
||||
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
// VFALCO NOTE This is for diagnosing a crash on exit
|
||||
Application& app (getApp ());
|
||||
ILoadManager& mgr (app.getLoadManager ());
|
||||
|
||||
getApp().getLoadManager ().resetDeadlockDetector ();
|
||||
|
||||
std::size_t const numPeers = getApp().getPeers ().getPeerVector ().size ();
|
||||
|
||||
// do we have sufficient peers? If not, we are disconnected.
|
||||
if (numPeers < theConfig.NETWORK_QUORUM)
|
||||
{
|
||||
setMode (omDISCONNECTED);
|
||||
WriteLog (lsWARNING, NetworkOPs)
|
||||
<< "Node count (" << numPeers << ") "
|
||||
<< "has fallen below quorum (" << theConfig.NETWORK_QUORUM << ").";
|
||||
if (mMode != omDISCONNECTED)
|
||||
{
|
||||
setMode (omDISCONNECTED);
|
||||
WriteLog (lsWARNING, NetworkOPs)
|
||||
<< "Node count (" << numPeers << ") "
|
||||
<< "has fallen below quorum (" << theConfig.NETWORK_QUORUM << ").";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (mMode == omDISCONNECTED)
|
||||
{
|
||||
setMode (omCONNECTED);
|
||||
WriteLog (lsINFO, NetworkOPs) << "Node count (" << numPeers << ") is sufficient.";
|
||||
}
|
||||
|
||||
if (mMode == omDISCONNECTED)
|
||||
{
|
||||
setMode (omCONNECTED);
|
||||
WriteLog (lsINFO, NetworkOPs) << "Node count (" << numPeers << ") is sufficient.";
|
||||
}
|
||||
// Check if the last validated ledger forces a change between these states
|
||||
if (mMode == omSYNCING)
|
||||
{
|
||||
setMode (omSYNCING);
|
||||
}
|
||||
else if (mMode == omCONNECTED)
|
||||
{
|
||||
setMode (omCONNECTED);
|
||||
}
|
||||
|
||||
// Check if the last validated ledger forces a change between these states
|
||||
if (mMode == omSYNCING)
|
||||
{
|
||||
setMode (omSYNCING);
|
||||
}
|
||||
else if (mMode == omCONNECTED)
|
||||
{
|
||||
setMode (omCONNECTED);
|
||||
}
|
||||
if (!mConsensus)
|
||||
tryStartConsensus ();
|
||||
|
||||
if (!mConsensus)
|
||||
tryStartConsensus ();
|
||||
|
||||
if (mConsensus)
|
||||
mConsensus->timerEntry ();
|
||||
if (mConsensus)
|
||||
mConsensus->timerEntry ();
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkOPs::onDeadlineTimer (DeadlineTimer& timer)
|
||||
@@ -309,71 +312,72 @@ void NetworkOPs::runTransactionQueue ()
|
||||
{
|
||||
LoadEvent::autoptr ev = getApp().getJobQueue ().getLoadEventAP (jtTXN_PROC, "runTxnQ");
|
||||
|
||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
||||
|
||||
Transaction::pointer dbtx = getApp().getMasterTransaction ().fetch (txn->getID (), true);
|
||||
assert (dbtx);
|
||||
|
||||
bool didApply;
|
||||
TER r = mLedgerMaster->doTransaction (dbtx->getSTransaction (),
|
||||
tapOPEN_LEDGER | tapNO_CHECK_SIGN, didApply);
|
||||
dbtx->setResult (r);
|
||||
|
||||
if (isTemMalformed (r)) // malformed, cache bad
|
||||
getApp().getHashRouter ().setFlag (txn->getID (), SF_BAD);
|
||||
// else if (isTelLocal (r) || isTerRetry (r)) // can be retried
|
||||
// getApp().getHashRouter ().setFlag (txn->getID (), SF_RETRY);
|
||||
|
||||
|
||||
if (isTerRetry (r))
|
||||
{
|
||||
// transaction should be held
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "QTransaction should be held: " << r;
|
||||
dbtx->setStatus (HELD);
|
||||
getApp().getMasterTransaction ().canonicalize (dbtx);
|
||||
mLedgerMaster->addHeldTransaction (dbtx);
|
||||
}
|
||||
else if (r == tefPAST_SEQ)
|
||||
{
|
||||
// duplicate or conflict
|
||||
WriteLog (lsINFO, NetworkOPs) << "QTransaction is obsolete";
|
||||
dbtx->setStatus (OBSOLETE);
|
||||
}
|
||||
else if (r == tesSUCCESS)
|
||||
{
|
||||
WriteLog (lsINFO, NetworkOPs) << "QTransaction is now included in open ledger";
|
||||
dbtx->setStatus (INCLUDED);
|
||||
getApp().getMasterTransaction ().canonicalize (dbtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "QStatus other than success " << r;
|
||||
dbtx->setStatus (INVALID);
|
||||
}
|
||||
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
// if (didApply || (mMode != omFULL))
|
||||
if (didApply)
|
||||
{
|
||||
std::set<uint64> peers;
|
||||
Transaction::pointer dbtx = getApp().getMasterTransaction ().fetch (txn->getID (), true);
|
||||
assert (dbtx);
|
||||
|
||||
if (getApp().getHashRouter ().swapSet (txn->getID (), peers, SF_RELAYED))
|
||||
bool didApply;
|
||||
TER r = mLedgerMaster->doTransaction (dbtx->getSTransaction (),
|
||||
tapOPEN_LEDGER | tapNO_CHECK_SIGN, didApply);
|
||||
dbtx->setResult (r);
|
||||
|
||||
if (isTemMalformed (r)) // malformed, cache bad
|
||||
getApp().getHashRouter ().setFlag (txn->getID (), SF_BAD);
|
||||
// else if (isTelLocal (r) || isTerRetry (r)) // can be retried
|
||||
// getApp().getHashRouter ().setFlag (txn->getID (), SF_RETRY);
|
||||
|
||||
|
||||
if (isTerRetry (r))
|
||||
{
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "relaying";
|
||||
protocol::TMTransaction tx;
|
||||
Serializer s;
|
||||
dbtx->getSTransaction ()->add (s);
|
||||
tx.set_rawtransaction (&s.getData ().front (), s.getLength ());
|
||||
tx.set_status (protocol::tsCURRENT);
|
||||
tx.set_receivetimestamp (getNetworkTimeNC ()); // FIXME: This should be when we received it
|
||||
|
||||
PackedMessage::pointer packet = boost::make_shared<PackedMessage> (tx, protocol::mtTRANSACTION);
|
||||
getApp().getPeers ().relayMessageBut (peers, packet);
|
||||
// transaction should be held
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "QTransaction should be held: " << r;
|
||||
dbtx->setStatus (HELD);
|
||||
getApp().getMasterTransaction ().canonicalize (dbtx);
|
||||
mLedgerMaster->addHeldTransaction (dbtx);
|
||||
}
|
||||
else if (r == tefPAST_SEQ)
|
||||
{
|
||||
// duplicate or conflict
|
||||
WriteLog (lsINFO, NetworkOPs) << "QTransaction is obsolete";
|
||||
dbtx->setStatus (OBSOLETE);
|
||||
}
|
||||
else if (r == tesSUCCESS)
|
||||
{
|
||||
WriteLog (lsINFO, NetworkOPs) << "QTransaction is now included in open ledger";
|
||||
dbtx->setStatus (INCLUDED);
|
||||
getApp().getMasterTransaction ().canonicalize (dbtx);
|
||||
}
|
||||
else
|
||||
WriteLog(lsDEBUG, NetworkOPs) << "recently relayed";
|
||||
}
|
||||
{
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "QStatus other than success " << r;
|
||||
dbtx->setStatus (INVALID);
|
||||
}
|
||||
|
||||
txn->doCallbacks (r);
|
||||
if (didApply /*|| (mMode != omFULL)*/ )
|
||||
{
|
||||
std::set <uint64> peers;
|
||||
|
||||
if (getApp().getHashRouter ().swapSet (txn->getID (), peers, SF_RELAYED))
|
||||
{
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "relaying";
|
||||
protocol::TMTransaction tx;
|
||||
Serializer s;
|
||||
dbtx->getSTransaction ()->add (s);
|
||||
tx.set_rawtransaction (&s.getData ().front (), s.getLength ());
|
||||
tx.set_status (protocol::tsCURRENT);
|
||||
tx.set_receivetimestamp (getNetworkTimeNC ()); // FIXME: This should be when we received it
|
||||
|
||||
PackedMessage::pointer packet = boost::make_shared<PackedMessage> (tx, protocol::mtTRANSACTION);
|
||||
getApp().getPeers ().relayMessageBut (peers, packet);
|
||||
}
|
||||
else
|
||||
WriteLog(lsDEBUG, NetworkOPs) << "recently relayed";
|
||||
}
|
||||
|
||||
txn->doCallbacks (r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,77 +414,79 @@ Transaction::pointer NetworkOPs::processTransaction (Transaction::pointer trans,
|
||||
getApp().getHashRouter ().setFlag (trans->getID (), SF_SIGGOOD);
|
||||
}
|
||||
|
||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
||||
bool didApply;
|
||||
TER r = mLedgerMaster->doTransaction (trans->getSTransaction (),
|
||||
bAdmin ? (tapOPEN_LEDGER | tapNO_CHECK_SIGN | tapADMIN) : (tapOPEN_LEDGER | tapNO_CHECK_SIGN), didApply);
|
||||
trans->setResult (r);
|
||||
{
|
||||
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
if (isTemMalformed (r)) // malformed, cache bad
|
||||
getApp().getHashRouter ().setFlag (trans->getID (), SF_BAD);
|
||||
// else if (isTelLocal (r) || isTerRetry (r)) // can be retried
|
||||
// getApp().getHashRouter ().setFlag (trans->getID (), SF_RETRY);
|
||||
bool didApply;
|
||||
TER r = mLedgerMaster->doTransaction (trans->getSTransaction (),
|
||||
bAdmin ? (tapOPEN_LEDGER | tapNO_CHECK_SIGN | tapADMIN) : (tapOPEN_LEDGER | tapNO_CHECK_SIGN), didApply);
|
||||
trans->setResult (r);
|
||||
|
||||
if (isTemMalformed (r)) // malformed, cache bad
|
||||
getApp().getHashRouter ().setFlag (trans->getID (), SF_BAD);
|
||||
// else if (isTelLocal (r) || isTerRetry (r)) // can be retried
|
||||
// getApp().getHashRouter ().setFlag (trans->getID (), SF_RETRY);
|
||||
|
||||
#ifdef BEAST_DEBUG
|
||||
|
||||
if (r != tesSUCCESS)
|
||||
{
|
||||
std::string token, human;
|
||||
CondLog (transResultInfo (r, token, human), lsINFO, NetworkOPs) << "TransactionResult: " << token << ": " << human;
|
||||
}
|
||||
if (r != tesSUCCESS)
|
||||
{
|
||||
std::string token, human;
|
||||
CondLog (transResultInfo (r, token, human), lsINFO, NetworkOPs) << "TransactionResult: " << token << ": " << human;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (callback)
|
||||
callback (trans, r);
|
||||
if (callback)
|
||||
callback (trans, r);
|
||||
|
||||
if (r == tefFAILURE)
|
||||
throw Fault (IO_ERROR);
|
||||
if (r == tefFAILURE)
|
||||
throw Fault (IO_ERROR);
|
||||
|
||||
if (r == tesSUCCESS)
|
||||
{
|
||||
WriteLog (lsINFO, NetworkOPs) << "Transaction is now included in open ledger";
|
||||
trans->setStatus (INCLUDED);
|
||||
getApp().getMasterTransaction ().canonicalize (trans);
|
||||
}
|
||||
else if (r == tefPAST_SEQ)
|
||||
{
|
||||
// duplicate or conflict
|
||||
WriteLog (lsINFO, NetworkOPs) << "Transaction is obsolete";
|
||||
trans->setStatus (OBSOLETE);
|
||||
}
|
||||
else if (isTerRetry (r))
|
||||
{
|
||||
if (!bFailHard)
|
||||
if (r == tesSUCCESS)
|
||||
{
|
||||
// transaction should be held
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "Transaction should be held: " << r;
|
||||
trans->setStatus (HELD);
|
||||
getApp().getMasterTransaction ().canonicalize (trans);
|
||||
mLedgerMaster->addHeldTransaction (trans);
|
||||
WriteLog (lsINFO, NetworkOPs) << "Transaction is now included in open ledger";
|
||||
trans->setStatus (INCLUDED);
|
||||
getApp().getMasterTransaction ().canonicalize (trans);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "Status other than success " << r;
|
||||
trans->setStatus (INVALID);
|
||||
}
|
||||
|
||||
if (didApply || ((mMode != omFULL) && !bFailHard))
|
||||
{
|
||||
std::set<uint64> peers;
|
||||
|
||||
if (getApp().getHashRouter ().swapSet (trans->getID (), peers, SF_RELAYED))
|
||||
else if (r == tefPAST_SEQ)
|
||||
{
|
||||
protocol::TMTransaction tx;
|
||||
Serializer s;
|
||||
trans->getSTransaction ()->add (s);
|
||||
tx.set_rawtransaction (&s.getData ().front (), s.getLength ());
|
||||
tx.set_status (protocol::tsCURRENT);
|
||||
tx.set_receivetimestamp (getNetworkTimeNC ()); // FIXME: This should be when we received it
|
||||
// duplicate or conflict
|
||||
WriteLog (lsINFO, NetworkOPs) << "Transaction is obsolete";
|
||||
trans->setStatus (OBSOLETE);
|
||||
}
|
||||
else if (isTerRetry (r))
|
||||
{
|
||||
if (!bFailHard)
|
||||
{
|
||||
// transaction should be held
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "Transaction should be held: " << r;
|
||||
trans->setStatus (HELD);
|
||||
getApp().getMasterTransaction ().canonicalize (trans);
|
||||
mLedgerMaster->addHeldTransaction (trans);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteLog (lsDEBUG, NetworkOPs) << "Status other than success " << r;
|
||||
trans->setStatus (INVALID);
|
||||
}
|
||||
|
||||
PackedMessage::pointer packet = boost::make_shared<PackedMessage> (tx, protocol::mtTRANSACTION);
|
||||
getApp().getPeers ().relayMessageBut (peers, packet);
|
||||
if (didApply || ((mMode != omFULL) && !bFailHard))
|
||||
{
|
||||
std::set<uint64> peers;
|
||||
|
||||
if (getApp().getHashRouter ().swapSet (trans->getID (), peers, SF_RELAYED))
|
||||
{
|
||||
protocol::TMTransaction tx;
|
||||
Serializer s;
|
||||
trans->getSTransaction ()->add (s);
|
||||
tx.set_rawtransaction (&s.getData ().front (), s.getLength ());
|
||||
tx.set_status (protocol::tsCURRENT);
|
||||
tx.set_receivetimestamp (getNetworkTimeNC ()); // FIXME: This should be when we received it
|
||||
|
||||
PackedMessage::pointer packet = boost::make_shared<PackedMessage> (tx, protocol::mtTRANSACTION);
|
||||
getApp().getPeers ().relayMessageBut (peers, packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,49 +964,53 @@ uint256 NetworkOPs::getConsensusLCL ()
|
||||
void NetworkOPs::processTrustedProposal (LedgerProposal::pointer proposal,
|
||||
boost::shared_ptr<protocol::TMProposeSet> set, RippleAddress nodePublic, uint256 checkLedger, bool sigGood)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
||||
|
||||
bool relay = true;
|
||||
|
||||
if (!haveConsensusObject ())
|
||||
{
|
||||
WriteLog (lsINFO, NetworkOPs) << "Received proposal outside consensus window";
|
||||
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
if (mMode == omFULL)
|
||||
relay = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
storeProposal (proposal, nodePublic);
|
||||
bool relay = true;
|
||||
|
||||
uint256 consensusLCL = mConsensus->getLCL ();
|
||||
|
||||
if (!set->has_previousledger () && (checkLedger != consensusLCL))
|
||||
if (!haveConsensusObject ())
|
||||
{
|
||||
WriteLog (lsWARNING, NetworkOPs) << "Have to re-check proposal signature due to consensus view change";
|
||||
assert (proposal->hasSignature ());
|
||||
proposal->setPrevLedger (consensusLCL);
|
||||
WriteLog (lsINFO, NetworkOPs) << "Received proposal outside consensus window";
|
||||
|
||||
if (proposal->checkSign ())
|
||||
sigGood = true;
|
||||
if (mMode == omFULL)
|
||||
relay = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
storeProposal (proposal, nodePublic);
|
||||
|
||||
uint256 consensusLCL = mConsensus->getLCL ();
|
||||
|
||||
if (!set->has_previousledger () && (checkLedger != consensusLCL))
|
||||
{
|
||||
WriteLog (lsWARNING, NetworkOPs) << "Have to re-check proposal signature due to consensus view change";
|
||||
assert (proposal->hasSignature ());
|
||||
proposal->setPrevLedger (consensusLCL);
|
||||
|
||||
if (proposal->checkSign ())
|
||||
sigGood = true;
|
||||
}
|
||||
|
||||
if (sigGood && (consensusLCL == proposal->getPrevLedger ()))
|
||||
{
|
||||
relay = mConsensus->peerPosition (proposal);
|
||||
WriteLog (lsTRACE, NetworkOPs) << "Proposal processing finished, relay=" << relay;
|
||||
}
|
||||
}
|
||||
|
||||
if (sigGood && (consensusLCL == proposal->getPrevLedger ()))
|
||||
if (relay)
|
||||
{
|
||||
relay = mConsensus->peerPosition (proposal);
|
||||
WriteLog (lsTRACE, NetworkOPs) << "Proposal processing finished, relay=" << relay;
|
||||
std::set<uint64> peers;
|
||||
getApp().getHashRouter ().swapSet (proposal->getHashRouter (), peers, SF_RELAYED);
|
||||
PackedMessage::pointer message = boost::make_shared<PackedMessage> (*set, protocol::mtPROPOSE_LEDGER);
|
||||
getApp().getPeers ().relayMessageBut (peers, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteLog (lsINFO, NetworkOPs) << "Not relaying trusted proposal";
|
||||
}
|
||||
}
|
||||
|
||||
if (relay)
|
||||
{
|
||||
std::set<uint64> peers;
|
||||
getApp().getHashRouter ().swapSet (proposal->getHashRouter (), peers, SF_RELAYED);
|
||||
PackedMessage::pointer message = boost::make_shared<PackedMessage> (*set, protocol::mtPROPOSE_LEDGER);
|
||||
getApp().getPeers ().relayMessageBut (peers, message);
|
||||
}
|
||||
else
|
||||
WriteLog (lsINFO, NetworkOPs) << "Not relaying trusted proposal";
|
||||
}
|
||||
|
||||
SHAMap::pointer NetworkOPs::getTXMap (uint256 const& hash)
|
||||
@@ -1042,8 +1052,10 @@ SHAMapAddNode NetworkOPs::gotTXData (const boost::shared_ptr<Peer>& peer, uint25
|
||||
{
|
||||
|
||||
boost::shared_ptr<LedgerConsensus> consensus;
|
||||
|
||||
{
|
||||
ScopedLock mlh(getApp().getMasterLock());
|
||||
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
consensus = mConsensus;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ RPCHandler::RPCHandler (NetworkOPs* netOps, InfoSub::pointer infoSub) : mNetOps
|
||||
;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::transactionSign (Json::Value params, bool bSubmit, bool bFailHard, ScopedLock& mlh)
|
||||
Json::Value RPCHandler::transactionSign (Json::Value params, bool bSubmit, bool bFailHard, Application::ScopedLockType& mlh)
|
||||
{
|
||||
if (getApp().getFeeTrack().isLoadedCluster() && (mRole != ADMIN))
|
||||
return rpcError(rpcTOO_BUSY);
|
||||
@@ -595,7 +595,7 @@ Json::Value RPCHandler::accountFromString (Ledger::ref lrLedger, RippleAddress&
|
||||
// ledger_hash : <ledger>
|
||||
// ledger_index : <ledger_index>
|
||||
// }
|
||||
Json::Value RPCHandler::doAccountInfo (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doAccountInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||
@@ -640,7 +640,7 @@ Json::Value RPCHandler::doAccountInfo (Json::Value params, LoadType* loadType, S
|
||||
// port: <number>
|
||||
// }
|
||||
// XXX Might allow domain for manual connections.
|
||||
Json::Value RPCHandler::doConnect (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doConnect (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (theConfig.RUN_STANDALONE)
|
||||
return "cannot connect in standalone mode";
|
||||
@@ -661,7 +661,7 @@ Json::Value RPCHandler::doConnect (Json::Value params, LoadType* loadType, Scope
|
||||
// {
|
||||
// key: <string>
|
||||
// }
|
||||
Json::Value RPCHandler::doDataDelete (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doDataDelete (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("key"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -687,7 +687,7 @@ Json::Value RPCHandler::doDataDelete (Json::Value params, LoadType* loadType, Sc
|
||||
// {
|
||||
// key: <string>
|
||||
// }
|
||||
Json::Value RPCHandler::doDataFetch (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doDataFetch (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("key"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -711,7 +711,7 @@ Json::Value RPCHandler::doDataFetch (Json::Value params, LoadType* loadType, Sco
|
||||
// key: <string>
|
||||
// value: <string>
|
||||
// }
|
||||
Json::Value RPCHandler::doDataStore (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doDataStore (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("key")
|
||||
|| !params.isMember ("value"))
|
||||
@@ -772,7 +772,7 @@ Json::Value RPCHandler::doNicknameInfo (Json::Value params)
|
||||
// 'account_index' : <index> // optional
|
||||
// }
|
||||
// XXX This would be better if it took the ledger.
|
||||
Json::Value RPCHandler::doOwnerInfo (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doOwnerInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("account") && !params.isMember ("ident"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -797,7 +797,7 @@ Json::Value RPCHandler::doOwnerInfo (Json::Value params, LoadType* loadType, Sco
|
||||
return ret;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doPeers (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doPeers (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
|
||||
@@ -808,7 +808,7 @@ Json::Value RPCHandler::doPeers (Json::Value, LoadType* loadType, ScopedLock& Ma
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doPing (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doPing (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
return Json::Value (Json::objectValue);
|
||||
}
|
||||
@@ -818,7 +818,7 @@ Json::Value RPCHandler::doPing (Json::Value, LoadType* loadType, ScopedLock& Mas
|
||||
// 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.
|
||||
Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
/* need to fix now that sharedOfferCreate is gone
|
||||
int iArgs = params.size();
|
||||
@@ -910,9 +910,9 @@ Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, Scope
|
||||
// difficulty: <number> // optional
|
||||
// secret: <secret> // optional
|
||||
// }
|
||||
Json::Value RPCHandler::doProofCreate (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doProofCreate (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
// XXX: Add ability to create proof with arbitrary time
|
||||
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
@@ -955,9 +955,9 @@ Json::Value RPCHandler::doProofCreate (Json::Value params, LoadType* loadType, S
|
||||
// {
|
||||
// token: <token>
|
||||
// }
|
||||
Json::Value RPCHandler::doProofSolve (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doProofSolve (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
Json::Value jvResult;
|
||||
|
||||
@@ -985,9 +985,9 @@ Json::Value RPCHandler::doProofSolve (Json::Value params, LoadType* loadType, Sc
|
||||
// difficulty: <number> // optional
|
||||
// secret: <secret> // optional
|
||||
// }
|
||||
Json::Value RPCHandler::doProofVerify (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doProofVerify (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
// XXX Add ability to check proof against arbitrary time
|
||||
|
||||
Json::Value jvResult;
|
||||
@@ -1055,7 +1055,7 @@ Json::Value RPCHandler::doProofVerify (Json::Value params, LoadType* loadType, S
|
||||
// ledger_hash : <ledger>
|
||||
// ledger_index : <ledger_index>
|
||||
// }
|
||||
Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||
@@ -1067,7 +1067,7 @@ Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType,
|
||||
|
||||
if (lpLedger->isImmutable ())
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
bUnlocked = true;
|
||||
}
|
||||
|
||||
@@ -1140,7 +1140,7 @@ Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType,
|
||||
}
|
||||
|
||||
if (!bUnlocked)
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1168,7 +1168,7 @@ static void offerAdder (Json::Value& jvLines, SLE::ref offer)
|
||||
// ledger_hash : <ledger>
|
||||
// ledger_index : <ledger_index>
|
||||
// }
|
||||
Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||
@@ -1180,7 +1180,7 @@ Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType,
|
||||
|
||||
if (lpLedger->isImmutable ())
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
bUnlocked = true;
|
||||
}
|
||||
|
||||
@@ -1212,7 +1212,7 @@ Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType,
|
||||
lpLedger->visitAccountItems (raAccount.getAccountID (), BIND_TYPE (&offerAdder, boost::ref (jvsOffers), P_1));
|
||||
|
||||
if (!bUnlocked)
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
@@ -1227,7 +1227,7 @@ Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType,
|
||||
// "limit" : integer, // Optional.
|
||||
// "proof" : boolean // Defaults to false.
|
||||
// }
|
||||
Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (getApp().getJobQueue ().getJobCountGE (jtCLIENT) > 200)
|
||||
{
|
||||
@@ -1241,7 +1241,7 @@ Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, Sc
|
||||
return jvResult;
|
||||
|
||||
if (lpLedger->isImmutable ())
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
if (!params.isMember ("taker_pays") || !params.isMember ("taker_gets") || !params["taker_pays"].isObject () || !params["taker_gets"].isObject ())
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -1328,9 +1328,9 @@ Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, Sc
|
||||
// {
|
||||
// random: <uint256>
|
||||
// }
|
||||
Json::Value RPCHandler::doRandom (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doRandom (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
uint256 uRandom;
|
||||
|
||||
try
|
||||
@@ -1349,7 +1349,7 @@ Json::Value RPCHandler::doRandom (Json::Value params, LoadType* loadType, Scoped
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doPathFind (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doPathFind (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("subcommand") || !params["subcommand"].isString ())
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -1404,7 +1404,7 @@ Json::Value RPCHandler::doPathFind (Json::Value params, LoadType* loadType, Scop
|
||||
// - Allows clients to verify path exists.
|
||||
// - Return canonicalized path.
|
||||
// - From a trusted server, allows clients to use path without manipulation.
|
||||
Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
int jc = getApp().getJobQueue ().getJobCountGE (jtCLIENT);
|
||||
|
||||
@@ -1487,7 +1487,7 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType
|
||||
*loadType = LT_RPCBurden;
|
||||
Ledger::pointer lSnapShot = boost::make_shared<Ledger> (boost::ref (*lpLedger), false);
|
||||
|
||||
MasterLockHolder.unlock (); // As long as we have a locked copy of the ledger, we can unlock.
|
||||
masterLockHolder.unlock (); // As long as we have a locked copy of the ledger, we can unlock.
|
||||
|
||||
// Fill in currencies destination will accept
|
||||
Json::Value jvDestCur (Json::arrayValue);
|
||||
@@ -1636,23 +1636,23 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType
|
||||
// tx_json: <object>,
|
||||
// secret: <secret>
|
||||
// }
|
||||
Json::Value RPCHandler::doSign (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doSign (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
*loadType = LT_RPCBurden;
|
||||
bool bFailHard = params.isMember ("fail_hard") && params["fail_hard"].asBool ();
|
||||
return transactionSign (params, false, bFailHard, MasterLockHolder);
|
||||
return transactionSign (params, false, bFailHard, masterLockHolder);
|
||||
}
|
||||
|
||||
// {
|
||||
// tx_json: <object>,
|
||||
// secret: <secret>
|
||||
// }
|
||||
Json::Value RPCHandler::doSubmit (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doSubmit (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("tx_blob"))
|
||||
{
|
||||
bool bFailHard = params.isMember ("fail_hard") && params["fail_hard"].asBool ();
|
||||
return transactionSign (params, true, bFailHard, MasterLockHolder);
|
||||
return transactionSign (params, true, bFailHard, masterLockHolder);
|
||||
}
|
||||
|
||||
Json::Value jvResult;
|
||||
@@ -1710,7 +1710,7 @@ Json::Value RPCHandler::doSubmit (Json::Value params, LoadType* loadType, Scoped
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1740,7 +1740,7 @@ Json::Value RPCHandler::doSubmit (Json::Value params, LoadType* loadType, Scoped
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doConsensusInfo (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doConsensusInfo (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
@@ -1749,7 +1749,7 @@ Json::Value RPCHandler::doConsensusInfo (Json::Value, LoadType* loadType, Scoped
|
||||
return ret;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doServerInfo (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doServerInfo (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
@@ -1758,7 +1758,7 @@ Json::Value RPCHandler::doServerInfo (Json::Value, LoadType* loadType, ScopedLoc
|
||||
return ret;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doServerState (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doServerState (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
@@ -1770,9 +1770,9 @@ Json::Value RPCHandler::doServerState (Json::Value, LoadType* loadType, ScopedLo
|
||||
// {
|
||||
// start: <index>
|
||||
// }
|
||||
Json::Value RPCHandler::doTxHistory (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doTxHistory (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
if (!params.isMember ("start"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -1807,7 +1807,7 @@ Json::Value RPCHandler::doTxHistory (Json::Value params, LoadType* loadType, Sco
|
||||
// {
|
||||
// transaction: <hex>
|
||||
// }
|
||||
Json::Value RPCHandler::doTx (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doTx (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("transaction"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -1873,7 +1873,7 @@ Json::Value RPCHandler::doTx (Json::Value params, LoadType* loadType, ScopedLock
|
||||
return rpcError (rpcNOT_IMPL);
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doLedgerClosed (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLedgerClosed (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value jvResult;
|
||||
|
||||
@@ -1886,7 +1886,7 @@ Json::Value RPCHandler::doLedgerClosed (Json::Value, LoadType* loadType, ScopedL
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doLedgerCurrent (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLedgerCurrent (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value jvResult;
|
||||
|
||||
@@ -1900,7 +1900,7 @@ Json::Value RPCHandler::doLedgerCurrent (Json::Value, LoadType* loadType, Scoped
|
||||
// ledger: 'current' | 'closed' | <uint256> | <number>, // optional
|
||||
// full: true | false // optional, defaults to false.
|
||||
// }
|
||||
Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("ledger") && !params.isMember ("ledger_hash") && !params.isMember ("ledger_index"))
|
||||
{
|
||||
@@ -1922,7 +1922,7 @@ Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, Scoped
|
||||
return jvResult;
|
||||
|
||||
if (lpLedger->isImmutable ())
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
bool bFull = params.isMember ("full") && params["full"].asBool ();
|
||||
bool bTransactions = params.isMember ("transactions") && params["transactions"].asBool ();
|
||||
@@ -1949,7 +1949,7 @@ Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, Scoped
|
||||
// offset: integer, // optional, defaults to 0
|
||||
// limit: integer // optional
|
||||
// }
|
||||
Json::Value RPCHandler::doAccountTransactions (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doAccountTransactions (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
RippleAddress raAccount;
|
||||
uint32 offset = params.isMember ("offset") ? params["offset"].asUInt () : 0;
|
||||
@@ -2018,7 +2018,7 @@ Json::Value RPCHandler::doAccountTransactions (Json::Value params, LoadType* loa
|
||||
try
|
||||
{
|
||||
#endif
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
@@ -2094,7 +2094,7 @@ Json::Value RPCHandler::doAccountTransactions (Json::Value params, LoadType* loa
|
||||
// }
|
||||
//
|
||||
// This command requires admin access because it makes no sense to ask an untrusted server for this.
|
||||
Json::Value RPCHandler::doValidationCreate (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doValidationCreate (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
RippleAddress raSeed;
|
||||
Json::Value obj (Json::objectValue);
|
||||
@@ -2120,7 +2120,7 @@ Json::Value RPCHandler::doValidationCreate (Json::Value params, LoadType* loadTy
|
||||
// {
|
||||
// secret: <string>
|
||||
// }
|
||||
Json::Value RPCHandler::doValidationSeed (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doValidationSeed (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value obj (Json::objectValue);
|
||||
|
||||
@@ -2191,7 +2191,7 @@ Json::Value RPCHandler::accounts (Ledger::ref lrLedger, const RippleAddress& naM
|
||||
// ledger_hash : <ledger>
|
||||
// ledger_index : <ledger_index>
|
||||
// }
|
||||
Json::Value RPCHandler::doWalletAccounts (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doWalletAccounts (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||
@@ -2234,7 +2234,7 @@ Json::Value RPCHandler::doWalletAccounts (Json::Value params, LoadType* loadType
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doLogRotate (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLogRotate (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
return Log::rotateLog ();
|
||||
}
|
||||
@@ -2242,9 +2242,9 @@ Json::Value RPCHandler::doLogRotate (Json::Value, LoadType* loadType, ScopedLock
|
||||
// {
|
||||
// passphrase: <string>
|
||||
// }
|
||||
Json::Value RPCHandler::doWalletPropose (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doWalletPropose (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naAccount;
|
||||
@@ -2274,7 +2274,7 @@ Json::Value RPCHandler::doWalletPropose (Json::Value params, LoadType* loadType,
|
||||
// {
|
||||
// secret: <string>
|
||||
// }
|
||||
Json::Value RPCHandler::doWalletSeed (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doWalletSeed (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
RippleAddress raSeed;
|
||||
bool bSecret = params.isMember ("secret");
|
||||
@@ -2313,7 +2313,7 @@ Json::Value RPCHandler::doWalletSeed (Json::Value params, LoadType* loadType, Sc
|
||||
// username: <string>,
|
||||
// password: <string>
|
||||
// }
|
||||
Json::Value RPCHandler::doLogin (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLogin (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("username")
|
||||
|| !params.isMember ("password"))
|
||||
@@ -2351,7 +2351,7 @@ static void textTime (std::string& text, int& seconds, const char* unitName, int
|
||||
text += "s";
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doFeature (Json::Value params, LoadType* loadType, ScopedLock& mlh)
|
||||
Json::Value RPCHandler::doFeature (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh)
|
||||
{
|
||||
if (!params.isMember ("feature"))
|
||||
{
|
||||
@@ -2380,7 +2380,7 @@ Json::Value RPCHandler::doFeature (Json::Value params, LoadType* loadType, Scope
|
||||
// {
|
||||
// min_count: <number> // optional, defaults to 10
|
||||
// }
|
||||
Json::Value RPCHandler::doGetCounts (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doGetCounts (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
int minCount = 10;
|
||||
|
||||
@@ -2432,7 +2432,7 @@ Json::Value RPCHandler::doGetCounts (Json::Value params, LoadType* loadType, Sco
|
||||
return ret;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
// log_level
|
||||
if (!params.isMember ("severity"))
|
||||
@@ -2485,7 +2485,7 @@ Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, Scop
|
||||
// node: <domain>|<node_public>,
|
||||
// comment: <comment> // optional
|
||||
// }
|
||||
Json::Value RPCHandler::doUnlAdd (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doUnlAdd (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
std::string strNode = params.isMember ("node") ? params["node"].asString () : "";
|
||||
std::string strComment = params.isMember ("comment") ? params["comment"].asString () : "";
|
||||
@@ -2509,7 +2509,7 @@ Json::Value RPCHandler::doUnlAdd (Json::Value params, LoadType* loadType, Scoped
|
||||
// {
|
||||
// node: <domain>|<public_key>
|
||||
// }
|
||||
Json::Value RPCHandler::doUnlDelete (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doUnlDelete (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("node"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -2532,7 +2532,7 @@ Json::Value RPCHandler::doUnlDelete (Json::Value params, LoadType* loadType, Sco
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doUnlList (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doUnlList (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value obj (Json::objectValue);
|
||||
|
||||
@@ -2542,7 +2542,7 @@ Json::Value RPCHandler::doUnlList (Json::Value, LoadType* loadType, ScopedLock&
|
||||
}
|
||||
|
||||
// Populate the UNL from a local validators.txt file.
|
||||
Json::Value RPCHandler::doUnlLoad (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doUnlLoad (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (theConfig.VALIDATORS_FILE.empty () || !getApp().getUNL ().nodeLoad (theConfig.VALIDATORS_FILE))
|
||||
{
|
||||
@@ -2554,7 +2554,7 @@ Json::Value RPCHandler::doUnlLoad (Json::Value, LoadType* loadType, ScopedLock&
|
||||
|
||||
|
||||
// Populate the UNL from ripple.com's validators.txt file.
|
||||
Json::Value RPCHandler::doUnlNetwork (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doUnlNetwork (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
getApp().getUNL ().nodeNetwork ();
|
||||
|
||||
@@ -2562,7 +2562,7 @@ Json::Value RPCHandler::doUnlNetwork (Json::Value params, LoadType* loadType, Sc
|
||||
}
|
||||
|
||||
// unl_reset
|
||||
Json::Value RPCHandler::doUnlReset (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doUnlReset (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
getApp().getUNL ().nodeReset ();
|
||||
|
||||
@@ -2570,14 +2570,14 @@ Json::Value RPCHandler::doUnlReset (Json::Value params, LoadType* loadType, Scop
|
||||
}
|
||||
|
||||
// unl_score
|
||||
Json::Value RPCHandler::doUnlScore (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doUnlScore (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
getApp().getUNL ().nodeScore ();
|
||||
|
||||
return "scoring requested";
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doSMS (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doSMS (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
if (!params.isMember ("text"))
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -2586,14 +2586,14 @@ Json::Value RPCHandler::doSMS (Json::Value params, LoadType* loadType, ScopedLoc
|
||||
|
||||
return "sms dispatched";
|
||||
}
|
||||
Json::Value RPCHandler::doStop (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doStop (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
getApp().stop ();
|
||||
|
||||
return SYSTEM_NAME " server stopping";
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doLedgerAccept (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLedgerAccept (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Json::Value jvResult;
|
||||
|
||||
@@ -2616,7 +2616,7 @@ Json::Value RPCHandler::doLedgerAccept (Json::Value, LoadType* loadType, ScopedL
|
||||
// ledger_index : <ledger_index>
|
||||
// }
|
||||
// XXX In this case, not specify either ledger does not mean ledger current. It means any ledger.
|
||||
Json::Value RPCHandler::doTransactionEntry (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doTransactionEntry (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||
@@ -2785,7 +2785,7 @@ Json::Value RPCHandler::lookupLedger (Json::Value params, Ledger::pointer& lpLed
|
||||
// ledger_index : <ledger_index>
|
||||
// ...
|
||||
// }
|
||||
Json::Value RPCHandler::doLedgerEntry (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLedgerEntry (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||
@@ -2794,7 +2794,7 @@ Json::Value RPCHandler::doLedgerEntry (Json::Value params, LoadType* loadType, S
|
||||
return jvResult;
|
||||
|
||||
if (lpLedger->isImmutable ())
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
uint256 uNodeIndex;
|
||||
bool bNodeBinary = false;
|
||||
@@ -2998,7 +2998,7 @@ Json::Value RPCHandler::doLedgerEntry (Json::Value params, LoadType* loadType, S
|
||||
// ledger_hash : <ledger>
|
||||
// ledger_index : <ledger_index>
|
||||
// }
|
||||
Json::Value RPCHandler::doLedgerHeader (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doLedgerHeader (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||
@@ -3040,7 +3040,7 @@ boost::unordered_set<RippleAddress> RPCHandler::parseAccountIds (const Json::Val
|
||||
return usnaResult;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doSubscribe (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doSubscribe (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
InfoSub::pointer ispSub;
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
@@ -3332,7 +3332,7 @@ Json::Value RPCHandler::doSubscribe (Json::Value params, LoadType* loadType, Sco
|
||||
}
|
||||
|
||||
// FIXME: This leaks RPCSub objects for JSON-RPC. Shouldn't matter for anyone sane.
|
||||
Json::Value RPCHandler::doUnsubscribe (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doUnsubscribe (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
InfoSub::pointer ispSub;
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
@@ -3554,7 +3554,7 @@ Json::Value RPCHandler::doRpcCommand (const std::string& strMethod, Json::Value
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doInternal (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
||||
Json::Value RPCHandler::doInternal (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
// Used for debug or special-purpose RPC commands
|
||||
if (!params.isMember ("internal_command"))
|
||||
@@ -3676,53 +3676,55 @@ Json::Value RPCHandler::doCommand (const Json::Value& params, int iRole, LoadTyp
|
||||
return rpcError (rpcNO_PERMISSION);
|
||||
}
|
||||
|
||||
ScopedLock MasterLockHolder (getApp().getMasterLock ());
|
||||
{
|
||||
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
if ((commandsA[i].iOptions & optNetwork) && (mNetOps->getOperatingMode () < NetworkOPs::omSYNCING))
|
||||
{
|
||||
WriteLog (lsINFO, RPCHandler) << "Insufficient network mode for RPC: " << mNetOps->strOperatingMode ();
|
||||
|
||||
return rpcError (rpcNO_NETWORK);
|
||||
}
|
||||
|
||||
if (!theConfig.RUN_STANDALONE && (commandsA[i].iOptions & optCurrent) && (getApp().getLedgerMaster().getValidatedLedgerAge() > 120))
|
||||
{
|
||||
return rpcError (rpcNO_CURRENT);
|
||||
}
|
||||
else if ((commandsA[i].iOptions & optClosed) && !mNetOps->getClosedLedger ())
|
||||
{
|
||||
return rpcError (rpcNO_CLOSED);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
if ((commandsA[i].iOptions & optNetwork) && (mNetOps->getOperatingMode () < NetworkOPs::omSYNCING))
|
||||
{
|
||||
Json::Value jvRaw = (this->* (commandsA[i].dfpFunc)) (params, loadType, MasterLockHolder);
|
||||
WriteLog (lsINFO, RPCHandler) << "Insufficient network mode for RPC: " << mNetOps->strOperatingMode ();
|
||||
|
||||
// Regularize result.
|
||||
if (jvRaw.isObject ())
|
||||
{
|
||||
// Got an object.
|
||||
return jvRaw;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Probably got a string.
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
|
||||
jvResult["message"] = jvRaw;
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
return rpcError (rpcNO_NETWORK);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
|
||||
if (!theConfig.RUN_STANDALONE && (commandsA[i].iOptions & optCurrent) && (getApp().getLedgerMaster().getValidatedLedgerAge() > 120))
|
||||
{
|
||||
WriteLog (lsINFO, RPCHandler) << "Caught throw: " << e.what ();
|
||||
return rpcError (rpcNO_CURRENT);
|
||||
}
|
||||
else if ((commandsA[i].iOptions & optClosed) && !mNetOps->getClosedLedger ())
|
||||
{
|
||||
return rpcError (rpcNO_CLOSED);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Json::Value jvRaw = (this->* (commandsA[i].dfpFunc)) (params, loadType, lock);
|
||||
|
||||
if (*loadType == LT_RPCReference)
|
||||
*loadType = LT_RPCException;
|
||||
// Regularize result.
|
||||
if (jvRaw.isObject ())
|
||||
{
|
||||
// Got an object.
|
||||
return jvRaw;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Probably got a string.
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
|
||||
return rpcError (rpcINTERNAL);
|
||||
jvResult["message"] = jvRaw;
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
WriteLog (lsINFO, RPCHandler) << "Caught throw: " << e.what ();
|
||||
|
||||
if (*loadType == LT_RPCReference)
|
||||
*loadType = LT_RPCException;
|
||||
|
||||
return rpcError (rpcINTERNAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
typedef Json::Value (RPCHandler::*doFuncPtr) (
|
||||
Json::Value params,
|
||||
LoadType* loadType,
|
||||
ScopedLock& MasterLockHolder);
|
||||
Application::ScopedLockType& MasterLockHolder);
|
||||
|
||||
// VFALCO TODO Document these and give the enumeration a label.
|
||||
enum
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
|
||||
boost::unordered_set <RippleAddress> parseAccountIds (const Json::Value& jvArray);
|
||||
|
||||
Json::Value transactionSign (Json::Value jvRequest, bool bSubmit, bool bFailHard, ScopedLock& mlh);
|
||||
Json::Value transactionSign (Json::Value jvRequest, bool bSubmit, bool bFailHard, Application::ScopedLockType& mlh);
|
||||
|
||||
Json::Value lookupLedger (Json::Value jvRequest, Ledger::pointer& lpLedger);
|
||||
|
||||
@@ -89,70 +89,70 @@ private:
|
||||
const int iIndex,
|
||||
const bool bStrict);
|
||||
|
||||
Json::Value doAccountInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doAccountLines (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doAccountOffers (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doAccountTransactions (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doBookOffers (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doConnect (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doConsensusInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doFeature (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doGetCounts (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doInternal (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLedger (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLedgerAccept (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLedgerClosed (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLedgerCurrent (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLedgerEntry (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLedgerHeader (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLogLevel (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLogRotate (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doNicknameInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doOwnerInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doPathFind (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doPeers (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doPing (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doProfile (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doProofCreate (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doProofSolve (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doProofVerify (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doRandom (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doRipplePathFind (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doSMS (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doServerInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh); // for humans
|
||||
Json::Value doServerState (Json::Value params, LoadType* loadType, ScopedLock& mlh); // for machines
|
||||
Json::Value doSessionClose (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doSessionOpen (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doSign (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doStop (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doSubmit (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doSubscribe (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doTransactionEntry (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doTx (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doTxHistory (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnlAdd (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnlDelete (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnlFetch (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnlList (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnlLoad (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnlNetwork (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnlReset (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnlScore (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doUnsubscribe (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doValidationCreate (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doValidationSeed (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doWalletAccounts (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doWalletLock (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doWalletPropose (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doWalletSeed (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doWalletUnlock (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doWalletVerify (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doAccountInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doAccountLines (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doAccountOffers (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doAccountTransactions (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doBookOffers (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doConnect (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doConsensusInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doFeature (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doGetCounts (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doInternal (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLedger (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLedgerAccept (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLedgerClosed (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLedgerCurrent (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLedgerEntry (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLedgerHeader (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLogLevel (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLogRotate (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doNicknameInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doOwnerInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doPathFind (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doPeers (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doPing (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doProfile (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doProofCreate (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doProofSolve (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doProofVerify (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doRandom (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doRipplePathFind (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doSMS (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doServerInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh); // for humans
|
||||
Json::Value doServerState (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh); // for machines
|
||||
Json::Value doSessionClose (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doSessionOpen (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doSign (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doStop (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doSubmit (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doSubscribe (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doTransactionEntry (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doTx (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doTxHistory (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnlAdd (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnlDelete (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnlFetch (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnlList (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnlLoad (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnlNetwork (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnlReset (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnlScore (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doUnsubscribe (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doValidationCreate (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doValidationSeed (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doWalletAccounts (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doWalletLock (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doWalletPropose (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doWalletSeed (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doWalletUnlock (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doWalletVerify (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
|
||||
#if ENABLE_INSECURE
|
||||
Json::Value doDataDelete (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doDataFetch (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doDataStore (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doLogin (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
||||
Json::Value doDataDelete (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doDataFetch (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doDataStore (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
Json::Value doLogin (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
@@ -43,8 +43,8 @@ public:
|
||||
#endif
|
||||
, mIOService ((theConfig.NODE_SIZE >= 2) ? 2 : 1)
|
||||
, mIOWork (mIOService)
|
||||
, mNetOps (&mLedgerMaster)
|
||||
, m_rpcServerHandler (mNetOps)
|
||||
, mNetOps (new NetworkOPs (&mLedgerMaster))
|
||||
, m_rpcServerHandler (*mNetOps)
|
||||
, mTempNodeCache ("NodeCache", 16384, 90)
|
||||
, m_nodeStore (NodeStore::New (
|
||||
theConfig.NODE_DB,
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
|
||||
~ApplicationImp ()
|
||||
{
|
||||
mNetOps = nullptr;
|
||||
|
||||
// VFALCO TODO Wrap these in ScopedPointer
|
||||
delete mTxnDB;
|
||||
delete mLedgerDB;
|
||||
@@ -97,7 +99,7 @@ public:
|
||||
|
||||
NetworkOPs& getOPs ()
|
||||
{
|
||||
return mNetOps;
|
||||
return *mNetOps;
|
||||
}
|
||||
|
||||
boost::asio::io_service& getIOService ()
|
||||
@@ -135,7 +137,7 @@ public:
|
||||
return mJobQueue;
|
||||
}
|
||||
|
||||
boost::recursive_mutex& getMasterLock ()
|
||||
MasterLockType& getMasterLock ()
|
||||
{
|
||||
return mMasterLock;
|
||||
}
|
||||
@@ -261,13 +263,13 @@ private:
|
||||
//
|
||||
boost::asio::io_service::work mIOWork;
|
||||
|
||||
boost::recursive_mutex mMasterLock;
|
||||
MasterLockType mMasterLock;
|
||||
|
||||
LocalCredentials m_localCredentials;
|
||||
LedgerMaster mLedgerMaster;
|
||||
InboundLedgers m_inboundLedgers;
|
||||
TransactionMaster mMasterTransaction;
|
||||
NetworkOPs mNetOps;
|
||||
ScopedPointer <NetworkOPs> mNetOps;
|
||||
RPCServerHandler m_rpcServerHandler;
|
||||
NodeCache mTempNodeCache;
|
||||
ScopedPointer <NodeStore> m_nodeStore;
|
||||
@@ -441,7 +443,7 @@ void ApplicationImp::setup ()
|
||||
{
|
||||
// This should probably become the default once we have a stable network
|
||||
if (!theConfig.RUN_STANDALONE)
|
||||
mNetOps.needNetworkLedger ();
|
||||
mNetOps->needNetworkLedger ();
|
||||
|
||||
startNewLedger ();
|
||||
}
|
||||
@@ -572,13 +574,13 @@ void ApplicationImp::setup ()
|
||||
{
|
||||
WriteLog (lsWARNING, Application) << "Running in standalone mode";
|
||||
|
||||
mNetOps.setStandAlone ();
|
||||
mNetOps->setStandAlone ();
|
||||
}
|
||||
else
|
||||
{
|
||||
// VFALCO NOTE the state timer resets the deadlock detector.
|
||||
//
|
||||
mNetOps.setStateTimer ();
|
||||
mNetOps->setStateTimer ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,8 +655,8 @@ void ApplicationImp::doSweep(Job& j)
|
||||
mSLECache.sweep ();
|
||||
AcceptedLedger::sweep (); // VFALCO NOTE AcceptedLedger is/has a singleton?
|
||||
SHAMap::sweep (); // VFALCO NOTE SHAMap is/has a singleton?
|
||||
mNetOps.sweepFetchPack ();
|
||||
|
||||
mNetOps->sweepFetchPack ();
|
||||
// VFALCO NOTE does the call to sweep() happen on another thread?
|
||||
mSweepTimer.expires_from_now (boost::posix_time::seconds (theConfig.getSize (siSweepInterval)));
|
||||
mSweepTimer.async_wait (BIND_TYPE (&ApplicationImp::sweep, this));
|
||||
}
|
||||
@@ -685,7 +687,7 @@ void ApplicationImp::startNewLedger ()
|
||||
secondLedger->setAccepted ();
|
||||
mLedgerMaster.pushLedger (secondLedger, boost::make_shared<Ledger> (true, boost::ref (*secondLedger)), false);
|
||||
assert (!!secondLedger->getAccountState (rootAddress));
|
||||
mNetOps.setLastCloseTime (secondLedger->getCloseTimeNC ());
|
||||
mNetOps->setLastCloseTime (secondLedger->getCloseTimeNC ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,7 +755,7 @@ bool ApplicationImp::loadOldLedger (const std::string& l, bool bReplay)
|
||||
Ledger::pointer openLedger = boost::make_shared<Ledger> (false, boost::ref (*loadLedger));
|
||||
mLedgerMaster.switchLedgers (loadLedger, openLedger);
|
||||
mLedgerMaster.forceValid(loadLedger);
|
||||
mNetOps.setLastCloseTime (loadLedger->getCloseTimeNC ());
|
||||
mNetOps->setLastCloseTime (loadLedger->getCloseTimeNC ());
|
||||
|
||||
if (bReplay)
|
||||
{ // inject transaction from replayLedger into consensus set
|
||||
|
||||
@@ -38,8 +38,6 @@ typedef TaggedCache <uint256, SerializedLedgerEntry, UptimeTimerAdapter> SLECach
|
||||
class Application
|
||||
{
|
||||
public:
|
||||
virtual ~Application () { }
|
||||
|
||||
/* VFALCO NOTE
|
||||
|
||||
The master lock protects:
|
||||
@@ -51,7 +49,110 @@ public:
|
||||
|
||||
other things
|
||||
*/
|
||||
virtual boost::recursive_mutex& getMasterLock () = 0;
|
||||
#if 1
|
||||
class ScopedLockType;
|
||||
|
||||
class MasterLockType
|
||||
{
|
||||
public:
|
||||
MasterLockType ()
|
||||
: m_fileName ("")
|
||||
, m_lineNumber (0)
|
||||
{
|
||||
}
|
||||
|
||||
// Note that these are not exactly thread safe.
|
||||
|
||||
char const* getFileName () const noexcept
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
int getLineNumber () const noexcept
|
||||
{
|
||||
return m_lineNumber;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class ScopedLockType;
|
||||
|
||||
void setOwner (char const* fileName, int lineNumber)
|
||||
{
|
||||
m_fileName = fileName;
|
||||
m_lineNumber = lineNumber;
|
||||
}
|
||||
|
||||
void resetOwner ()
|
||||
{
|
||||
m_fileName = "";
|
||||
m_lineNumber = 0;
|
||||
}
|
||||
|
||||
boost::recursive_mutex m_mutex;
|
||||
char const* m_fileName;
|
||||
int m_lineNumber;
|
||||
};
|
||||
|
||||
class ScopedLockType
|
||||
{
|
||||
public:
|
||||
explicit ScopedLockType (MasterLockType& mutex,
|
||||
char const* fileName,
|
||||
int lineNumber)
|
||||
: m_mutex (mutex)
|
||||
, m_lock (mutex.m_mutex)
|
||||
{
|
||||
mutex.setOwner (fileName, lineNumber);
|
||||
}
|
||||
|
||||
~ScopedLockType ()
|
||||
{
|
||||
if (m_lock.owns_lock ())
|
||||
m_mutex.resetOwner ();
|
||||
}
|
||||
|
||||
void unlock ()
|
||||
{
|
||||
if (m_lock.owns_lock ())
|
||||
m_mutex.resetOwner ();
|
||||
|
||||
m_lock.unlock ();
|
||||
}
|
||||
|
||||
private:
|
||||
MasterLockType& m_mutex;
|
||||
boost::recursive_mutex::scoped_lock m_lock;
|
||||
};
|
||||
|
||||
#else
|
||||
typedef boost::recursive_mutex MasterLockType;
|
||||
|
||||
typedef boost::recursive_mutex::scoped_lock ScopedLockType;
|
||||
|
||||
#endif
|
||||
|
||||
virtual MasterLockType& getMasterLock () = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
struct State
|
||||
{
|
||||
// Stuff in here is accessed concurrently and requires a WriteAccess
|
||||
};
|
||||
|
||||
typedef SharedData <State> SharedState;
|
||||
|
||||
SharedState& getSharedState () noexcept { return m_sharedState; }
|
||||
|
||||
SharedState const& getSharedState () const noexcept { return m_sharedState; }
|
||||
|
||||
private:
|
||||
SharedState m_sharedState;
|
||||
|
||||
public:
|
||||
virtual ~Application () { }
|
||||
|
||||
virtual boost::asio::io_service& getIOService () = 0;
|
||||
|
||||
|
||||
@@ -1179,155 +1179,157 @@ void LedgerConsensus::accept (SHAMap::ref set, LoadEvent::pointer)
|
||||
if (set->getHash ().isNonZero ()) // put our set where others can get it later
|
||||
getApp().getOPs ().takePosition (mPreviousLedger->getLedgerSeq (), set);
|
||||
|
||||
boost::recursive_mutex::scoped_lock masterLock (getApp().getMasterLock ());
|
||||
assert (set->getHash () == mOurPosition->getCurrentHash ());
|
||||
|
||||
getApp().getOPs ().peekStoredProposals ().clear (); // these are now obsolete
|
||||
|
||||
uint32 closeTime = roundCloseTime (mOurPosition->getCloseTime ());
|
||||
bool closeTimeCorrect = true;
|
||||
|
||||
if (closeTime == 0)
|
||||
{
|
||||
// we agreed to disagree
|
||||
closeTimeCorrect = false;
|
||||
closeTime = mPreviousLedger->getCloseTimeNC () + 1;
|
||||
}
|
||||
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Report: Prop=" << (mProposing ? "yes" : "no") << " val=" << (mValidating ? "yes" : "no") <<
|
||||
" corLCL=" << (mHaveCorrectLCL ? "yes" : "no") << " fail=" << (mConsensusFail ? "yes" : "no");
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Report: Prev = " << mPrevLedgerHash << ":" << mPreviousLedger->getLedgerSeq ();
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Report: TxSt = " << set->getHash () << ", close " << closeTime << (closeTimeCorrect ? "" : "X");
|
||||
assert (set->getHash () == mOurPosition->getCurrentHash ());
|
||||
|
||||
CanonicalTXSet failedTransactions (set->getHash ());
|
||||
getApp().getOPs ().peekStoredProposals ().clear (); // these are now obsolete
|
||||
|
||||
Ledger::pointer newLCL = boost::make_shared<Ledger> (false, boost::ref (*mPreviousLedger));
|
||||
uint32 closeTime = roundCloseTime (mOurPosition->getCloseTime ());
|
||||
bool closeTimeCorrect = true;
|
||||
|
||||
newLCL->peekTransactionMap ()->armDirty ();
|
||||
newLCL->peekAccountStateMap ()->armDirty ();
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Applying consensus set transactions to the last closed ledger";
|
||||
applyTransactions (set, newLCL, newLCL, failedTransactions, false);
|
||||
newLCL->updateSkipList ();
|
||||
newLCL->setClosed ();
|
||||
boost::shared_ptr<SHAMap::DirtyMap> acctNodes = newLCL->peekAccountStateMap ()->disarmDirty ();
|
||||
boost::shared_ptr<SHAMap::DirtyMap> txnNodes = newLCL->peekTransactionMap ()->disarmDirty ();
|
||||
|
||||
// write out dirty nodes (temporarily done here) Most come before setAccepted
|
||||
int fc;
|
||||
|
||||
while ((fc = SHAMap::flushDirty (*acctNodes, 256, hotACCOUNT_NODE, newLCL->getLedgerSeq ())) > 0)
|
||||
{
|
||||
WriteLog (lsTRACE, LedgerConsensus) << "Flushed " << fc << " dirty state nodes";
|
||||
}
|
||||
|
||||
while ((fc = SHAMap::flushDirty (*txnNodes, 256, hotTRANSACTION_NODE, newLCL->getLedgerSeq ())) > 0)
|
||||
{
|
||||
WriteLog (lsTRACE, LedgerConsensus) << "Flushed " << fc << " dirty transaction nodes";
|
||||
}
|
||||
|
||||
newLCL->setAccepted (closeTime, mCloseResolution, closeTimeCorrect);
|
||||
newLCL->updateHash ();
|
||||
newLCL->setImmutable ();
|
||||
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Report: NewL = " << newLCL->getHash () << ":" << newLCL->getLedgerSeq ();
|
||||
uint256 newLCLHash = newLCL->getHash ();
|
||||
|
||||
if (ShouldLog (lsTRACE, LedgerConsensus))
|
||||
{
|
||||
WriteLog (lsTRACE, LedgerConsensus) << "newLCL";
|
||||
Json::Value p;
|
||||
newLCL->addJson (p, LEDGER_JSON_DUMP_TXRP | LEDGER_JSON_DUMP_STATE);
|
||||
WriteLog (lsTRACE, LedgerConsensus) << p;
|
||||
}
|
||||
|
||||
statusChange (protocol::neACCEPTED_LEDGER, *newLCL);
|
||||
|
||||
if (mValidating && !mConsensusFail)
|
||||
{
|
||||
uint256 signingHash;
|
||||
SerializedValidation::pointer v = boost::make_shared<SerializedValidation>
|
||||
(newLCLHash, getApp().getOPs ().getValidationTimeNC (), mValPublic, mProposing);
|
||||
v->setFieldU32 (sfLedgerSequence, newLCL->getLedgerSeq ());
|
||||
addLoad(v);
|
||||
|
||||
if (((newLCL->getLedgerSeq () + 1) % 256) == 0) // next ledger is flag ledger
|
||||
if (closeTime == 0)
|
||||
{
|
||||
getApp().getFeeVote ().doValidation (newLCL, *v);
|
||||
getApp().getFeatureTable ().doValidation (newLCL, *v);
|
||||
// we agreed to disagree
|
||||
closeTimeCorrect = false;
|
||||
closeTime = mPreviousLedger->getCloseTimeNC () + 1;
|
||||
}
|
||||
|
||||
v->sign (signingHash, mValPrivate);
|
||||
v->setTrusted ();
|
||||
getApp().getHashRouter ().addSuppression (signingHash); // suppress it if we receive it
|
||||
getApp().getValidations ().addValidation (v, "local");
|
||||
getApp().getOPs ().setLastValidation (v);
|
||||
Blob validation = v->getSigned ();
|
||||
protocol::TMValidation val;
|
||||
val.set_validation (&validation[0], validation.size ());
|
||||
int j = getApp().getPeers ().relayMessage (NULL,
|
||||
boost::make_shared<PackedMessage> (val, protocol::mtVALIDATION));
|
||||
WriteLog (lsINFO, LedgerConsensus) << "CNF Val " << newLCLHash << " to " << j << " peers";
|
||||
}
|
||||
else
|
||||
WriteLog (lsINFO, LedgerConsensus) << "CNF newLCL " << newLCLHash;
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Report: Prop=" << (mProposing ? "yes" : "no") << " val=" << (mValidating ? "yes" : "no") <<
|
||||
" corLCL=" << (mHaveCorrectLCL ? "yes" : "no") << " fail=" << (mConsensusFail ? "yes" : "no");
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Report: Prev = " << mPrevLedgerHash << ":" << mPreviousLedger->getLedgerSeq ();
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Report: TxSt = " << set->getHash () << ", close " << closeTime << (closeTimeCorrect ? "" : "X");
|
||||
|
||||
Ledger::pointer newOL = boost::make_shared<Ledger> (true, boost::ref (*newLCL));
|
||||
ScopedLock sl ( getApp().getLedgerMaster ().getLock ());
|
||||
CanonicalTXSet failedTransactions (set->getHash ());
|
||||
|
||||
// Apply disputed transactions that didn't get in
|
||||
TransactionEngine engine (newOL);
|
||||
BOOST_FOREACH (u256_lct_pair & it, mDisputes)
|
||||
{
|
||||
if (!it.second->getOurVote ())
|
||||
Ledger::pointer newLCL = boost::make_shared<Ledger> (false, boost::ref (*mPreviousLedger));
|
||||
|
||||
newLCL->peekTransactionMap ()->armDirty ();
|
||||
newLCL->peekAccountStateMap ()->armDirty ();
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Applying consensus set transactions to the last closed ledger";
|
||||
applyTransactions (set, newLCL, newLCL, failedTransactions, false);
|
||||
newLCL->updateSkipList ();
|
||||
newLCL->setClosed ();
|
||||
boost::shared_ptr<SHAMap::DirtyMap> acctNodes = newLCL->peekAccountStateMap ()->disarmDirty ();
|
||||
boost::shared_ptr<SHAMap::DirtyMap> txnNodes = newLCL->peekTransactionMap ()->disarmDirty ();
|
||||
|
||||
// write out dirty nodes (temporarily done here) Most come before setAccepted
|
||||
int fc;
|
||||
|
||||
while ((fc = SHAMap::flushDirty (*acctNodes, 256, hotACCOUNT_NODE, newLCL->getLedgerSeq ())) > 0)
|
||||
{
|
||||
// we voted NO
|
||||
try
|
||||
{
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Test applying disputed transaction that did not get in";
|
||||
SerializerIterator sit (it.second->peekTransaction ());
|
||||
SerializedTransaction::pointer txn = boost::make_shared<SerializedTransaction> (boost::ref (sit));
|
||||
WriteLog (lsTRACE, LedgerConsensus) << "Flushed " << fc << " dirty state nodes";
|
||||
}
|
||||
|
||||
if (applyTransaction (engine, txn, newOL, true, false))
|
||||
failedTransactions.push_back (txn);
|
||||
}
|
||||
catch (...)
|
||||
while ((fc = SHAMap::flushDirty (*txnNodes, 256, hotTRANSACTION_NODE, newLCL->getLedgerSeq ())) > 0)
|
||||
{
|
||||
WriteLog (lsTRACE, LedgerConsensus) << "Flushed " << fc << " dirty transaction nodes";
|
||||
}
|
||||
|
||||
newLCL->setAccepted (closeTime, mCloseResolution, closeTimeCorrect);
|
||||
newLCL->updateHash ();
|
||||
newLCL->setImmutable ();
|
||||
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Report: NewL = " << newLCL->getHash () << ":" << newLCL->getLedgerSeq ();
|
||||
uint256 newLCLHash = newLCL->getHash ();
|
||||
|
||||
if (ShouldLog (lsTRACE, LedgerConsensus))
|
||||
{
|
||||
WriteLog (lsTRACE, LedgerConsensus) << "newLCL";
|
||||
Json::Value p;
|
||||
newLCL->addJson (p, LEDGER_JSON_DUMP_TXRP | LEDGER_JSON_DUMP_STATE);
|
||||
WriteLog (lsTRACE, LedgerConsensus) << p;
|
||||
}
|
||||
|
||||
statusChange (protocol::neACCEPTED_LEDGER, *newLCL);
|
||||
|
||||
if (mValidating && !mConsensusFail)
|
||||
{
|
||||
uint256 signingHash;
|
||||
SerializedValidation::pointer v = boost::make_shared<SerializedValidation>
|
||||
(newLCLHash, getApp().getOPs ().getValidationTimeNC (), mValPublic, mProposing);
|
||||
v->setFieldU32 (sfLedgerSequence, newLCL->getLedgerSeq ());
|
||||
addLoad(v);
|
||||
|
||||
if (((newLCL->getLedgerSeq () + 1) % 256) == 0) // next ledger is flag ledger
|
||||
{
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Failed to apply transaction we voted NO on";
|
||||
getApp().getFeeVote ().doValidation (newLCL, *v);
|
||||
getApp().getFeatureTable ().doValidation (newLCL, *v);
|
||||
}
|
||||
|
||||
v->sign (signingHash, mValPrivate);
|
||||
v->setTrusted ();
|
||||
getApp().getHashRouter ().addSuppression (signingHash); // suppress it if we receive it
|
||||
getApp().getValidations ().addValidation (v, "local");
|
||||
getApp().getOPs ().setLastValidation (v);
|
||||
Blob validation = v->getSigned ();
|
||||
protocol::TMValidation val;
|
||||
val.set_validation (&validation[0], validation.size ());
|
||||
int j = getApp().getPeers ().relayMessage (NULL,
|
||||
boost::make_shared<PackedMessage> (val, protocol::mtVALIDATION));
|
||||
WriteLog (lsINFO, LedgerConsensus) << "CNF Val " << newLCLHash << " to " << j << " peers";
|
||||
}
|
||||
else
|
||||
WriteLog (lsINFO, LedgerConsensus) << "CNF newLCL " << newLCLHash;
|
||||
|
||||
Ledger::pointer newOL = boost::make_shared<Ledger> (true, boost::ref (*newLCL));
|
||||
ScopedLock sl ( getApp().getLedgerMaster ().getLock ());
|
||||
|
||||
// Apply disputed transactions that didn't get in
|
||||
TransactionEngine engine (newOL);
|
||||
BOOST_FOREACH (u256_lct_pair & it, mDisputes)
|
||||
{
|
||||
if (!it.second->getOurVote ())
|
||||
{
|
||||
// we voted NO
|
||||
try
|
||||
{
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Test applying disputed transaction that did not get in";
|
||||
SerializerIterator sit (it.second->peekTransaction ());
|
||||
SerializedTransaction::pointer txn = boost::make_shared<SerializedTransaction> (boost::ref (sit));
|
||||
|
||||
if (applyTransaction (engine, txn, newOL, true, false))
|
||||
failedTransactions.push_back (txn);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Failed to apply transaction we voted NO on";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Applying transactions from current open ledger";
|
||||
applyTransactions (getApp().getLedgerMaster ().getCurrentLedger ()->peekTransactionMap (), newOL, newLCL,
|
||||
failedTransactions, true);
|
||||
getApp().getLedgerMaster ().pushLedger (newLCL, newOL, !mConsensusFail);
|
||||
mNewLedgerHash = newLCL->getHash ();
|
||||
mState = lcsACCEPTED;
|
||||
sl.unlock ();
|
||||
WriteLog (lsDEBUG, LedgerConsensus) << "Applying transactions from current open ledger";
|
||||
applyTransactions (getApp().getLedgerMaster ().getCurrentLedger ()->peekTransactionMap (), newOL, newLCL,
|
||||
failedTransactions, true);
|
||||
getApp().getLedgerMaster ().pushLedger (newLCL, newOL, !mConsensusFail);
|
||||
mNewLedgerHash = newLCL->getHash ();
|
||||
mState = lcsACCEPTED;
|
||||
sl.unlock ();
|
||||
|
||||
if (mValidating)
|
||||
{
|
||||
// see how close our close time is to other node's close time reports
|
||||
WriteLog (lsINFO, LedgerConsensus) << "We closed at " << boost::lexical_cast<std::string> (mCloseTime);
|
||||
uint64 closeTotal = mCloseTime;
|
||||
int closeCount = 1;
|
||||
|
||||
for (std::map<uint32, int>::iterator it = mCloseTimes.begin (), end = mCloseTimes.end (); it != end; ++it)
|
||||
if (mValidating)
|
||||
{
|
||||
// FIXME: Use median, not average
|
||||
WriteLog (lsINFO, LedgerConsensus) << boost::lexical_cast<std::string> (it->second) << " time votes for "
|
||||
<< boost::lexical_cast<std::string> (it->first);
|
||||
closeCount += it->second;
|
||||
closeTotal += static_cast<uint64> (it->first) * static_cast<uint64> (it->second);
|
||||
// see how close our close time is to other node's close time reports
|
||||
WriteLog (lsINFO, LedgerConsensus) << "We closed at " << boost::lexical_cast<std::string> (mCloseTime);
|
||||
uint64 closeTotal = mCloseTime;
|
||||
int closeCount = 1;
|
||||
|
||||
for (std::map<uint32, int>::iterator it = mCloseTimes.begin (), end = mCloseTimes.end (); it != end; ++it)
|
||||
{
|
||||
// FIXME: Use median, not average
|
||||
WriteLog (lsINFO, LedgerConsensus) << boost::lexical_cast<std::string> (it->second) << " time votes for "
|
||||
<< boost::lexical_cast<std::string> (it->first);
|
||||
closeCount += it->second;
|
||||
closeTotal += static_cast<uint64> (it->first) * static_cast<uint64> (it->second);
|
||||
}
|
||||
|
||||
closeTotal += (closeCount / 2);
|
||||
closeTotal /= closeCount;
|
||||
int offset = static_cast<int> (closeTotal) - static_cast<int> (mCloseTime);
|
||||
WriteLog (lsINFO, LedgerConsensus) << "Our close offset is estimated at " << offset << " (" << closeCount << ")";
|
||||
getApp().getOPs ().closeTimeOffset (offset);
|
||||
}
|
||||
|
||||
closeTotal += (closeCount / 2);
|
||||
closeTotal /= closeCount;
|
||||
int offset = static_cast<int> (closeTotal) - static_cast<int> (mCloseTime);
|
||||
WriteLog (lsINFO, LedgerConsensus) << "Our close offset is estimated at " << offset << " (" << closeCount << ")";
|
||||
getApp().getOPs ().closeTimeOffset (offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LedgerConsensus::endConsensus ()
|
||||
|
||||
@@ -250,6 +250,11 @@ private:
|
||||
static void logDeadlock (int dlTime)
|
||||
{
|
||||
WriteLog (lsWARNING, LoadManager) << "Server stalled for " << dlTime << " seconds.";
|
||||
|
||||
char const* fileName = getApp ().getMasterLock ().getFileName ();
|
||||
int lineNumber = getApp ().getMasterLock ().getLineNumber ();
|
||||
|
||||
WriteLog (lsWARNING, LoadManager) << "Master lock owned by " << File (fileName).getFileName ().toStdString () << ", line " << lineNumber;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -165,12 +165,12 @@ private:
|
||||
|
||||
void recvHello (protocol::TMHello & packet);
|
||||
void recvCluster (protocol::TMCluster & packet);
|
||||
void recvTransaction (protocol::TMTransaction & packet, ScopedLock & MasterLockHolder);
|
||||
void recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet, ScopedLock & MasterLockHolder);
|
||||
void recvTransaction (protocol::TMTransaction & packet, Application::ScopedLockType& masterLockHolder);
|
||||
void recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet, Application::ScopedLockType& masterLockHolder);
|
||||
void recvGetValidation (protocol::TMGetValidations & packet);
|
||||
void recvContact (protocol::TMContact & packet);
|
||||
void recvGetContacts (protocol::TMGetContacts & packet);
|
||||
void recvGetPeers (protocol::TMGetPeers & packet, ScopedLock & MasterLockHolder);
|
||||
void recvGetPeers (protocol::TMGetPeers & packet, Application::ScopedLockType& masterLockHolder);
|
||||
void recvPeers (protocol::TMPeers & packet);
|
||||
void recvGetObjectByHash (const boost::shared_ptr<protocol::TMGetObjectByHash>& packet);
|
||||
void recvPing (protocol::TMPing & packet);
|
||||
@@ -178,8 +178,8 @@ private:
|
||||
void recvSearchTransaction (protocol::TMSearchTransaction & packet);
|
||||
void recvGetAccount (protocol::TMGetAccount & packet);
|
||||
void recvAccount (protocol::TMAccount & packet);
|
||||
void recvGetLedger (protocol::TMGetLedger & packet, ScopedLock & MasterLockHolder);
|
||||
void recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packet, ScopedLock & MasterLockHolder);
|
||||
void recvGetLedger (protocol::TMGetLedger & packet, Application::ScopedLockType& masterLockHolder);
|
||||
void recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packet, Application::ScopedLockType& masterLockHolder);
|
||||
void recvStatus (protocol::TMStatusChange & packet);
|
||||
void recvPropose (const boost::shared_ptr<protocol::TMProposeSet>& packet);
|
||||
void recvHaveTxSet (protocol::TMHaveTransactionSet & packet);
|
||||
@@ -630,8 +630,11 @@ void PeerImp::handleReadBody (const boost::system::error_code& error)
|
||||
WriteLog (lsINFO, Peer) << "Peer: Body: Error: " << getIP () << ": " << error.category ().name () << ": " << error.message () << ": " << error;
|
||||
}
|
||||
|
||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
||||
detach ("hrb", true);
|
||||
{
|
||||
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
detach ("hrb", true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -651,276 +654,278 @@ void PeerImp::processReadBuffer ()
|
||||
|
||||
LoadEvent::autoptr event (getApp().getJobQueue ().getLoadEventAP (jtPEER, "PeerImp::read"));
|
||||
|
||||
ScopedLock sl (getApp().getMasterLock ());
|
||||
|
||||
// If connected and get a mtHELLO or if not connected and get a non-mtHELLO, wrong message was sent.
|
||||
if (mHelloed == (type == protocol::mtHELLO))
|
||||
{
|
||||
WriteLog (lsWARNING, Peer) << "Wrong message type: " << type;
|
||||
detach ("prb1", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case protocol::mtHELLO:
|
||||
{
|
||||
event->reName ("PeerImp::hello");
|
||||
protocol::TMHello msg;
|
||||
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvHello (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
// If connected and get a mtHELLO or if not connected and get a non-mtHELLO, wrong message was sent.
|
||||
if (mHelloed == (type == protocol::mtHELLO))
|
||||
{
|
||||
WriteLog (lsWARNING, Peer) << "Wrong message type: " << type;
|
||||
detach ("prb1", true);
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtCLUSTER:
|
||||
else
|
||||
{
|
||||
event->reName ("PeerImp::cluster");
|
||||
protocol::TMCluster msg;
|
||||
switch (type)
|
||||
{
|
||||
case protocol::mtHELLO:
|
||||
{
|
||||
event->reName ("PeerImp::hello");
|
||||
protocol::TMHello msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvCluster (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvHello (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtERROR_MSG:
|
||||
{
|
||||
event->reName ("PeerImp::errormessage");
|
||||
protocol::TMErrorMsg msg;
|
||||
case protocol::mtCLUSTER:
|
||||
{
|
||||
event->reName ("PeerImp::cluster");
|
||||
protocol::TMCluster msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvErrorMessage (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvCluster (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
|
||||
case protocol::mtPING:
|
||||
{
|
||||
event->reName ("PeerImp::ping");
|
||||
protocol::TMPing msg;
|
||||
case protocol::mtERROR_MSG:
|
||||
{
|
||||
event->reName ("PeerImp::errormessage");
|
||||
protocol::TMErrorMsg msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvPing (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvErrorMessage (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtGET_CONTACTS:
|
||||
{
|
||||
event->reName ("PeerImp::getcontacts");
|
||||
protocol::TMGetContacts msg;
|
||||
case protocol::mtPING:
|
||||
{
|
||||
event->reName ("PeerImp::ping");
|
||||
protocol::TMPing msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetContacts (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvPing (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtCONTACT:
|
||||
{
|
||||
event->reName ("PeerImp::contact");
|
||||
protocol::TMContact msg;
|
||||
case protocol::mtGET_CONTACTS:
|
||||
{
|
||||
event->reName ("PeerImp::getcontacts");
|
||||
protocol::TMGetContacts msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvContact (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetContacts (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtGET_PEERS:
|
||||
{
|
||||
event->reName ("PeerImp::getpeers");
|
||||
protocol::TMGetPeers msg;
|
||||
case protocol::mtCONTACT:
|
||||
{
|
||||
event->reName ("PeerImp::contact");
|
||||
protocol::TMContact msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetPeers (msg, sl);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvContact (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtPEERS:
|
||||
{
|
||||
event->reName ("PeerImp::peers");
|
||||
protocol::TMPeers msg;
|
||||
case protocol::mtGET_PEERS:
|
||||
{
|
||||
event->reName ("PeerImp::getpeers");
|
||||
protocol::TMGetPeers msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvPeers (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetPeers (msg, lock);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtSEARCH_TRANSACTION:
|
||||
{
|
||||
event->reName ("PeerImp::searchtransaction");
|
||||
protocol::TMSearchTransaction msg;
|
||||
case protocol::mtPEERS:
|
||||
{
|
||||
event->reName ("PeerImp::peers");
|
||||
protocol::TMPeers msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvSearchTransaction (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvPeers (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtGET_ACCOUNT:
|
||||
{
|
||||
event->reName ("PeerImp::getaccount");
|
||||
protocol::TMGetAccount msg;
|
||||
case protocol::mtSEARCH_TRANSACTION:
|
||||
{
|
||||
event->reName ("PeerImp::searchtransaction");
|
||||
protocol::TMSearchTransaction msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetAccount (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvSearchTransaction (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtACCOUNT:
|
||||
{
|
||||
event->reName ("PeerImp::account");
|
||||
protocol::TMAccount msg;
|
||||
case protocol::mtGET_ACCOUNT:
|
||||
{
|
||||
event->reName ("PeerImp::getaccount");
|
||||
protocol::TMGetAccount msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvAccount (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetAccount (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtTRANSACTION:
|
||||
{
|
||||
event->reName ("PeerImp::transaction");
|
||||
protocol::TMTransaction msg;
|
||||
case protocol::mtACCOUNT:
|
||||
{
|
||||
event->reName ("PeerImp::account");
|
||||
protocol::TMAccount msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvTransaction (msg, sl);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvAccount (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtSTATUS_CHANGE:
|
||||
{
|
||||
event->reName ("PeerImp::statuschange");
|
||||
protocol::TMStatusChange msg;
|
||||
case protocol::mtTRANSACTION:
|
||||
{
|
||||
event->reName ("PeerImp::transaction");
|
||||
protocol::TMTransaction msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvStatus (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvTransaction (msg, lock);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtPROPOSE_LEDGER:
|
||||
{
|
||||
event->reName ("PeerImp::propose");
|
||||
boost::shared_ptr<protocol::TMProposeSet> msg = boost::make_shared<protocol::TMProposeSet> ();
|
||||
case protocol::mtSTATUS_CHANGE:
|
||||
{
|
||||
event->reName ("PeerImp::statuschange");
|
||||
protocol::TMStatusChange msg;
|
||||
|
||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvPropose (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvStatus (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtGET_LEDGER:
|
||||
{
|
||||
event->reName ("PeerImp::getledger");
|
||||
protocol::TMGetLedger msg;
|
||||
case protocol::mtPROPOSE_LEDGER:
|
||||
{
|
||||
event->reName ("PeerImp::propose");
|
||||
boost::shared_ptr<protocol::TMProposeSet> msg = boost::make_shared<protocol::TMProposeSet> ();
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetLedger (msg, sl);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvPropose (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtLEDGER_DATA:
|
||||
{
|
||||
event->reName ("PeerImp::ledgerdata");
|
||||
boost::shared_ptr<protocol::TMLedgerData> msg = boost::make_shared<protocol::TMLedgerData> ();
|
||||
case protocol::mtGET_LEDGER:
|
||||
{
|
||||
event->reName ("PeerImp::getledger");
|
||||
protocol::TMGetLedger msg;
|
||||
|
||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvLedger (msg, sl);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetLedger (msg, lock);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtHAVE_SET:
|
||||
{
|
||||
event->reName ("PeerImp::haveset");
|
||||
protocol::TMHaveTransactionSet msg;
|
||||
case protocol::mtLEDGER_DATA:
|
||||
{
|
||||
event->reName ("PeerImp::ledgerdata");
|
||||
boost::shared_ptr<protocol::TMLedgerData> msg = boost::make_shared<protocol::TMLedgerData> ();
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvHaveTxSet (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvLedger (msg, lock);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtVALIDATION:
|
||||
{
|
||||
event->reName ("PeerImp::validation");
|
||||
boost::shared_ptr<protocol::TMValidation> msg = boost::make_shared<protocol::TMValidation> ();
|
||||
case protocol::mtHAVE_SET:
|
||||
{
|
||||
event->reName ("PeerImp::haveset");
|
||||
protocol::TMHaveTransactionSet msg;
|
||||
|
||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvValidation (msg, sl);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvHaveTxSet (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtGET_VALIDATION:
|
||||
{
|
||||
protocol::TM msg;
|
||||
case protocol::mtVALIDATION:
|
||||
{
|
||||
event->reName ("PeerImp::validation");
|
||||
boost::shared_ptr<protocol::TMValidation> msg = boost::make_shared<protocol::TMValidation> ();
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recv (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvValidation (msg, lock);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
|
||||
#endif
|
||||
case protocol::mtGET_VALIDATION:
|
||||
{
|
||||
protocol::TM msg;
|
||||
|
||||
case protocol::mtGET_OBJECTS:
|
||||
{
|
||||
event->reName ("PeerImp::getobjects");
|
||||
boost::shared_ptr<protocol::TMGetObjectByHash> msg = boost::make_shared<protocol::TMGetObjectByHash> ();
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recv (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetObjectByHash (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case protocol::mtPROOFOFWORK:
|
||||
{
|
||||
event->reName ("PeerImp::proofofwork");
|
||||
protocol::TMProofWork msg;
|
||||
case protocol::mtGET_OBJECTS:
|
||||
{
|
||||
event->reName ("PeerImp::getobjects");
|
||||
boost::shared_ptr<protocol::TMGetObjectByHash> msg = boost::make_shared<protocol::TMGetObjectByHash> ();
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvProofWork (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvGetObjectByHash (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case protocol::mtPROOFOFWORK:
|
||||
{
|
||||
event->reName ("PeerImp::proofofwork");
|
||||
protocol::TMProofWork msg;
|
||||
|
||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||
recvProofWork (msg);
|
||||
else
|
||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
event->reName ("PeerImp::unknown");
|
||||
WriteLog (lsWARNING, Peer) << "Unknown Msg: " << type;
|
||||
WriteLog (lsWARNING, Peer) << strHex (&mReadbuf[0], mReadbuf.size ());
|
||||
default:
|
||||
event->reName ("PeerImp::unknown");
|
||||
WriteLog (lsWARNING, Peer) << "Unknown Msg: " << type;
|
||||
WriteLog (lsWARNING, Peer) << strHex (&mReadbuf[0], mReadbuf.size ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1111,9 +1116,9 @@ static void checkTransaction (Job&, int flags, SerializedTransaction::pointer st
|
||||
#endif
|
||||
}
|
||||
|
||||
void PeerImp::recvTransaction (protocol::TMTransaction& packet, ScopedLock& MasterLockHolder)
|
||||
void PeerImp::recvTransaction (protocol::TMTransaction& packet, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
Transaction::pointer tx;
|
||||
#ifndef TRUST_NETWORK
|
||||
|
||||
@@ -1375,9 +1380,9 @@ static void checkValidation (Job&, SerializedValidation::pointer val, uint256 si
|
||||
#endif
|
||||
}
|
||||
|
||||
void PeerImp::recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet, ScopedLock& MasterLockHolder)
|
||||
void PeerImp::recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
|
||||
if (packet->validation ().size () < 50)
|
||||
{
|
||||
@@ -1463,9 +1468,9 @@ void PeerImp::recvGetContacts (protocol::TMGetContacts& packet)
|
||||
// Return a list of your favorite people
|
||||
// TODO: filter out all the LAN peers
|
||||
// TODO: filter out the peer you are talking to
|
||||
void PeerImp::recvGetPeers (protocol::TMGetPeers& packet, ScopedLock& MasterLockHolder)
|
||||
void PeerImp::recvGetPeers (protocol::TMGetPeers& packet, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
std::vector<std::string> addrs;
|
||||
|
||||
getApp().getPeers ().getTopNAddrs (30, addrs);
|
||||
@@ -1779,7 +1784,7 @@ void PeerImp::recvStatus (protocol::TMStatusChange& packet)
|
||||
mMaxLedger = packet.lastseq ();
|
||||
}
|
||||
|
||||
void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, ScopedLock& MasterLockHolder)
|
||||
void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
SHAMap::pointer map;
|
||||
protocol::TMLedgerData reply;
|
||||
@@ -1929,7 +1934,7 @@ void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, ScopedLock& MasterLo
|
||||
}
|
||||
|
||||
if (ledger->isImmutable ())
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
else
|
||||
{
|
||||
WriteLog (lsWARNING, Peer) << "Request for data from mutable ledger";
|
||||
@@ -2063,9 +2068,9 @@ void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, ScopedLock& MasterLo
|
||||
sendPacket (oPacket, true);
|
||||
}
|
||||
|
||||
void PeerImp::recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packet_ptr, ScopedLock& MasterLockHolder)
|
||||
void PeerImp::recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packet_ptr, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
MasterLockHolder.unlock ();
|
||||
masterLockHolder.unlock ();
|
||||
protocol::TMLedgerData& packet = *packet_ptr;
|
||||
|
||||
if (packet.nodes ().size () <= 0)
|
||||
|
||||
@@ -822,6 +822,10 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternalNT (const SHAMapNode& id, uint2
|
||||
if (!getApp().running ())
|
||||
return ret;
|
||||
|
||||
// These are for diagnosing a crash on exit
|
||||
Application& app (getApp ());
|
||||
NodeStore& nodeStore (app.getNodeStore ());
|
||||
|
||||
NodeObject::pointer obj (getApp().getNodeStore ().retrieve (hash));
|
||||
|
||||
if (!obj)
|
||||
|
||||
@@ -18,9 +18,13 @@ TransactionAcquire::TransactionAcquire (uint256 const& hash) : PeerSet (hash, TX
|
||||
|
||||
static void TACompletionHandler (uint256 hash, SHAMap::pointer map)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
||||
getApp().getOPs ().mapComplete (hash, map);
|
||||
getApp().getInboundLedgers ().dropLedger (hash);
|
||||
{
|
||||
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
getApp().getOPs ().mapComplete (hash, map);
|
||||
|
||||
getApp().getInboundLedgers ().dropLedger (hash);
|
||||
}
|
||||
}
|
||||
|
||||
void TransactionAcquire::done ()
|
||||
@@ -50,7 +54,7 @@ void TransactionAcquire::onTimer (bool progress)
|
||||
{
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Ten timeouts on TX set " << getHash ();
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
||||
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
if (getApp().getOPs ().stillNeedTXSet (mHash))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user