mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 15:05:53 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -184,6 +184,10 @@ void Application::setup()
|
||||
|
||||
theApp->getHashNodeDB()->getDB()->executeSQL(boost::str(boost::format("PRAGMA cache_size=-%d;") %
|
||||
(theConfig.getSize(siHashNodeDBCache) * 1024)));
|
||||
theApp->getLedgerDB()->getDB()->executeSQL(boost::str(boost::format("PRAGMA cache_size=-%d;") %
|
||||
(theConfig.getSize(siTxnDBCache) * 1024)));
|
||||
theApp->getTxnDB()->getDB()->executeSQL(boost::str(boost::format("PRAGMA cache_size=-%d;") %
|
||||
(theConfig.getSize(siLgrDBCache) * 1024)));
|
||||
|
||||
//
|
||||
// Allow peer connections.
|
||||
|
||||
@@ -498,7 +498,9 @@ int Config::getSize(SizedItemName item)
|
||||
{ siLineCacheSize, { 8192, 32768, 131072, 1048576, 0 } },
|
||||
{ siLineCacheAge, { 500, 600, 1800, 3600, 7200 } },
|
||||
{ siHashNodeDBCache, { 24, 48, 64, 128, 256 } },
|
||||
};
|
||||
{ siTxnDBCache, { 4, 8, 32, 64, 128 } },
|
||||
{ siLgrDBCache, { 4, 8, 32, 64, 128 } }
|
||||
};
|
||||
|
||||
for (int i = 0; i < (sizeof(sizeTable) / sizeof(SizedItem)); ++i)
|
||||
{
|
||||
|
||||
@@ -65,7 +65,9 @@ enum SizedItemName
|
||||
siLedgerFetch,
|
||||
siLineCacheSize,
|
||||
siLineCacheAge,
|
||||
siHashNodeDBCache
|
||||
siHashNodeDBCache,
|
||||
siTxnDBCache,
|
||||
siLgrDBCache
|
||||
};
|
||||
|
||||
struct SizedItem
|
||||
|
||||
@@ -842,14 +842,11 @@ Json::Value Ledger::getJson(int options)
|
||||
|
||||
if (mCloseTime != 0)
|
||||
{
|
||||
ledger["close_time"] = mCloseTime;
|
||||
ledger["close_time_human"] = boost::posix_time::to_simple_string(ptFromSeconds(mCloseTime));
|
||||
ledger["close_time_resolution"] = mCloseResolution;
|
||||
if ((mCloseFlags & sLCF_NoConsensusTime) != 0)
|
||||
ledger["close_time_estimate"] = boost::posix_time::to_simple_string(ptFromSeconds(mCloseTime));
|
||||
else
|
||||
{
|
||||
ledger["close_time"] = mCloseTime;
|
||||
ledger["close_time_human"] = boost::posix_time::to_simple_string(ptFromSeconds(mCloseTime));
|
||||
ledger["close_time_resolution"] = mCloseResolution;
|
||||
}
|
||||
ledger["close_time_estimated"] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -201,7 +201,7 @@ void LedgerConsensus::checkOurValidation()
|
||||
v->setTrusted();
|
||||
v->sign(signingHash, mValPrivate);
|
||||
theApp->isNew(signingHash);
|
||||
theApp->getValidations().addValidation(v);
|
||||
theApp->getValidations().addValidation(v, "localMissing");
|
||||
std::vector<unsigned char> validation = v->getSigned();
|
||||
ripple::TMValidation val;
|
||||
val.set_validation(&validation[0], validation.size());
|
||||
@@ -1182,7 +1182,7 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer)
|
||||
v->sign(signingHash, mValPrivate);
|
||||
v->setTrusted();
|
||||
theApp->isNew(signingHash); // suppress it if we receive it
|
||||
theApp->getValidations().addValidation(v);
|
||||
theApp->getValidations().addValidation(v, "local");
|
||||
theApp->getOPs().setLastValidation(v);
|
||||
std::vector<unsigned char> validation = v->getSigned();
|
||||
ripple::TMValidation val;
|
||||
|
||||
@@ -289,6 +289,9 @@ bool LedgerMaster::shouldAcquire(uint32 currentLedger, uint32 ledgerHistory, uin
|
||||
|
||||
void LedgerMaster::resumeAcquiring()
|
||||
{
|
||||
if (theApp->getOPs().isNeedNetworkLedger())
|
||||
return;
|
||||
|
||||
boost::recursive_mutex::scoped_lock ml(mLock);
|
||||
|
||||
if (mMissingLedger && mMissingLedger->isDone())
|
||||
@@ -355,6 +358,9 @@ void LedgerMaster::setFullLedger(Ledger::pointer ledger)
|
||||
cLog(lsDEBUG) << "Ledger " << ledger->getLedgerSeq() << " accepted :" << ledger->getHash();
|
||||
assert(ledger->peekAccountStateMap()->getHash().isNonZero());
|
||||
|
||||
if (theApp->getOPs().isNeedNetworkLedger())
|
||||
return;
|
||||
|
||||
boost::recursive_mutex::scoped_lock ml(mLock);
|
||||
|
||||
mCompleteLedgers.setValue(ledger->getLedgerSeq());
|
||||
|
||||
@@ -1164,10 +1164,10 @@ std::vector<RippleAddress>
|
||||
return accounts;
|
||||
}
|
||||
|
||||
bool NetworkOPs::recvValidation(SerializedValidation::ref val)
|
||||
bool NetworkOPs::recvValidation(SerializedValidation::ref val, const std::string& source)
|
||||
{
|
||||
cLog(lsDEBUG) << "recvValidation " << val->getLedgerHash();
|
||||
return theApp->getValidations().addValidation(val);
|
||||
cLog(lsDEBUG) << "recvValidation " << val->getLedgerHash() << " from " << source;
|
||||
return theApp->getValidations().addValidation(val, source);
|
||||
}
|
||||
|
||||
Json::Value NetworkOPs::getConsensusInfo()
|
||||
@@ -1665,18 +1665,20 @@ void NetworkOPs::unsubAccountChanges(InfoSub* isrListener)
|
||||
// <-- bool: true=added, false=already there
|
||||
bool NetworkOPs::subLedger(InfoSub::ref isrListener, Json::Value& jvResult)
|
||||
{
|
||||
Ledger::pointer lpClosed = getClosedLedger();
|
||||
Ledger::pointer lpClosed = getValidatedLedger();
|
||||
if (lpClosed)
|
||||
{
|
||||
jvResult["ledger_index"] = lpClosed->getLedgerSeq();
|
||||
jvResult["ledger_hash"] = lpClosed->getHash().ToString();
|
||||
jvResult["ledger_time"] = Json::Value::UInt(lpClosed->getCloseTimeNC());
|
||||
|
||||
jvResult["ledger_index"] = lpClosed->getLedgerSeq();
|
||||
jvResult["ledger_hash"] = lpClosed->getHash().ToString();
|
||||
jvResult["ledger_time"] = Json::Value::UInt(lpClosed->getCloseTimeNC());
|
||||
jvResult["fee_ref"] = Json::UInt(lpClosed->getReferenceFeeUnits());
|
||||
jvResult["fee_base"] = Json::UInt(lpClosed->getBaseFee());
|
||||
jvResult["reserve_base"] = Json::UInt(lpClosed->getReserve(0));
|
||||
jvResult["reserve_inc"] = Json::UInt(lpClosed->getReserveInc());
|
||||
}
|
||||
|
||||
jvResult["fee_ref"] = Json::UInt(lpClosed->getReferenceFeeUnits());
|
||||
jvResult["fee_base"] = Json::UInt(lpClosed->getBaseFee());
|
||||
jvResult["reserve_base"] = Json::UInt(lpClosed->getReserve(0));
|
||||
jvResult["reserve_inc"] = Json::UInt(lpClosed->getReserveInc());
|
||||
|
||||
if ((mMode == omFULL) || (mMode == omTRACKING))
|
||||
if (((mMode == omFULL) || (mMode == omTRACKING)) && !isNeedNetworkLedger())
|
||||
jvResult["validated_ledgers"] = theApp->getLedgerMaster().getCompleteLedgers();
|
||||
|
||||
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
RippleAddress nodePublic, uint256 checkLedger, bool sigGood);
|
||||
SMAddNode gotTXData(const boost::shared_ptr<Peer>& peer, const uint256& hash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData);
|
||||
bool recvValidation(SerializedValidation::ref val);
|
||||
bool recvValidation(SerializedValidation::ref val, const std::string& source);
|
||||
void takePosition(int seq, SHAMap::ref position);
|
||||
SHAMap::pointer getTXMap(const uint256& hash);
|
||||
bool hasTXSet(const boost::shared_ptr<Peer>& peer, const uint256& set, ripple::TxSetStatus status);
|
||||
|
||||
@@ -1056,8 +1056,16 @@ static void checkValidation(Job&, SerializedValidation::pointer val, uint256 sig
|
||||
return;
|
||||
}
|
||||
|
||||
std::string source;
|
||||
Peer::pointer lp = peer.lock();
|
||||
if (lp)
|
||||
source = lp->getDisplayName();
|
||||
else
|
||||
source = "unknown";
|
||||
|
||||
std::set<uint64> peers;
|
||||
if (theApp->getOPs().recvValidation(val) && theApp->getSuppression().swapSet(signingHash, peers, SF_RELAYED))
|
||||
if (theApp->getOPs().recvValidation(val, source) &&
|
||||
theApp->getSuppression().swapSet(signingHash, peers, SF_RELAYED))
|
||||
{
|
||||
PackedMessage::pointer message = boost::make_shared<PackedMessage>(*packet, ripple::mtVALIDATION);
|
||||
theApp->getConnectionPool().relayMessageBut(peers, message);
|
||||
|
||||
@@ -117,6 +117,7 @@ public:
|
||||
//bool operator == (const Peer& other);
|
||||
|
||||
std::string& getIP() { return mIpPort.first; }
|
||||
std::string getDisplayName() { return mCluster ? mNodeName : mIpPort.first; }
|
||||
int getPort() { return mIpPort.second; }
|
||||
|
||||
void setIpPort(const std::string& strIP, int iPort);
|
||||
|
||||
@@ -34,7 +34,7 @@ VSpointer ValidationCollection::findSet(const uint256& ledgerHash)
|
||||
return mValidations.fetch(ledgerHash);
|
||||
}
|
||||
|
||||
bool ValidationCollection::addValidation(SerializedValidation::ref val)
|
||||
bool ValidationCollection::addValidation(SerializedValidation::ref val, const std::string& source)
|
||||
{
|
||||
RippleAddress signer = val->getSignerPublic();
|
||||
bool isCurrent = false;
|
||||
@@ -53,7 +53,7 @@ bool ValidationCollection::addValidation(SerializedValidation::ref val)
|
||||
else
|
||||
{
|
||||
cLog(lsDEBUG) << "Node " << signer.humanNodePublic() << " not in UNL st=" << val->getSignTime() <<
|
||||
", hash=" << val->getLedgerHash() << ", shash=" << val->getSigningHash();
|
||||
", hash=" << val->getLedgerHash() << ", shash=" << val->getSigningHash() << " src=" << source;
|
||||
}
|
||||
|
||||
uint256 hash = val->getLedgerHash();
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
ValidationCollection() : mValidations("Validations", 128, 600), mWriting(false)
|
||||
{ mStaleValidations.reserve(512); }
|
||||
|
||||
bool addValidation(SerializedValidation::ref);
|
||||
bool addValidation(SerializedValidation::ref, const std::string& source);
|
||||
ValidationSet getValidations(const uint256& ledger);
|
||||
void getValidationCount(const uint256& ledger, bool currentOnly, int& trusted, int& untrusted);
|
||||
void getValidationTypes(const uint256& ledger, int& full, int& partial);
|
||||
|
||||
Reference in New Issue
Block a user