mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Calculate deep offer quality
This commit is contained in:
committed by
Tom Ritchford
parent
d082a0696d
commit
6c81ea846c
@@ -44,6 +44,7 @@ private:
|
||||
uint256 m_dir;
|
||||
uint256 m_index;
|
||||
SLE::pointer m_entry;
|
||||
Quality m_quality;
|
||||
|
||||
LedgerView&
|
||||
view() const noexcept
|
||||
@@ -67,10 +68,10 @@ public:
|
||||
return m_index;
|
||||
}
|
||||
|
||||
Quality const
|
||||
Quality const&
|
||||
quality() const noexcept
|
||||
{
|
||||
return Quality (getQuality (m_dir));
|
||||
return m_quality;
|
||||
}
|
||||
|
||||
SLE::pointer const&
|
||||
|
||||
@@ -45,32 +45,36 @@ BookTip::step ()
|
||||
|
||||
for(;;)
|
||||
{
|
||||
// See if there's an entry at or worse than current quality.
|
||||
auto const page (
|
||||
view().getNextLedgerIndex (m_book, m_end));
|
||||
// See if there's an entry at or worse than current quality. Notice
|
||||
// that the quality is encoded only in the index of the first page
|
||||
// of a directory.
|
||||
auto const first_page (view().getNextLedgerIndex (m_book, m_end));
|
||||
|
||||
if (page.isZero())
|
||||
if (first_page.isZero())
|
||||
return false;
|
||||
|
||||
unsigned int di (0);
|
||||
SLE::pointer dir;
|
||||
if (view().dirFirst (page, dir, di, m_index))
|
||||
|
||||
if (view().dirFirst (first_page, dir, di, m_index))
|
||||
{
|
||||
m_dir = dir->getIndex();
|
||||
m_entry = view().entryCache (ltOFFER, m_index);
|
||||
m_quality = Quality (getQuality (first_page));
|
||||
m_valid = true;
|
||||
|
||||
// Next query should start before this directory
|
||||
m_book = page;
|
||||
m_book = first_page;
|
||||
|
||||
// The quality immediately before the next quality
|
||||
--m_book;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// There should never be an empty directory but just in case,
|
||||
// we handle that case by advancing to the next directory.
|
||||
m_book = page;
|
||||
m_book = first_page;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user