2019-09-23 19:24:42 +00:00
|
|
|
package blockchain
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io/ioutil"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
|
|
logrus.SetOutput(ioutil.Discard)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestChainService_SaveHead_DataRace(t *testing.T) {
|
|
|
|
db := testDB.SetupDB(t)
|
|
|
|
defer testDB.TeardownDB(t, db)
|
|
|
|
s := &Service{
|
2020-02-15 18:57:49 +00:00
|
|
|
beaconDB: db,
|
2019-09-23 19:24:42 +00:00
|
|
|
}
|
|
|
|
go func() {
|
|
|
|
s.saveHead(
|
|
|
|
context.Background(),
|
|
|
|
[32]byte{},
|
|
|
|
)
|
|
|
|
}()
|
|
|
|
s.saveHead(
|
|
|
|
context.Background(),
|
|
|
|
[32]byte{},
|
|
|
|
)
|
|
|
|
}
|