mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 03:51:29 +00:00
d17996f8b0
* Update V3 from V4 * Fix build v3 -> v4 * Update ssz * Update beacon_chain.pb.go * Fix formatter import * Update update-mockgen.sh comment to v4 * Fix conflicts. Pass build and tests * Fix test
33 lines
848 B
Go
33 lines
848 B
Go
package blockchain
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"testing"
|
|
|
|
testDB "github.com/prysmaticlabs/prysm/v4/beacon-chain/db/testing"
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/blocks"
|
|
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
|
"github.com/prysmaticlabs/prysm/v4/testing/util"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func init() {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
logrus.SetOutput(io.Discard)
|
|
}
|
|
|
|
func TestChainService_SaveHead_DataRace(t *testing.T) {
|
|
beaconDB := testDB.SetupDB(t)
|
|
s := &Service{
|
|
cfg: &config{BeaconDB: beaconDB},
|
|
}
|
|
b, err := blocks.NewSignedBeaconBlock(util.NewBeaconBlock())
|
|
st, _ := util.DeterministicGenesisState(t, 1)
|
|
require.NoError(t, err)
|
|
go func() {
|
|
require.NoError(t, s.saveHead(context.Background(), [32]byte{}, b, st))
|
|
}()
|
|
require.NoError(t, s.saveHead(context.Background(), [32]byte{}, b, st))
|
|
}
|