go-header
go-header copied to clipboard
store: Head of store needs to be the *contiguous* head of the store
Currently in main, the head
of the store is updated when an Append is done (via #186) because the assumption was that the syncer only does contiguous Appends to the store. This is actually not true because the syncer can write to the store via Append inside incomingNetHead
whereby a header that comes in through headersub (or via p2p.Exchange request) can be verified non-adjacently and then applied to the store if it passes the non-adjacent verification.
We need to fix this by ensuring that the store knows of its own highest header that is contiguous (meaning all headers below the head
are adjacent).
Note: once the Tail()
method is implemented, the head
of the store should be the highest header that is contiguous all the way down to the Tail().Height()