@@ -324,39 +324,6 @@ bool protocol_block_in::handle_receive_block(const code& ec,
324324 return true ;
325325}
326326
327- void protocol_block_in::handle_orphan_block (const code& ec,
328- size_t position, block_const_ptr message)
329- {
330- if (stopped (ec))
331- return ;
332-
333- const auto & txs = message->transactions ();
334-
335- if (!ec && position > 0 )
336- {
337- BITCOIN_ASSERT (position < txs.size ());
338- const auto encoded = encode_hash (txs[position].hash ());
339-
340- LOG_DEBUG (LOG_NODE)
341- << " Scavenged transaction [" << encoded << " ] from ["
342- << authority () << " ]." ;
343- }
344-
345- // Start by incrementing past the presumed coinbase, and so-on.
346- if (++position >= txs.size ())
347- {
348- // Ask the peer for blocks from the chain top up to this orphan.
349- send_get_blocks (message->hash ());
350- return ;
351- }
352-
353- // TODO: store txs in shared pointer list within block.
354- auto tx = std::make_shared<const message::transaction>(txs[position]);
355-
356- // Recursion is broken up by the organizer's priority pool transition.
357- chain_.organize (tx, BIND3 (handle_orphan_block, _1, position, message));
358- }
359-
360327// The block has been saved to the block chain (or not).
361328// This will be picked up by subscription in block_out and will cause the block
362329// to be announced to non-originating peers.
@@ -367,18 +334,16 @@ void protocol_block_in::handle_store_block(const code& ec,
367334 return ;
368335
369336 const auto hash = message->header ().hash ();
370- const auto encoded = encode_hash (hash);
371337
338+ // Ask the peer for blocks from the chain top up to this orphan.
372339 if (ec == error::orphan_block)
373- {
374- LOG_DEBUG (LOG_NODE)
375- << " Scavenging orphan block [" << encoded << " ] from ["
376- << authority () << " ]" ;
377- handle_orphan_block (error::success, 0 , message);
378- return ;
379- }
340+ send_get_blocks (hash);
341+
342+ const auto encoded = encode_hash (hash);
380343
381- if (ec == error::duplicate_block || ec == error::insufficient_work)
344+ if (ec == error::orphan_block ||
345+ ec == error::duplicate_block ||
346+ ec == error::insufficient_work)
382347 {
383348 LOG_DEBUG (LOG_NODE)
384349 << " Captured block [" << encoded << " ] from [" << authority ()
0 commit comments