@@ -281,8 +281,8 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
281
281
// Preconditions.
282
282
// ........................................................................
283
283
284
- // Intentional pointer copy .
285
- const auto block = message->block_ptr ;
284
+ // message lifetime is guaranteed, and therefore block_ptr is as well .
285
+ const auto & block = message->block_ptr ;
286
286
const auto & hash = block->get_hash ();
287
287
const auto it = map_->find (hash);
288
288
auto & query = archive ();
@@ -353,11 +353,6 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
353
353
return false ;
354
354
}
355
355
356
- // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
357
- // This is an attempt to keep the shared pointer in scope.
358
- // Given that block is const this could also be reordered prior to check().
359
- // But this is not called in this scope, only by message deserialization.
360
- // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
361
356
if (!block->is_valid ())
362
357
{
363
358
stop (fault (error::protocol2));
@@ -372,11 +367,6 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
372
367
373
368
notify (ec, chase::checked, height);
374
369
fire (events::block_archived, height);
375
-
376
- // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
377
- // block->serialized_size may keep block in scope during set_code above.
378
- // However the compiler may reorder this calculation since block is const.
379
- // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
380
370
count (block->serialized_size (true ));
381
371
map_->erase (it);
382
372
if (is_idle ())
0 commit comments