add script to run a local devnet, and helper command
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
)
|
||||
|
||||
var waitApiCmd = &cli.Command{
|
||||
Name: "wait-api",
|
||||
Usage: "Wait for lotus api to come online",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
for i := 0; i < 30; i++ {
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
fmt.Printf("Not online yet... (%s)\n", err)
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
defer closer()
|
||||
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
_, err = api.ID(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("timed out waiting for api to come online")
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user