Skip to content

Commit 2af28e8

Browse files
committed
Style, comments.
1 parent 8281f1f commit 2af28e8

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/protocols/protocol_block_in_31800.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,11 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
281281
// Preconditions.
282282
// ........................................................................
283283

284-
auto& query = archive();
285-
const chain::block::cptr block{ message->block_ptr };
284+
// Intentional pointer copy.
285+
const auto block = message->block_ptr;
286286
const auto& hash = block->get_hash();
287287
const auto it = map_->find(hash);
288+
auto& query = archive();
288289

289290
if (it == map_->end())
290291
{
@@ -351,12 +352,6 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
351352
// Commit block.txs.
352353
// ........................................................................
353354

354-
// IMPORTANT: ~block() releases all memory for parts of itself, as a
355-
// consequence of the custom memory allocator. Therefore, while shared_ptr
356-
// to an element of the block would normally be valid after ~block(), the
357-
// object pointed to will have been deallocated by ~block(). Therefore a
358-
// reference to `block` must be passed to set_code.
359-
360355
// This invokes set_strong when checked.
361356
if (const auto code = query.set_code(*block, link, checked))
362357
{

0 commit comments

Comments
 (0)