mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Limit the total number of offers processed while crossing
This commit is contained in:
@@ -25,13 +25,14 @@ namespace ripple {
|
||||
|
||||
OfferStream::OfferStream (ApplyView& view, ApplyView& cancelView,
|
||||
BookRef book, Clock::time_point when,
|
||||
beast::Journal journal)
|
||||
StepCounter& counter, beast::Journal journal)
|
||||
: j_ (journal)
|
||||
, view_ (view)
|
||||
, cancelView_ (cancelView)
|
||||
, book_ (book)
|
||||
, expire_ (when)
|
||||
, tip_ (view, book_)
|
||||
, counter_ (counter)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -89,6 +90,10 @@ OfferStream::step ()
|
||||
|
||||
std::shared_ptr<SLE> entry = tip_.entry();
|
||||
|
||||
// If we exceed the maximum number of allowed steps, we're done.
|
||||
if (!counter_.step ())
|
||||
return false;
|
||||
|
||||
// Remove if missing
|
||||
if (! entry)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user