-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
Note: this PR will be the first containing a divergence from LES as-specified. Perhaps we should choose another protocol identifier? |
Does it break compatibility with go-ethereum implementation? |
yes, although there's no server/client capability exposed yet. |
} | ||
} | ||
} | ||
let needed_hdr = needed_hdr.expect("`needed_hdr` always set in loop, number checked before; qed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not really clear that needed_hdr
is always set. Is req.block_number
guaranteed to be within the range?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's guaranteed by the check that req.cht_number
is equal to the calculated CHT number based on the block number in the request. this means that the function has already returned in the case that the requested number wouldn't fall within the range of blocks we iterate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, if we don't have all the blocks in that range, we also return early. The CHT number should probably be omitted in the future because it is derivable from a block number and only serves to give misbehaving peers a method of misbehavior.
Closes #3458 (for now)
For now, Tries are always calculated on-demand. This will likely be changed in the future to maintain an LRU-Cache of recently-generated CHTs.
Also adds some more tests and documentation.