keep-core
keep-core copied to clipboard
Prevent pre-params generation during DKG
This PR adds a fix for the problem of parameter generating goroutines not being stopped on procedure start. The problem occurs when the parameter pool is full - the parameter generation goroutine generates one more parameter and it hangs on writing it to the pool. Stopping parameter generation does not stop the goroutine since it hangs, leaving a memory leak. Each round of parameter generation (resumption <=> stopping) generate such a hanging goroutine, and they are only stopped by TBTC DKG removing some parameters from the pool.
The simplest solution was to check if the pool is full and if it is so sleep instead of parameter generation.
The solution was tested locally.