mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 06:25:51 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -38,7 +38,7 @@ DatabaseCon::~DatabaseCon()
|
||||
}
|
||||
|
||||
Application::Application() :
|
||||
mIOWork(mIOService), mAuxWork(mAuxService), mUNL(mIOService), mNetOps(mIOService, &mMasterLedger),
|
||||
mIOWork(mIOService), mAuxWork(mAuxService), mUNL(mIOService), mNetOps(mIOService, &mLedgerMaster),
|
||||
mTempNodeCache("NodeCache", 16384, 90), mHashedObjectStore(16384, 300),
|
||||
mSNTPClient(mAuxService), mRPCHandler(&mNetOps),
|
||||
mRpcDB(NULL), mTxnDB(NULL), mLedgerDB(NULL), mWalletDB(NULL), mHashNodeDB(NULL), mNetNodeDB(NULL),
|
||||
@@ -122,7 +122,7 @@ void Application::run()
|
||||
{
|
||||
Ledger::pointer ledger = Ledger::getLastFullLedger();
|
||||
if (ledger)
|
||||
mMasterLedger.setLedgerRangePresent(0, ledger->getLedgerSeq());
|
||||
mLedgerMaster.setLedgerRangePresent(0, ledger->getLedgerSeq());
|
||||
}
|
||||
|
||||
//
|
||||
@@ -216,7 +216,7 @@ void Application::sweep()
|
||||
{
|
||||
mMasterTransaction.sweep();
|
||||
mHashedObjectStore.sweep();
|
||||
mMasterLedger.sweep();
|
||||
mLedgerMaster.sweep();
|
||||
mTempNodeCache.sweep();
|
||||
mValidations.sweep();
|
||||
mSweepTimer.expires_from_now(boost::posix_time::seconds(60));
|
||||
@@ -249,12 +249,12 @@ void Application::startNewLedger()
|
||||
firstLedger->updateHash();
|
||||
firstLedger->setClosed();
|
||||
firstLedger->setAccepted();
|
||||
mMasterLedger.pushLedger(firstLedger);
|
||||
mLedgerMaster.pushLedger(firstLedger);
|
||||
|
||||
Ledger::pointer secondLedger = boost::make_shared<Ledger>(true, boost::ref(*firstLedger));
|
||||
secondLedger->setClosed();
|
||||
secondLedger->setAccepted();
|
||||
mMasterLedger.pushLedger(secondLedger, boost::make_shared<Ledger>(true, boost::ref(*secondLedger)), false);
|
||||
mLedgerMaster.pushLedger(secondLedger, boost::make_shared<Ledger>(true, boost::ref(*secondLedger)), false);
|
||||
assert(!!secondLedger->getAccountState(rootAddress));
|
||||
mNetOps.setLastCloseTime(secondLedger->getCloseTimeNC());
|
||||
}
|
||||
@@ -293,10 +293,10 @@ void Application::loadOldLedger()
|
||||
cLog(lsFATAL) << "Ledger is not sane.";
|
||||
exit(-1);
|
||||
}
|
||||
mMasterLedger.setLedgerRangePresent(0, lastLedger->getLedgerSeq());
|
||||
mLedgerMaster.setLedgerRangePresent(0, lastLedger->getLedgerSeq());
|
||||
|
||||
Ledger::pointer openLedger = boost::make_shared<Ledger>(false, boost::ref(*lastLedger));
|
||||
mMasterLedger.switchLedgers(lastLedger, openLedger);
|
||||
mLedgerMaster.switchLedgers(lastLedger, openLedger);
|
||||
mNetOps.setLastCloseTime(lastLedger->getCloseTimeNC());
|
||||
}
|
||||
catch (SHAMapMissingNode& mn)
|
||||
|
||||
@@ -47,7 +47,7 @@ class Application
|
||||
|
||||
Wallet mWallet;
|
||||
UniqueNodeList mUNL;
|
||||
LedgerMaster mMasterLedger;
|
||||
LedgerMaster mLedgerMaster;
|
||||
LedgerAcquireMaster mMasterLedgerAcquire;
|
||||
TransactionMaster mMasterTransaction;
|
||||
NetworkOPs mNetOps;
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
boost::asio::io_service& getIOService() { return mIOService; }
|
||||
boost::asio::io_service& getAuxService() { return mAuxService; }
|
||||
|
||||
LedgerMaster& getMasterLedger() { return mMasterLedger; }
|
||||
LedgerMaster& getLedgerMaster() { return mLedgerMaster; }
|
||||
LedgerAcquireMaster& getMasterLedgerAcquire() { return mMasterLedgerAcquire; }
|
||||
TransactionMaster& getMasterTransaction() { return mMasterTransaction; }
|
||||
NodeCache& getTempNodeCache() { return mTempNodeCache; }
|
||||
|
||||
@@ -438,7 +438,7 @@ void Ledger::saveAcceptedLedger(bool fromConsensus)
|
||||
return;
|
||||
}
|
||||
|
||||
theApp->getMasterLedger().setFullLedger(shared_from_this());
|
||||
theApp->getLedgerMaster().setFullLedger(shared_from_this());
|
||||
event = LoadEvent::pointer();
|
||||
|
||||
theApp->getOPs().pubLedger(shared_from_this());
|
||||
|
||||
@@ -176,7 +176,7 @@ void LedgerAcquire::done()
|
||||
{
|
||||
if (mAccept)
|
||||
mLedger->setAccepted();
|
||||
theApp->getMasterLedger().storeLedger(mLedger);
|
||||
theApp->getLedgerMaster().storeLedger(mLedger);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < triggers.size(); ++i)
|
||||
|
||||
@@ -407,7 +407,7 @@ void LedgerConsensus::handleLCL(const uint256& lclHash)
|
||||
|
||||
if (mPreviousLedger->getHash() != mPrevLedgerHash)
|
||||
{ // we need to switch the ledger we're working from
|
||||
Ledger::pointer newLCL = theApp->getMasterLedger().getLedgerByHash(lclHash);
|
||||
Ledger::pointer newLCL = theApp->getLedgerMaster().getLedgerByHash(lclHash);
|
||||
if (newLCL)
|
||||
mPreviousLedger = newLCL;
|
||||
else if (!mAcquiringLedger || (mAcquiringLedger->getHash() != mPrevLedgerHash))
|
||||
@@ -578,7 +578,7 @@ int LedgerConsensus::startup()
|
||||
|
||||
void LedgerConsensus::statePreClose()
|
||||
{ // it is shortly before ledger close time
|
||||
bool anyTransactions = theApp->getMasterLedger().getCurrentLedger()->peekTransactionMap()->getHash().isNonZero();
|
||||
bool anyTransactions = theApp->getLedgerMaster().getCurrentLedger()->peekTransactionMap()->getHash().isNonZero();
|
||||
int proposersClosed = mPeerPositions.size();
|
||||
|
||||
// This ledger is open. This computes how long since the last ledger closed
|
||||
@@ -613,7 +613,7 @@ void LedgerConsensus::closeLedger()
|
||||
mCloseTime = theApp->getOPs().getCloseTimeNC();
|
||||
theApp->getOPs().setLastCloseTime(mCloseTime);
|
||||
statusChange(ripple::neCLOSING_LEDGER, *mPreviousLedger);
|
||||
takeInitialPosition(*theApp->getMasterLedger().closeLedger(true));
|
||||
takeInitialPosition(*theApp->getLedgerMaster().closeLedger(true));
|
||||
}
|
||||
|
||||
void LedgerConsensus::stateEstablish()
|
||||
@@ -813,7 +813,7 @@ SHAMap::pointer LedgerConsensus::getTransactionTree(const uint256& hash, bool do
|
||||
|
||||
if (mState == lcsPRE_CLOSE)
|
||||
{
|
||||
SHAMap::pointer currentMap = theApp->getMasterLedger().getCurrentLedger()->peekTransactionMap();
|
||||
SHAMap::pointer currentMap = theApp->getLedgerMaster().getCurrentLedger()->peekTransactionMap();
|
||||
if (currentMap->getHash() == hash)
|
||||
{
|
||||
cLog(lsINFO) << "node proposes our open transaction set";
|
||||
@@ -1251,7 +1251,7 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer)
|
||||
cLog(lsINFO) << "CNF newLCL " << newLCLHash;
|
||||
|
||||
Ledger::pointer newOL = boost::make_shared<Ledger>(true, boost::ref(*newLCL));
|
||||
ScopedLock sl = theApp->getMasterLedger().getLock();
|
||||
ScopedLock sl = theApp->getLedgerMaster().getLock();
|
||||
|
||||
// Apply disputed transactions that didn't get in
|
||||
TransactionEngine engine(newOL);
|
||||
@@ -1274,9 +1274,9 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer)
|
||||
}
|
||||
|
||||
cLog(lsINFO) << "Applying transactions from current ledger";
|
||||
applyTransactions(theApp->getMasterLedger().getCurrentLedger()->peekTransactionMap(), newOL, newLCL,
|
||||
applyTransactions(theApp->getLedgerMaster().getCurrentLedger()->peekTransactionMap(), newOL, newLCL,
|
||||
failedTransactions, true);
|
||||
theApp->getMasterLedger().pushLedger(newLCL, newOL, !mConsensusFail);
|
||||
theApp->getLedgerMaster().pushLedger(newLCL, newOL, !mConsensusFail);
|
||||
mNewLedgerHash = newLCL->getHash();
|
||||
mState = lcsACCEPTED;
|
||||
sl.unlock();
|
||||
|
||||
@@ -946,7 +946,7 @@ Json::Value NetworkOPs::getServerInfo()
|
||||
if (mNeedNetworkLedger)
|
||||
info["networkLedger"] = "waiting";
|
||||
|
||||
info["completeLedgers"] = theApp->getMasterLedger().getCompleteLedgers();
|
||||
info["completeLedgers"] = theApp->getLedgerMaster().getCompleteLedgers();
|
||||
info["peers"] = theApp->getConnectionPool().getPeerCount();
|
||||
|
||||
Json::Value lastClose = Json::objectValue;
|
||||
|
||||
@@ -80,9 +80,9 @@ PathOption::PathOption(PathOption::pointer other)
|
||||
// functionality is left to the future.
|
||||
//
|
||||
Pathfinder::Pathfinder(const RippleAddress& srcAccountID, const RippleAddress& dstAccountID, const uint160& srcCurrencyID, const uint160& srcIssuerID, const STAmount& dstAmount)
|
||||
: mSrcAccountID(srcAccountID.getAccountID()), mDstAccountID(dstAccountID.getAccountID()), mDstAmount(dstAmount), mSrcCurrencyID(srcCurrencyID), mSrcIssuerID(srcIssuerID), mOrderBook(theApp->getMasterLedger().getCurrentLedger())
|
||||
: mSrcAccountID(srcAccountID.getAccountID()), mDstAccountID(dstAccountID.getAccountID()), mDstAmount(dstAmount), mSrcCurrencyID(srcCurrencyID), mSrcIssuerID(srcIssuerID), mOrderBook(theApp->getLedgerMaster().getCurrentLedger())
|
||||
{
|
||||
mLedger=theApp->getMasterLedger().getCurrentLedger();
|
||||
mLedger=theApp->getLedgerMaster().getCurrentLedger();
|
||||
}
|
||||
|
||||
// If possible, returns a single path.
|
||||
|
||||
@@ -1237,7 +1237,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet)
|
||||
return;
|
||||
}
|
||||
memcpy(ledgerhash.begin(), packet.ledgerhash().data(), 32);
|
||||
ledger = theApp->getMasterLedger().getLedgerByHash(ledgerhash);
|
||||
ledger = theApp->getLedgerMaster().getLedgerByHash(ledgerhash);
|
||||
|
||||
tLog(!ledger, lsINFO) << "Don't have ledger " << ledgerhash;
|
||||
if (!ledger && (packet.has_querytype() && !packet.has_requestcookie()))
|
||||
@@ -1264,16 +1264,16 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet)
|
||||
}
|
||||
else if (packet.has_ledgerseq())
|
||||
{
|
||||
ledger = theApp->getMasterLedger().getLedgerBySeq(packet.ledgerseq());
|
||||
ledger = theApp->getLedgerMaster().getLedgerBySeq(packet.ledgerseq());
|
||||
tLog(!ledger, lsINFO) << "Don't have ledger " << packet.ledgerseq();
|
||||
}
|
||||
else if (packet.has_ltype() && (packet.ltype() == ripple::ltCURRENT))
|
||||
ledger = theApp->getMasterLedger().getCurrentLedger();
|
||||
ledger = theApp->getLedgerMaster().getCurrentLedger();
|
||||
else if (packet.has_ltype() && (packet.ltype() == ripple::ltCLOSED) )
|
||||
{
|
||||
ledger = theApp->getMasterLedger().getClosedLedger();
|
||||
ledger = theApp->getLedgerMaster().getClosedLedger();
|
||||
if (ledger && !ledger->isClosed())
|
||||
ledger = theApp->getMasterLedger().getLedgerBySeq(ledger->getLedgerSeq() - 1);
|
||||
ledger = theApp->getLedgerMaster().getLedgerBySeq(ledger->getLedgerSeq() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1529,7 +1529,7 @@ void Peer::sendHello()
|
||||
h.set_ipv4port(theConfig.PEER_PORT);
|
||||
h.set_nodeprivate(theConfig.PEER_PRIVATE);
|
||||
|
||||
Ledger::pointer closedLedger = theApp->getMasterLedger().getClosedLedger();
|
||||
Ledger::pointer closedLedger = theApp->getLedgerMaster().getClosedLedger();
|
||||
if (closedLedger && closedLedger->isClosed())
|
||||
{
|
||||
uint256 hash = closedLedger->getHash();
|
||||
|
||||
@@ -1225,8 +1225,8 @@ Json::Value RPCHandler::doLedger(const Json::Value& params)
|
||||
if (getParamCount(params) == 0)
|
||||
{
|
||||
Json::Value ret(Json::objectValue), current(Json::objectValue), closed(Json::objectValue);
|
||||
theApp->getMasterLedger().getCurrentLedger()->addJson(current, 0);
|
||||
theApp->getMasterLedger().getClosedLedger()->addJson(closed, 0);
|
||||
theApp->getLedgerMaster().getCurrentLedger()->addJson(current, 0);
|
||||
theApp->getLedgerMaster().getClosedLedger()->addJson(closed, 0);
|
||||
ret["open"] = current;
|
||||
ret["closed"] = closed;
|
||||
return ret;
|
||||
@@ -1240,13 +1240,13 @@ Json::Value RPCHandler::doLedger(const Json::Value& params)
|
||||
|
||||
Ledger::pointer ledger;
|
||||
if (param == "current")
|
||||
ledger = theApp->getMasterLedger().getCurrentLedger();
|
||||
ledger = theApp->getLedgerMaster().getCurrentLedger();
|
||||
else if ((param == "lastclosed") || (param == "lastaccepted"))
|
||||
ledger = theApp->getMasterLedger().getClosedLedger();
|
||||
ledger = theApp->getLedgerMaster().getClosedLedger();
|
||||
else if (param.size() > 12)
|
||||
ledger = theApp->getMasterLedger().getLedgerByHash(uint256(param));
|
||||
ledger = theApp->getLedgerMaster().getLedgerByHash(uint256(param));
|
||||
else
|
||||
ledger = theApp->getMasterLedger().getLedgerBySeq(lexical_cast_s<uint32>(param));
|
||||
ledger = theApp->getLedgerMaster().getLedgerBySeq(lexical_cast_s<uint32>(param));
|
||||
|
||||
if (!ledger)
|
||||
return rpcError(rpcLGR_NOT_FOUND);
|
||||
@@ -1308,7 +1308,7 @@ Json::Value RPCHandler::doAccountTransactions(const Json::Value& params)
|
||||
else
|
||||
{
|
||||
txn->setLedger(it->first);
|
||||
ret["transactions"].append(txn->getJson(0));
|
||||
ret["transactions"].append(txn->getJson(1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1854,7 +1854,7 @@ Json::Value RPCHandler::doTransactionEntry(const Json::Value& jvRequest)
|
||||
// XXX Relying on trusted WSS client. Would be better to have a strict routine, returning success or failure.
|
||||
uLedgerID.SetHex(jvRequest["ledger_hash"].asString());
|
||||
|
||||
Ledger::pointer lpLedger = theApp->getMasterLedger().getLedgerByHash(uLedgerID);
|
||||
Ledger::pointer lpLedger = theApp->getLedgerMaster().getLedgerByHash(uLedgerID);
|
||||
|
||||
if (!lpLedger) {
|
||||
jvResult["error"] = "ledgerNotFound";
|
||||
|
||||
@@ -22,7 +22,7 @@ void RippleLines::printRippleLines()
|
||||
|
||||
RippleLines::RippleLines(const uint160& accountID )
|
||||
{
|
||||
fillLines(accountID,theApp->getMasterLedger().getCurrentLedger());
|
||||
fillLines(accountID,theApp->getLedgerMaster().getCurrentLedger());
|
||||
}
|
||||
|
||||
void RippleLines::fillLines(const uint160& accountID, Ledger::ref ledger)
|
||||
|
||||
@@ -306,11 +306,25 @@ bool Transaction::convertToTransactions(uint32 firstLedgerSeq, uint32 secondLedg
|
||||
return true;
|
||||
}
|
||||
|
||||
// options 1 to include the date of the transaction
|
||||
Json::Value Transaction::getJson(int options) const
|
||||
{
|
||||
|
||||
Json::Value ret(mTransaction->getJson(0));
|
||||
|
||||
if (mInLedger) ret["inLedger"]=mInLedger;
|
||||
if (mInLedger)
|
||||
{
|
||||
ret["inLedger"]=mInLedger;
|
||||
|
||||
if(options==1)
|
||||
{
|
||||
Ledger::pointer ledger=theApp->getLedgerMaster().getLedgerBySeq(mInLedger);
|
||||
if(ledger)
|
||||
{
|
||||
ret["date"]=ledger->getCloseTimeNC();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (mStatus)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user