prysm-pulse/beacon-chain/state/getters_test.go
Victor Farazdagi 748d513c62
proper error checking and type assertions (#5424)
* proper error checking and type assertions
2020-04-14 16:41:09 +00:00

31 lines
458 B
Go

package state
import (
"sync"
"testing"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
)
func TestBeaconState_SlotDataRace(t *testing.T) {
headState, err := InitializeFromProto(&pb.BeaconState{Slot: 1})
if err != nil {
t.Fatal(err)
}
wg := sync.WaitGroup{}
wg.Add(2)
go func() {
if err := headState.SetSlot(uint64(0)); err != nil {
t.Fatal(err)
}
wg.Done()
}()
go func() {
headState.Slot()
wg.Done()
}()
wg.Wait()
}