diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3795,8 +3795,8 @@ pindex->GetBlockHash().ToString(), newBlockTimeDiff); } - bool fHasMoreWork = - (chainActive.Tip() ? pindex->nChainWork > chainActive.Tip()->nChainWork + bool fHasMoreOrSameWork = + (chainActive.Tip() ? pindex->nChainWork >= chainActive.Tip()->nChainWork : true); // Blocks that are too out-of-order needlessly limit the effectiveness of @@ -3821,7 +3821,7 @@ } // Don't process less-work chains. - if (!fHasMoreWork) { + if (!fHasMoreOrSameWork) { return true; } diff --git a/test/functional/p2p-acceptblock.py b/test/functional/p2p-acceptblock.py --- a/test/functional/p2p-acceptblock.py +++ b/test/functional/p2p-acceptblock.py @@ -159,13 +159,8 @@ assert(tip_entry_found) # But this block should be accepted by node since it has equal work. - # FIXME: Replace the assert with the commented lines once Core backport - # 932f118 is completed. Current behavior does not accept equal work - # blocks ontop of unprocessed blocks. - # self.nodes[0].getblock(block_h2f.hash) - #self.log.info("Second height 2 block accepted, but not reorg'ed to") - assert_raises_rpc_error(-1, "Block not found on disk", - self.nodes[0].getblock, block_h2f.hash) + self.nodes[0].getblock(block_h2f.hash) + self.log.info("Second height 2 block accepted, but not reorg'ed to") # 4b. Now send another block that builds on the forking chain. block_h3 = create_block( @@ -267,12 +262,6 @@ # 7. Send the missing block for the third time (now it is requested) test_node.send_message(msg_block(block_h1f)) - # 7.b. Send the next missing block now that it's requested. - # FIXME: Remove this line once Core backport 932f118 is completed. - # Current behavior is to not process equal work blocks building ontop - # of unprocessed blocks. - test_node.send_message(msg_block(block_h2f)) - test_node.sync_with_ping() assert_equal(self.nodes[0].getblockcount(), 290) self.nodes[0].getblock(all_blocks[286].hash)