Inject Application (cont.)

This commit is contained in:
Vinnie Falco
2015-09-15 19:10:16 -04:00
committed by Edward Hennis
parent eed1a891a7
commit ffbcb96eff
98 changed files with 708 additions and 570 deletions

View File

@@ -166,7 +166,7 @@ bool InboundLedger::tryLocal ()
if (m_journal.trace) m_journal.trace <<
"Ledger header found in fetch pack";
mLedger = std::make_shared<Ledger> (
data.data(), data.size(), true, getConfig());
data.data(), data.size(), true, getConfig(), app_.family());
app_.getNodeStore ().store (
hotLEDGER, std::move (data), mHash);
}
@@ -174,7 +174,7 @@ bool InboundLedger::tryLocal ()
{
mLedger = std::make_shared<Ledger>(
node->getData().data(), node->getData().size(),
true, getConfig());
true, getConfig(), app_.family());
}
if (mLedger->getHash () != mHash)
@@ -769,7 +769,7 @@ bool InboundLedger::takeHeader (std::string const& data)
return true;
mLedger = std::make_shared<Ledger>(
data.data(), data.size(), false, getConfig());
data.data(), data.size(), false, getConfig(), app_.family());
if (mLedger->getHash () != mHash)
{

View File

@@ -301,7 +301,7 @@ public:
return false;
}
Ledger::pointer dbLedger = Ledger::loadByIndex(ledgerIndex);
Ledger::pointer dbLedger = loadByIndex(ledgerIndex, app_);
if (! dbLedger ||
(dbLedger->getHash() != ledgerHash) ||
(dbLedger->info().parentHash != nodeLedger->info().parentHash))

View File

@@ -1006,7 +1006,8 @@ void LedgerConsensusImp::accept (std::shared_ptr<SHAMap> set)
// Build the new last closed ledger
auto newLCL = std::make_shared<Ledger>(
open_ledger, *mPreviousLedger);
open_ledger, *mPreviousLedger,
app_.timeKeeper().closeTime());
newLCL->setClosed (); // so applyTransactions sees a closed ledger
// Set up to write SHAMap changes to our database,
@@ -1113,7 +1114,7 @@ void LedgerConsensusImp::accept (std::shared_ptr<SHAMap> set)
// Build new open ledger
auto newOL = std::make_shared<Ledger>(
open_ledger, *newLCL);
open_ledger, *newLCL, app_.timeKeeper().closeTime());
OpenView accum(&*newOL);
assert(accum.open());

View File

@@ -148,7 +148,7 @@ public:
, app_ (app)
, m_journal (journal)
, mLastValidLedger (std::make_pair (uint256(), 0))
, mLedgerHistory (collector)
, mLedgerHistory (collector, app)
, mHeldTransactions (uint256 ())
, mLedgerCleaner (make_LedgerCleaner (
app, *this, deprecatedLogs().journal("LedgerCleaner")))
@@ -617,9 +617,9 @@ public:
mCompleteLedgers.setRange (minHas, maxHas);
}
maxHas = minHas;
ledgerHashes = Ledger::getHashesByIndex ((seq < 500)
ledgerHashes = getHashesByIndex ((seq < 500)
? 0
: (seq - 499), seq);
: (seq - 499), seq, app_);
it = ledgerHashes.find (seq);
if (it == ledgerHashes.end ())
@@ -755,7 +755,7 @@ public:
{
// Check the SQL database's entry for the sequence before this
// ledger, if it's not this ledger's parent, invalidate it
uint256 prevHash = Ledger::getHashByIndex (ledger->info().seq - 1);
uint256 prevHash = getHashByIndex (ledger->info().seq - 1, app_);
if (prevHash.isNonZero () && prevHash != ledger->info().parentHash)
clearLedger (ledger->info().seq - 1);
}
@@ -1451,7 +1451,7 @@ public:
if (hash.isNonZero ())
return hash;
return Ledger::getHashByIndex (index);
return getHashByIndex (index, app_);
}
// VFALCO NOTE This should return boost::optional<uint256>
@@ -1747,7 +1747,7 @@ void LedgerMasterImp::doAdvance ()
mHistLedger = ledger;
auto& parent = ledger->info().parentHash;
if (mFillInProgress == 0 &&
Ledger::getHashByIndex(seq - 1) == parent)
getHashByIndex(seq - 1, app_) == parent)
{
// Previous ledger is in DB
ScopedLockType lock (m_mutex);