mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Tidy SetHex* function calls & misc cleanups
* Renamed SetHexExact -> SetHexUnchecked * Removed calls to SetHexUnchecked with empty strings * Marked ledger class as final, as it calls virtuals in its ctor
This commit is contained in:
@@ -626,7 +626,7 @@ std::tuple<Ledger::pointer, std::uint32_t, uint256>
|
||||
loadLedgerHelper(std::string const& sqlSuffix)
|
||||
{
|
||||
Ledger::pointer ledger;
|
||||
uint256 ledgerHash;
|
||||
uint256 ledgerHash{};
|
||||
std::uint32_t ledgerSeq{0};
|
||||
|
||||
auto db = getApp ().getLedgerDB ().checkoutDb ();
|
||||
@@ -665,11 +665,15 @@ loadLedgerHelper(std::string const& sqlSuffix)
|
||||
ledgerSeq =
|
||||
rangeCheckedCast<std::uint32_t>(ledgerSeq64.value_or (0));
|
||||
|
||||
uint256 prevHash, accountHash, transHash;
|
||||
ledgerHash.SetHexExact (sLedgerHash.value_or(""));
|
||||
prevHash.SetHexExact (sPrevHash.value_or(""));
|
||||
accountHash.SetHexExact (sAccountHash.value_or(""));
|
||||
transHash.SetHexExact (sTransHash.value_or(""));
|
||||
uint256 prevHash{}, accountHash{}, transHash{};
|
||||
if (sLedgerHash)
|
||||
ledgerHash.SetHexExact (*sLedgerHash);
|
||||
if (sPrevHash)
|
||||
prevHash.SetHexExact (*sPrevHash);
|
||||
if (sAccountHash)
|
||||
accountHash.SetHexExact (*sAccountHash);
|
||||
if (sTransHash)
|
||||
transHash.SetHexExact (*sTransHash);
|
||||
|
||||
bool loaded = false;
|
||||
ledger = std::make_shared<Ledger>(prevHash,
|
||||
@@ -818,7 +822,10 @@ Ledger::getHashesByIndex (std::uint32_t minSeq, std::uint32_t maxSeq)
|
||||
std::pair<uint256, uint256>& hashes =
|
||||
ret[rangeCheckedCast<std::uint32_t>(ls)];
|
||||
hashes.first.SetHexExact (lh);
|
||||
hashes.second.SetHexExact (ph.value_or (""));
|
||||
if (ph)
|
||||
hashes.second.SetHexExact (*ph);
|
||||
else
|
||||
hashes.second.zero ();
|
||||
if (!ph)
|
||||
{
|
||||
WriteLog (lsWARNING, Ledger)
|
||||
|
||||
@@ -68,8 +68,9 @@ extern create_genesis_t const create_genesis;
|
||||
3) Mutable ledgers cannot be shared.
|
||||
|
||||
@note Presented to clients as ReadView
|
||||
@note Calls virtuals in the constructor, so marked as final
|
||||
*/
|
||||
class Ledger
|
||||
class Ledger final
|
||||
: public std::enable_shared_from_this <Ledger>
|
||||
, public DigestAwareReadView
|
||||
, public TxsRawView
|
||||
|
||||
Reference in New Issue
Block a user