mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-30 18:40:28 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -373,9 +373,12 @@ void LedgerConsensus::checkLCL()
|
||||
uint256 netLgr = mPrevLedgerHash;
|
||||
int netLgrCount = 0;
|
||||
|
||||
uint256 favoredLedger = mPrevLedgerHash; // Don't get stuck one ledger back or jump one forward
|
||||
uint256 favoredLedger = mPrevLedgerHash; // Don't jump forward
|
||||
uint256 priorLedger;
|
||||
if (mHaveCorrectLCL)
|
||||
priorLedger = mPreviousLedger->getParentHash(); // don't jump back
|
||||
boost::unordered_map<uint256, currentValidationCount> vals =
|
||||
theApp->getValidations().getCurrentValidations(favoredLedger);
|
||||
theApp->getValidations().getCurrentValidations(favoredLedger, priorLedger);
|
||||
|
||||
typedef std::map<uint256, currentValidationCount>::value_type u256_cvc_pair;
|
||||
BOOST_FOREACH(u256_cvc_pair& it, vals)
|
||||
@@ -900,7 +903,7 @@ SHAMap::pointer LedgerConsensus::getTransactionTree(const uint256& hash, bool do
|
||||
return SHAMap::pointer();
|
||||
}
|
||||
|
||||
void LedgerConsensus::startAcquiring(const TransactionAcquire::pointer& acquire)
|
||||
void LedgerConsensus::startAcquiring(TransactionAcquire::pointer acquire)
|
||||
{
|
||||
boost::unordered_map< uint256, std::vector< boost::weak_ptr<Peer> > >::iterator it =
|
||||
mPeerData.find(acquire->getHash());
|
||||
|
||||
@@ -128,7 +128,7 @@ protected:
|
||||
void accept(SHAMap::ref txSet, LoadEvent::pointer);
|
||||
|
||||
void weHave(const uint256& id, Peer::ref avoidPeer);
|
||||
void startAcquiring(const TransactionAcquire::pointer&);
|
||||
void startAcquiring(TransactionAcquire::pointer);
|
||||
SHAMap::pointer find(const uint256& hash);
|
||||
|
||||
void createDisputes(SHAMap::ref, SHAMap::ref);
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
// The number of seconds a validation remains current after its ledger's close time
|
||||
// This is a safety to protect against very old validations and the time it takes to adjust
|
||||
// the close time accuracy window
|
||||
# define LEDGER_VAL_INTERVAL 600
|
||||
# define LEDGER_VAL_INTERVAL 300
|
||||
|
||||
// The number of seconds before a close time that we consider a validation acceptable
|
||||
// This protects against extreme clock errors
|
||||
# define LEDGER_EARLY_INTERVAL 240
|
||||
# define LEDGER_EARLY_INTERVAL 180
|
||||
|
||||
// The number of milliseconds we wait minimum to ensure participation
|
||||
# define LEDGER_MIN_CONSENSUS 2000
|
||||
|
||||
@@ -685,7 +685,7 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
|
||||
boost::unordered_map<uint256, ValidationCount> ledgers;
|
||||
{
|
||||
boost::unordered_map<uint256, currentValidationCount> current =
|
||||
theApp->getValidations().getCurrentValidations(closedLedger);
|
||||
theApp->getValidations().getCurrentValidations(closedLedger, prevClosedLedger);
|
||||
typedef std::map<uint256, currentValidationCount>::value_type u256_cvc_pair;
|
||||
BOOST_FOREACH(const u256_cvc_pair& it, current)
|
||||
{
|
||||
|
||||
@@ -228,10 +228,11 @@ std::list<SerializedValidation::pointer> ValidationCollection::getCurrentTrusted
|
||||
}
|
||||
|
||||
boost::unordered_map<uint256, currentValidationCount>
|
||||
ValidationCollection::getCurrentValidations(uint256 currentLedger)
|
||||
ValidationCollection::getCurrentValidations(uint256 currentLedger, uint256 priorLedger)
|
||||
{
|
||||
uint32 cutoff = theApp->getOPs().getNetworkTimeNC() - LEDGER_VAL_INTERVAL;
|
||||
bool valCurrentLedger = currentLedger.isNonZero();
|
||||
bool valPriorLedger = priorLedger.isNonZero();
|
||||
|
||||
boost::unordered_map<uint256, currentValidationCount> ret;
|
||||
|
||||
@@ -250,7 +251,8 @@ ValidationCollection::getCurrentValidations(uint256 currentLedger)
|
||||
}
|
||||
else
|
||||
{ // contains a live record
|
||||
bool countPreferred = valCurrentLedger && it->second->isPreviousHash(currentLedger);
|
||||
bool countPreferred = (valCurrentLedger && it->second->isPreviousHash(currentLedger)) ||
|
||||
(valPriorLedger && (it->second->getLedgerHash() == priorLedger));
|
||||
tLog(countPreferred, lsDEBUG) << "Counting for " << currentLedger << " not " << it->second->getLedgerHash();
|
||||
currentValidationCount& p = countPreferred ? ret[currentLedger] : ret[it->second->getLedgerHash()];
|
||||
|
||||
@@ -309,6 +311,7 @@ void ValidationCollection::doWrite(Job&)
|
||||
while (!mStaleValidations.empty())
|
||||
{
|
||||
std::vector<SerializedValidation::pointer> vector;
|
||||
vector.reserve(512);
|
||||
mStaleValidations.swap(vector);
|
||||
sl.unlock();
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ class ValidationCollection
|
||||
{
|
||||
protected:
|
||||
|
||||
boost::mutex mValidationLock;
|
||||
boost::mutex mValidationLock;
|
||||
TaggedCache<uint256, ValidationSet> mValidations;
|
||||
boost::unordered_map<uint160, SerializedValidation::pointer> mCurrentValidations;
|
||||
std::vector<SerializedValidation::pointer> mStaleValidations;
|
||||
@@ -34,7 +34,8 @@ protected:
|
||||
boost::shared_ptr<ValidationSet> findSet(const uint256& ledgerHash);
|
||||
|
||||
public:
|
||||
ValidationCollection() : mValidations("Validations", 128, 600), mWriting(false) { ; }
|
||||
ValidationCollection() : mValidations("Validations", 128, 600), mWriting(false)
|
||||
{ mStaleValidations.reserve(512); }
|
||||
|
||||
bool addValidation(SerializedValidation::ref);
|
||||
ValidationSet getValidations(const uint256& ledger);
|
||||
@@ -46,7 +47,9 @@ public:
|
||||
int getNodesAfter(const uint256& ledger);
|
||||
int getLoadRatio(bool overLoaded);
|
||||
|
||||
boost::unordered_map<uint256, currentValidationCount> getCurrentValidations(uint256 currentLedger);
|
||||
boost::unordered_map<uint256, currentValidationCount> getCurrentValidations(
|
||||
uint256 currentLedger, uint256 previousLedger);
|
||||
|
||||
std::list<SerializedValidation::pointer> getCurrentTrustedValidations();
|
||||
|
||||
void tune(int size, int age);
|
||||
|
||||
Reference in New Issue
Block a user