spacemeshos / go-spacemesh

Go Implementation of the Spacemesh protocol full node. 💾⏰💪

Home Page:https://spacemesh.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

avoid calls to WeightForSet for the same activeset

dshulyak opened this issue · comments

image

we compute and cache weight for every unique activeset. but when we start a node, we ask peers for all missed ballots layer by layer.
if we receive them at the same time code will try to compute WeightForSet for each ballot individually. if the number of simulateneously processed ballots is large it may trigger huge memory allocation.

the solution should be to compute WeightForSet only for the first ballot, and the rest should subscribe and wait until that computation has finished.