celestiaorg / go-header

Go library with all the services needed to request, sync and store blockchain headers.
Apache License 2.0
19 stars 18 forks source link

store: drop `NewStoreWithHead` by adding an option to `NewStore` #188

Closed cristaloleg closed 3 months ago

cristaloleg commented 4 months ago

NewStoreWithHead is just a wrapper of NewStore that does additional initialization with a given header. Which is fine but at the same time does more than just creating a new store.

I'm proposing to drop this function and add an option to NewStore that can do the same, something like WithInitHeader which will set initial (head) header and as a result NewStore will call Store.Init.

On the other hand just dropping NewStoreWithHead and moving to NewStore + Store.Init will be better to distinguish this two completely different steps.

Updates #187