@@ -50,8 +50,7 @@ chaser_confirm::chaser_confirm(full_node& node) NOEXCEPT
5050code chaser_confirm::start () NOEXCEPT
5151{
5252 const auto & query = archive ();
53- filters_ = query.neutrino_enabled ();
54- reset_position (query.get_fork ());
53+ set_position (query.get_fork ());
5554 SUBSCRIBE_EVENTS (handle_event, _1, _2, _3);
5655 return error::success;
5756}
@@ -163,7 +162,7 @@ void chaser_confirm::do_regressed(height_t branch_point) NOEXCEPT
163162 }
164163 }
165164
166- reset_position (branch_point);
165+ set_position (branch_point);
167166}
168167
169168// Candidate block validated at given height, if next then confirm/advance.
@@ -189,108 +188,93 @@ void chaser_confirm::do_bump(height_t) NOEXCEPT
189188 const auto link = query.to_candidate (height);
190189 auto ec = query.get_block_state (link);
191190
192- // Don't report bypassed block is confirmable until associated.
193191 if (ec == database::error::unassociated)
192+ {
193+ // Wait until the gap is filled.
194194 return ;
195-
196- if (is_under_checkpoint (height) || query.is_milestone (link))
195+ }
196+ else if (is_under_checkpoint (height) || query.is_milestone (link))
197197 {
198- notify (error::success, chase::confirmable, height);
199- fire (events::confirm_bypassed, height);
200- LOGV (" Block confirmation bypassed: " << height);
201- // //return;
198+ // Fall through (report confirmed).
199+ }
200+ else if (ec == database::error::unvalidated)
201+ {
202+ // Wait until this block is validated.
203+ return ;
202204 }
203205 else if (ec == database::error::block_valid)
204206 {
205- if (!query.set_strong (link))
206- {
207- fault (error::confirm2);
208- return ;
209- }
210-
211- // ////////////////////////////////////////
212207 // Confirmation query.
213- // This will pull from new prevouts table.
214- // ////////////////////////////////////////
215208 if ((ec = query.block_confirmable (link)))
216209 {
217210 if (ec == database::error::integrity)
218211 {
219- fault (error::confirm3 );
212+ fault (error::confirm2 );
220213 return ;
221214 }
222215
223216 if (!query.set_block_unconfirmable (link))
224217 {
225- fault (error::confirm4);
226- return ;
227- }
228-
229- if (!query.set_unstrong (link))
230- {
231- fault (error::confirm5);
218+ fault (error::confirm3);
232219 return ;
233220 }
234221
235- // Blocks between link and fork point will be set_unstrong
236- // by header reorganization, picked up by do_regressed.
237222 notify (ec, chase::unconfirmable, link);
238223 fire (events::block_unconfirmable, height);
239- LOGR (" Unconfirmable block [" << height << " ] "
240- << ec.message ());
224+ LOGR (" Unconfirmable block [" << height << " ] " << ec.message ());
241225 return ;
242226 }
243227
244228 if (!query.set_block_confirmable (link))
245229 {
246- fault (error::confirm6 );
230+ fault (error::confirm4 );
247231 return ;
248232 }
249233
250- if (!set_organized (link, height ))
234+ if (!query. set_strong (link))
251235 {
252- fault (error::confirm7 );
236+ fault (error::confirm5 );
253237 return ;
254238 }
255-
256- notify (error::success, chase::confirmable, height);
257- fire (events::block_confirmed, height);
258- LOGV (" Block confirmed: " << height);
259- // //return;
260239 }
261240 else if (ec == database::error::block_confirmable)
262241 {
263242 if (!query.set_strong (link))
264243 {
265- fault (error::confirm8 );
244+ fault (error::confirm6 );
266245 return ;
267246 }
268-
269- notify (error::success, chase::confirmable, height);
270- fire (events::confirm_bypassed, height);
271- LOGV (" Block previously confirmable: " << height);
272- // //return;
273247 }
274248 else
275249 {
276250 // With or without an error code, shouldn't be here.
251+ // database::error::unassociated [wait state ]
252+ // database::error::unvalidated [wait state ]
277253 // database::error::block_valid [canonical state ]
278254 // database::error::block_confirmable [resurrected state]
279255 // database::error::block_unconfirmable [shouldn't be here]
280256 // database::error::unknown_state [shouldn't be here]
281- // database::error::unassociated [shouldn't be here]
282- // database::error::unvalidated [shouldn't be here]
283- fault (error::confirm9);
257+ fault (error::confirm7);
258+ return ;
259+ }
260+
261+ if (!query.set_filter_head (link))
262+ {
263+ fault (error::confirm8);
284264 return ;
285265 }
286266
287- if (!update_neutrino (link))
267+ if (!set_organized (link, height ))
288268 {
289- fault (error::confirm10 );
269+ fault (error::confirm9 );
290270 return ;
291271 }
292272
293273 set_position (height);
274+
275+ notify (error::success, chase::confirmable, height);
276+ fire (events::block_confirmed, height);
277+ // //LOGV("Block confirmed: " << height);
294278 }
295279}
296280
@@ -624,42 +608,6 @@ bool chaser_confirm::get_is_strong(bool& strong, const uint256_t& fork_work,
624608 return true ;
625609}
626610
627- // neutrino
628- // ----------------------------------------------------------------------------
629-
630- bool chaser_confirm::update_neutrino (const header_link& link) NOEXCEPT
631- {
632- // neutrino_.link is only used for this assertion, should compile away.
633- BC_ASSERT (archive ().get_height (link) ==
634- add1 (archive ().get_height (neutrino_.link )));
635-
636- if (!filters_)
637- return true ;
638-
639- data_chunk filter{};
640- auto & query = archive ();
641- if (!query.get_filter_body (filter, link))
642- return false ;
643-
644- neutrino_.link = link;
645- neutrino_.head = neutrino::compute_filter_header (neutrino_.head , filter);
646- return query.set_filter_head (link, neutrino_.head );
647- }
648-
649- // Expects confirmed height.
650- // Use for startup and regression, to read current filter header from store.
651- void chaser_confirm::reset_position (size_t confirmed_height) NOEXCEPT
652- {
653- set_position (confirmed_height);
654-
655- if (filters_)
656- {
657- const auto & query = archive ();
658- neutrino_.link = query.to_confirmed (confirmed_height);
659- query.get_filter_head (neutrino_.head , neutrino_.link );
660- }
661- }
662-
663611// Strand.
664612// ----------------------------------------------------------------------------
665613
0 commit comments