mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Small Ledger cleanups and improvements:
* Remove call to updateHash in LedgerConsensus::accept * Correct serialization size in updateHash * Add some comments to setImmutable and setAccepted
This commit is contained in:
@@ -928,8 +928,6 @@ private:
|
||||
}
|
||||
|
||||
newLCL->setAccepted (closeTime, mCloseResolution, closeTimeCorrect);
|
||||
newLCL->updateHash ();
|
||||
newLCL->setImmutable ();
|
||||
getApp().getLedgerMaster().storeLedger(newLCL);
|
||||
|
||||
WriteLog (lsDEBUG, LedgerConsensus)
|
||||
|
||||
@@ -220,6 +220,8 @@ Ledger::~Ledger ()
|
||||
|
||||
void Ledger::setImmutable ()
|
||||
{
|
||||
// Updates the hash and marks the ledger and its maps immutable
|
||||
|
||||
updateHash ();
|
||||
mImmutable = true;
|
||||
|
||||
@@ -245,8 +247,8 @@ void Ledger::updateHash ()
|
||||
mAccountHash.zero ();
|
||||
}
|
||||
|
||||
// VFALCO TODO Fix this hard coded magic number 118
|
||||
Serializer s (118);
|
||||
// VFALCO TODO Fix this hard coded magic number 122
|
||||
Serializer s (122);
|
||||
s.add32 (HashPrefix::ledgerMaster);
|
||||
addRaw (s);
|
||||
mHash = s.getSHA512Half ();
|
||||
@@ -296,6 +298,7 @@ void Ledger::addRaw (Serializer& s) const
|
||||
void Ledger::setAccepted (std::uint32_t closeTime, int closeResolution, bool correctCloseTime)
|
||||
{
|
||||
// used when we witnessed the consensus
|
||||
// Rounds the close time, updates the hash, and sets the ledger accepted and immutable
|
||||
assert (mClosed && !mAccepted);
|
||||
mCloseTime = correctCloseTime ? roundCloseTime (closeTime, closeResolution) : closeTime;
|
||||
mCloseResolution = closeResolution;
|
||||
|
||||
Reference in New Issue
Block a user