mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-26 13:40:05 +00:00
f7fc4d66ec
* Remove silkworm and reader builders * Switch tests * Stop from hanging * Update tests to 9.0.0 * Move tests back * Moving code around * Fix lint * More fixes * Intermediate * Fix compile * Fix compile errors * Compile errors * Fix lint * Comment out more printing * More simplifications * Compile fixes * Compile fix * More replacements * More fixes * More muddling through * lint * Exclude dao split test * Restore sidechains after unwind * Errors in senders stage, stopped in bodies stage * Fix compile * Fix compile * Fix tests * More fixes * More fixes * Code cleanup Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
31 lines
398 B
Go
31 lines
398 B
Go
package common
|
|
|
|
import "errors"
|
|
|
|
var ErrStopped = errors.New("stopped")
|
|
var ErrUnwind = errors.New("unwound")
|
|
|
|
func Stopped(ch <-chan struct{}) error {
|
|
if ch == nil {
|
|
return nil
|
|
}
|
|
select {
|
|
case <-ch:
|
|
return ErrStopped
|
|
default:
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func SafeClose(ch chan struct{}) {
|
|
if ch == nil {
|
|
return
|
|
}
|
|
select {
|
|
case <-ch:
|
|
// Channel was already closed
|
|
default:
|
|
close(ch)
|
|
}
|
|
}
|