Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/xrpl/ledger/CachedView.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class CachedViewImpl : public DigestAwareReadView
}

LedgerHeader const&
info() const override
header() const override
{
return base_.info();
return base_.header();
}

Fees const&
Expand Down
4 changes: 2 additions & 2 deletions include/xrpl/ledger/OpenView.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class OpenView final : public ReadView, public TxsRawView
monotonic_resource_;
txs_map txs_;
Rules rules_;
LedgerHeader info_;
LedgerHeader header_;
ReadView const* base_;
detail::RawStateTable items_;
std::shared_ptr<void const> hold_;
Expand Down Expand Up @@ -189,7 +189,7 @@ class OpenView final : public ReadView, public TxsRawView
// ReadView

LedgerHeader const&
info() const override;
header() const override;

Fees const&
fees() const override;
Expand Down
6 changes: 3 additions & 3 deletions include/xrpl/ledger/ReadView.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ReadView

/** Returns information about the ledger. */
virtual LedgerHeader const&
info() const = 0;
header() const = 0;

/** Returns true if this reflects an open ledger. */
virtual bool
Expand All @@ -91,14 +91,14 @@ class ReadView
NetClock::time_point
parentCloseTime() const
{
return info().parentCloseTime;
return header().parentCloseTime;
}

/** Returns the sequence number of the base ledger. */
LedgerIndex
seq() const
{
return info().seq;
return header().seq;
}

/** Returns the fees for the base ledger. */
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/ledger/detail/ApplyViewBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ApplyViewBase : public ApplyView, public RawView
open() const override;

LedgerHeader const&
info() const override;
header() const override;

Fees const&
fees() const override;
Expand Down
4 changes: 2 additions & 2 deletions src/libxrpl/ledger/ApplyViewBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ ApplyViewBase::open() const
}

LedgerHeader const&
ApplyViewBase::info() const
ApplyViewBase::header() const
{
return base_->info();
return base_->header();
}

Fees const&
Expand Down
4 changes: 2 additions & 2 deletions src/libxrpl/ledger/CredentialHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checkExpired(
bool
removeExpired(ApplyView& view, STVector256 const& arr, beast::Journal const j)
{
auto const closeTime = view.info().parentCloseTime;
auto const closeTime = view.header().parentCloseTime;
bool foundExpired = false;

for (auto const& h : arr)
Expand Down Expand Up @@ -181,7 +181,7 @@ validDomain(ReadView const& view, uint256 domainID, AccountID const& subject)
if (!slePD)
return tecOBJECT_NOT_FOUND;

auto const closeTime = view.info().parentCloseTime;
auto const closeTime = view.header().parentCloseTime;
bool foundExpired = false;
for (auto const& h : slePD->getFieldArray(sfAcceptedCredentials))
{
Expand Down
22 changes: 11 additions & 11 deletions src/libxrpl/ledger/OpenView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ OpenView::OpenView(OpenView const& rhs)
boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)}
, txs_{rhs.txs_, monotonic_resource_.get()}
, rules_{rhs.rules_}
, info_{rhs.info_}
, header_{rhs.header_}
, base_{rhs.base_}
, items_{rhs.items_}
, hold_{rhs.hold_}
Expand All @@ -76,23 +76,23 @@ OpenView::OpenView(
boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)}
, txs_{monotonic_resource_.get()}
, rules_(rules)
, info_(base->info())
, header_(base->header())
, base_(base)
, hold_(std::move(hold))
{
info_.validated = false;
info_.accepted = false;
info_.seq = base_->info().seq + 1;
info_.parentCloseTime = base_->info().closeTime;
info_.parentHash = base_->info().hash;
header_.validated = false;
header_.accepted = false;
header_.seq = base_->header().seq + 1;
header_.parentCloseTime = base_->header().closeTime;
header_.parentHash = base_->header().hash;
}

OpenView::OpenView(ReadView const* base, std::shared_ptr<void const> hold)
: monotonic_resource_{std::make_unique<
boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)}
, txs_{monotonic_resource_.get()}
, rules_(base->rules())
, info_(base->info())
, header_(base->header())
, base_(base)
, hold_(std::move(hold))
, open_(base->open())
Expand All @@ -116,9 +116,9 @@ OpenView::apply(TxsRawView& to) const
//---

