celestiaorg / celestiaorg/go-header

store: `HeightSub` should be able to notify callers of *any* new height written to the Store

Open
#202 1 comment 0 reactions 1 assignee Claimed by @cristaloleg View on GitHub
store
Dominant language
Go
Stars
21
Forks
33
Avg merge
5d 20h
Merged PRs (30d)
7

Description

Currently, heightSub keeps track of `height` which essentially the highest height written to the Store. Since Store now allows non-adjacent Appends, that `height` field is rendered useless (at least in the case of heightSub) as **it is not guaranteed that the highest header written to the store means that everything below is also written to the store**.

## Requested changes

* remove `height` field from `HeightSub` as it is no longer valuable

* `store.GetByHeight` should *first* do a `.Has` on the store to see if that height is already there, and then return the header if it exists in store -- and only if it does NOT yet exist, then subscribe to it via `heightSub`.

* `heightSub` should be able to "see" the height of every successful `Append` that happens on the store -- store should instead "Publish" to `heightSub` and `heightSub` notifs all of the callers of that height that it is now available.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.