MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / WaitBPChainService

Function WaitBPChainService

test/helper.go:36–57  ·  view source on GitHub ↗

WaitBPChainService waits until BP chain service is ready.

(ctx context.Context, period time.Duration)

Source from the content-addressed store, hash-verified

34
35// WaitBPChainService waits until BP chain service is ready.
36func WaitBPChainService(ctx context.Context, period time.Duration) (err error) {
37 var (
38 ticker = time.NewTicker(period)
39 req = &types.FetchBlockReq{
40 Height: 0, // Genesis block
41 }
42 )
43 defer ticker.Stop()
44 for {
45 select {
46 case <-ticker.C:
47 if err = rpc.RequestBP(
48 route.MCCFetchBlock.String(), req, nil,
49 ); err == nil || !strings.Contains(err.Error(), "can't find service") {
50 return
51 }
52 case <-ctx.Done():
53 err = ctx.Err()
54 return
55 }
56 }
57}
58
59// Create allocates new database.
60func Create(

Callers 8

TestFullProcessFunction · 0.92
TestFullProcessFunction · 0.92
TestCQLDFunction · 0.92
initTestDBFunction · 0.92
TestFullProcessFunction · 0.92
benchMinerFunction · 0.92

Calls 4

ContainsMethod · 0.80
ErrorMethod · 0.80
StopMethod · 0.45
StringMethod · 0.45

Tested by 8

TestFullProcessFunction · 0.74
TestFullProcessFunction · 0.74
TestCQLDFunction · 0.74
initTestDBFunction · 0.74
TestFullProcessFunction · 0.74
benchMinerFunction · 0.74