LedgerHeader const&
OpenView::info() const
OpenView::header() const
{
return info_;
return header_;
}

Fees const&
Expand Down Expand Up @@ -230,7 +230,7 @@ void
OpenView::rawDestroyXRP(XRPAmount const& fee)
{
items_.destroyXRP(fee);
// VFALCO Deduct from info_.totalDrops ?
// VFALCO Deduct from header_.totalDrops ?
// What about child views?
}

Expand Down
43 changes: 22 additions & 21 deletions src/libxrpl/ledger/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,14 +907,14 @@ areCompatible(
{
bool ret = true;

if (validLedger.info().seq < testLedger.info().seq)
if (validLedger.header().seq < testLedger.header().seq)
{
// valid -> ... -> test
auto hash = hashOfSeq(
testLedger,
validLedger.info().seq,
validLedger.header().seq,
beast::Journal{beast::Journal::getNullSink()});
if (hash && (*hash != validLedger.info().hash))
if (hash && (*hash != validLedger.header().hash))
{
JLOG(s) << reason << " incompatible with valid ledger";

Expand All @@ -923,14 +923,14 @@ areCompatible(
ret = false;
}
}
else if (validLedger.info().seq > testLedger.info().seq)
else if (validLedger.header().seq > testLedger.header().seq)
{
// test -> ... -> valid
auto hash = hashOfSeq(
validLedger,
testLedger.info().seq,
testLedger.header().seq,
beast::Journal{beast::Journal::getNullSink()});
if (hash && (*hash != testLedger.info().hash))
if (hash && (*hash != testLedger.header().hash))
{
JLOG(s) << reason << " incompatible preceding ledger";

Expand All @@ -940,8 +940,8 @@ areCompatible(
}
}
else if (
(validLedger.info().seq == testLedger.info().seq) &&
(validLedger.info().hash != testLedger.info().hash))
(validLedger.header().seq == testLedger.header().seq) &&
(validLedger.header().hash != testLedger.header().hash))
{
// Same sequence number, different hash
JLOG(s) << reason << " incompatible ledger";
Expand All @@ -951,11 +951,11 @@ areCompatible(

if (!ret)
{
JLOG(s) << "Val: " << validLedger.info().seq << " "
<< to_string(validLedger.info().hash);
JLOG(s) << "Val: " << validLedger.header().seq << " "
<< to_string(validLedger.header().hash);

JLOG(s) << "New: " << testLedger.info().seq << " "
<< to_string(testLedger.info().hash);
JLOG(s) << "New: " << testLedger.header().seq << " "
<< to_string(testLedger.header().hash);
}

return ret;
Expand All @@ -971,7 +971,7 @@ areCompatible(
{
bool ret = true;

if (testLedger.info().seq > validIndex)
if (testLedger.header().seq > validIndex)
{
// Ledger we are testing follows last valid ledger
auto hash = hashOfSeq(
Expand All @@ -987,8 +987,8 @@ areCompatible(
}
}
else if (
(validIndex == testLedger.info().seq) &&
(testLedger.info().hash != validHash))
(validIndex == testLedger.header().seq) &&
(testLedger.header().hash != validHash))
{
JLOG(s) << reason << " incompatible ledger";

Expand All @@ -999,8 +999,8 @@ areCompatible(
{
JLOG(s) << "Val: " << validIndex << " " << to_string(validHash);

JLOG(s) << "New: " << testLedger.info().seq << " "
<< to_string(testLedger.info().hash);
JLOG(s) << "New: " << testLedger.header().seq << " "
<< to_string(testLedger.header().hash);
}

return ret;
Expand Down Expand Up @@ -1071,9 +1071,9 @@ hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal)
return std::nullopt;
}
if (seq == ledger.seq())
return ledger.info().hash;
return ledger.header().hash;
if (seq == (ledger.seq() - 1))
return ledger.info().parentHash;
return ledger.header().parentHash;

if (int diff = ledger.seq() - seq; diff <= 256)
{
Expand All @@ -1095,7 +1095,7 @@ hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal)
else
{
JLOG(journal.warn())
<< "Ledger " << ledger.seq() << ":" << ledger.info().hash
<< "Ledger " << ledger.seq() << ":" << ledger.header().hash
<< " missing normal list";
}
}
Expand Down Expand Up @@ -1180,7 +1180,8 @@ pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey)
for (std::uint16_t i = 0; i < maxAccountAttempts; ++i)
{
ripesha_hasher rsh;
auto const hash = sha512Half(i, view.info().parentHash, pseudoOwnerKey);
auto const hash =
sha512Half(i, view.header().parentHash, pseudoOwnerKey);
rsh(hash.data(), hash.size());
AccountID const ret{static_cast<ripesha_hasher::result_type>(rsh)};
if (!view.read(keylet::account(ret)))
Expand Down
2 changes: 1 addition & 1 deletion src/test/app/AMM_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3646,7 +3646,7 @@ struct AMM_test : public jtx::AMMTest
auto const pk = carol.pk();
auto const settleDelay = 100s;
NetClock::time_point const cancelAfter =
env.current()->info().parentCloseTime + 200s;
env.current()->header().parentCloseTime + 200s;
env(paychan::create(
carol,
ammAlice.ammAccount(),
Expand Down
2 changes: 1 addition & 1 deletion src/test/app/AccountDelete_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ class AccountDelete_test : public beast::unit_test::suite

auto jv = credentials::create(john, carol, credType);
uint32_t const t = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count() +
20;
Expand Down
8 changes: 4 additions & 4 deletions src/test/app/Credentials_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ struct Credentials_test : public beast::unit_test::suite
auto const credKey = credentials::keylet(subject, issuer, credType);
auto jv = credentials::create(subject, issuer, credType);
uint32_t const t = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count();
jv[sfExpiration.jsonName] = t + 20;
Expand Down Expand Up @@ -498,7 +498,7 @@ struct Credentials_test : public beast::unit_test::suite
auto jv = credentials::create(subject, issuer, credType);
// current time in ripple epoch - 1s
uint32_t const t = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count() -
1;
Expand Down Expand Up @@ -725,7 +725,7 @@ struct Credentials_test : public beast::unit_test::suite
testcase("CredentialsAccept fail, expired credentials.");
auto jv = credentials::create(subject, issuer, credType2);
uint32_t const t = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count();
jv[sfExpiration.jsonName] = t;
Expand Down Expand Up @@ -870,7 +870,7 @@ struct Credentials_test : public beast::unit_test::suite
auto jv = credentials::create(subject, issuer, credType);
// current time in ripple epoch + 1000s
uint32_t const t = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count() +
1000;
Expand Down
8 changes: 4 additions & 4 deletions src/test/app/DepositAuth_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ struct DepositPreauth_test : public beast::unit_test::suite
// Current time in ripple epoch.
// Every time ledger close, unittest timer increase by 10s
uint32_t const t = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count() +
60;
Expand All @@ -1122,7 +1122,7 @@ struct DepositPreauth_test : public beast::unit_test::suite
// Create credential which not expired
jv = credentials::create(alice, issuer, credType2);
uint32_t const t2 = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count() +
1000;
Expand Down Expand Up @@ -1199,7 +1199,7 @@ struct DepositPreauth_test : public beast::unit_test::suite
{
auto jv = credentials::create(gw, issuer, credType);
uint32_t const t = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count() +
40;
Expand Down Expand Up @@ -1252,7 +1252,7 @@ struct DepositPreauth_test : public beast::unit_test::suite
// Create credentials
auto jv = credentials::create(zelda, issuer, credType);
uint32_t const t = env.current()
->info()
->header()
.parentCloseTime.time_since_epoch()
.count() +
50;
Expand Down
6 changes: 3 additions & 3 deletions src/test/app/LedgerHistory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LedgerHistory_test : public beast::unit_test::suite
env.app().getNodeFamily());
}
auto res = std::make_shared<Ledger>(
*prev, prev->info().closeTime + closeOffset);
*prev, prev->header().closeTime + closeOffset);

if (stx)
{
Expand All @@ -62,8 +62,8 @@ class LedgerHistory_test : public beast::unit_test::suite

// Accept ledger
res->setAccepted(
res->info().closeTime,
res->info().closeTimeResolution,
res->header().closeTime,
res->header().closeTimeResolution,
true /* close time correct*/);
lh.insert(res, false);
return res;
Expand Down
Loading
Loading