lodestar icon indicating copy to clipboard operation
lodestar copied to clipboard

`getAllAncestorBlocks` should not return the self block

Open nazarhussain opened this issue 2 years ago • 0 comments

Describe the bug

Currently when the forkchoice.getAllAncestorBlocks is called with a block root. The resulting array contains the block itself as well.

Expected behavior

Any block is not an ancestor to itself so should not be part of the result for forkchoice.getAllAncestorBlocks.

Steps to Reproduce

const head = forkchoice.getHead();
const result = forkchoice.getAllAncestorBlocks(head)

// Check if the result contains the head or not

Desktop (please complete the following information):

  • Branch: [unstable]
  • Commit hash: https://github.com/ChainSafe/lodestar/commit/0886d751c52a9fc9b306bb26a328c0408bbfcd7d

nazarhussain avatar Sep 14 '22 14:09 nazarhussain