mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 991 forks source link

horizon not relative to head during fast sync #803

Closed antiochp closed 6 years ago

antiochp commented 6 years ago

I think we're just using the horizon value as-is during fast-sync and not using it relative to the the head. So it is treated effectively as a hard-coded height.

https://github.com/mimblewimble/grin/blob/7c3994e5219ea8ca5ba1b744f650ff18df26fe3b/grin/src/sync.rs#L63

https://github.com/mimblewimble/grin/blob/7c3994e5219ea8ca5ba1b744f650ff18df26fe3b/grin/src/sync.rs#L106

ignopeverell commented 6 years ago

Looked at it again, I believe all the uses of horizon in sync.rs are correct. That specific check just handles a corner case to make sure the chain is at least horizon blocks long before really going ahead with asking for the state. However the height and hash at which the set are asked are calculated properly decreasing from the header head.

antiochp commented 6 years ago

Ahh that makes sense.