hyperledger-labs / SmartBFT

Implementation of the SmartBFT consensus library (https://arxiv.org/abs/2107.06922)
Apache License 2.0
98 stars 27 forks source link

fix select #567

Closed pfi79 closed 12 months ago

pfi79 commented 1 year ago

I'm repeatedly running existing tests. Trying to make them more reliable.

On another iteration, I found that one test tries to complete but hangs because of this line:

v.inFlightDecideChan <- struct{}{}

inFlightDecideChan is a synchronous channel, and it waits "forever" for the subscriber on the other side of the channel.

How to fix this? Only by rewriting this part of the code to something similar to:

select {
case v.inFlightDecideChan <- struct{}{}:
    return
case <-v.stopChan:
    return
}