Skip to content

Commit

Permalink
[FOLD] Address ximinez's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelportilla committed Mar 4, 2020
1 parent efba284 commit 5a20ed0
Show file tree
Hide file tree
Showing 14 changed files with 180 additions and 148 deletions.
2 changes: 1 addition & 1 deletion src/ripple/app/ledger/impl/InboundLedger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ InboundLedger::init(ScopedLockType& collectionLock)
if (mFailed)
return;
}
else if (shardStore && mSeq >= shardStore->earliestSeq())
else if (shardStore && mSeq >= shardStore->earliestLedgerSeq())
{
if (auto l = shardStore->fetchLedger(mHash, mSeq))
{
Expand Down
6 changes: 3 additions & 3 deletions src/ripple/app/ledger/impl/LedgerMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ LedgerMaster::fetchForHistory(
*hash, missing, reason);
if (!ledger &&
missing != fetch_seq_ &&
missing > app_.getNodeStore().earliestSeq())
missing > app_.getNodeStore().earliestLedgerSeq())
{
JLOG(m_journal.trace())
<< "fetchForHistory want fetch pack " << missing;
Expand Down Expand Up @@ -1806,7 +1806,7 @@ LedgerMaster::fetchForHistory(
else
// Do not fetch ledger sequences lower
// than the earliest ledger sequence
fetchSz = app_.getNodeStore().earliestSeq();
fetchSz = app_.getNodeStore().earliestLedgerSeq();
fetchSz = missing >= fetchSz ?
std::min(ledger_fetch_size_, (missing - fetchSz) + 1) : 0;
try
Expand Down Expand Up @@ -1866,7 +1866,7 @@ void LedgerMaster::doAdvance (std::unique_lock<std::recursive_mutex>& sl)
std::lock_guard sll(mCompleteLock);
missing = prevMissing(mCompleteLedgers,
mPubLedger->info().seq,
app_.getNodeStore().earliestSeq());
app_.getNodeStore().earliestLedgerSeq());
}
if (missing)
{
Expand Down
7 changes: 4 additions & 3 deletions src/ripple/nodestore/Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <ripple/nodestore/impl/Tuning.h>
#include <ripple/nodestore/Scheduler.h>
#include <ripple/nodestore/NodeObject.h>
#include <ripple/protocol/digest.h>
#include <ripple/protocol/SystemParameters.h>

#include <thread>
Expand Down Expand Up @@ -214,9 +215,9 @@ class Database : public Stoppable
/** @return The earliest ledger sequence allowed
*/
std::uint32_t
earliestSeq() const
earliestLedgerSeq() const
{
return earliestSeq_;
return earliestLedgerSeq_;
}

protected:
Expand Down Expand Up @@ -285,7 +286,7 @@ class Database : public Stoppable

// The default is 32570 to match the XRP ledger network's earliest
// allowed sequence. Alternate networks may set this value.
std::uint32_t const earliestSeq_;
std::uint32_t const earliestLedgerSeq_;

virtual
std::shared_ptr<NodeObject>
Expand Down
7 changes: 3 additions & 4 deletions src/ripple/nodestore/impl/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ Database::Database(
: Stoppable(name, parent.getRoot())
, j_(journal)
, scheduler_(scheduler)
, earliestSeq_(get<std::uint32_t>(
, earliestLedgerSeq_(get<std::uint32_t>(
config,
"earliest_seq",
XRP_LEDGER_EARLIEST_SEQ))
{
if (earliestSeq_ < 1)
if (earliestLedgerSeq_ < 1)
Throw<std::runtime_error>("Invalid earliest_seq");

while (readThreads-- > 0)
Expand Down Expand Up @@ -259,8 +259,7 @@ Database::copyLedger(
#if RIPPLE_VERIFY_NODEOBJECT_KEYS
for (auto& nObj : batch)
{
assert(nObj->getHash() ==
sha512Hash(makeSlice(nObj->getData())));
assert(nObj->getHash() == sha512Half(makeSlice(nObj->getData())));
if (dstPCache && dstNCache)
{
dstPCache->canonicalize(nObj->getHash(), nObj, true);
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/nodestore/impl/DatabaseNodeImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DatabaseNodeImp::store(NodeObjectType type, Blob&& data,
uint256 const& hash, std::uint32_t seq)
{
#if RIPPLE_VERIFY_NODEOBJECT_KEYS
assert(hash == sha512Hash(makeSlice(data)));
assert(hash == sha512Half(makeSlice(data)));
#endif
auto nObj = NodeObject::createObject(type, std::move(data), hash);
pCache_->canonicalize(hash, nObj, true);
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/nodestore/impl/DatabaseRotatingImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ DatabaseRotatingImp::store(NodeObjectType type, Blob&& data,
uint256 const& hash, std::uint32_t seq)
{
#if RIPPLE_VERIFY_NODEOBJECT_KEYS
assert(hash == sha512Hash(makeSlice(data)));
assert(hash == sha512Half(makeSlice(data)));
#endif
auto nObj = NodeObject::createObject(type, std::move(data), hash);
pCache_->canonicalize(hash, nObj, true);
Expand Down
Loading

0 comments on commit 5a20ed0

Please sign in to comment.