Skip to content

Commit a44f77a

Browse files
authored
Merge pull request #757 from evoskuil/master
Integrate compact filtering.
2 parents f17fcde + ba23b4f commit a44f77a

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

src/chasers/chaser_confirm.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,19 @@ void chaser_confirm::do_bump(height_t) NOEXCEPT
184184
}
185185
else if (is_under_checkpoint(height) || query.is_milestone(link))
186186
{
187+
// Dont update position until this block is filtered.
188+
if (!query.is_filtereable(link))
189+
return;
190+
191+
if (!query.set_filter_head(link))
192+
{
193+
fault(error::confirm9);
194+
return;
195+
}
196+
187197
// Fall through (report confirmed).
198+
if (query.filter_enabled())
199+
fire(events::tx_validated, height);
188200
}
189201
else if (ec == database::error::unvalidated)
190202
{
@@ -222,6 +234,18 @@ void chaser_confirm::do_bump(height_t) NOEXCEPT
222234
return;
223235
}
224236

237+
// Set before changing block state.
238+
if (query.set_filter_head(link))
239+
{
240+
if (query.filter_enabled())
241+
fire(events::tx_validated, height);
242+
}
243+
else
244+
{
245+
fault(error::confirm9);
246+
return;
247+
}
248+
225249
// Otherwise we will reconfirm entire chain on restart.
226250
if (!query.set_block_confirmable(link))
227251
{
@@ -258,12 +282,6 @@ void chaser_confirm::do_bump(height_t) NOEXCEPT
258282
return;
259283
}
260284

261-
////if (!query.set_filter_head(link))
262-
////{
263-
//// fault(error::confirm9);
264-
//// return;
265-
////}
266-
267285
if (!set_organized(link, height))
268286
{
269287
fault(error::confirm10);

src/chasers/chaser_validate.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,16 @@ void chaser_validate::validate_block(const header_link& link,
227227
if (!query.set_block_unconfirmable(link))
228228
ec = error::validate4;
229229
}
230-
////else if (!query.set_filter_body(link, *block))
231-
////{
232-
//// ec = error::validate5;
233-
////}
230+
else if (query.set_filter_body(link, *block))
231+
{
232+
if (query.filter_enabled())
233+
fire(events::tx_archived, ctx.height);
234+
}
235+
else
236+
{
237+
ec = error::validate5;
238+
}
239+
234240

235241
backlog_.fetch_sub(one, std::memory_order_relaxed);
236242

0 commit comments

Comments
 (0)