Fix tests

This commit is contained in:
Łukasz Magiera 2020-01-13 21:51:34 +01:00
parent 44112da971
commit 0402abe36b

View File

@ -27,6 +27,11 @@ var topic = "/fil/headnotifs/"
func init() { func init() {
genBytes := build.MaybeGenesis() genBytes := build.MaybeGenesis()
if len(genBytes) == 0 {
topic = ""
return
}
bs := blockstore.NewBlockstore(datastore.NewMapDatastore()) bs := blockstore.NewBlockstore(datastore.NewMapDatastore())
c, err := car.LoadCar(bs, bytes.NewReader(genBytes)) c, err := car.LoadCar(bs, bytes.NewReader(genBytes))
@ -49,6 +54,11 @@ var upgrader = websocket.Upgrader{
} }
func main() { func main() {
if topic == "" {
fmt.Println("FATAL: No genesis found")
return
}
ctx := context.Background() ctx := context.Background()
protec, err := pnet.NewProtector(strings.NewReader(lp2p.LotusKey)) protec, err := pnet.NewProtector(strings.NewReader(lp2p.LotusKey))