示例#1
0
func (cli *grpcClient) BeginBlockAsync(height uint64) *ReqRes {
	req := types.ToRequestBeginBlock(height)
	res, err := cli.client.BeginBlock(context.Background(), req.GetBeginBlock(), grpc.FailFast(true))
	if err != nil {
		cli.StopForError(err)
	}
	return cli.finishAsyncCall(req, &types.Response{&types.Response_BeginBlock{res}})
}
示例#2
0
func (cli *socketClient) BeginBlockSync(height uint64) (err error) {
	cli.queueRequest(types.ToRequestBeginBlock(height))
	cli.FlushSync()
	if err := cli.Error(); err != nil {
		return err
	}
	return nil
}
示例#3
0
func (app *localClient) BeginBlockAsync(height uint64) *ReqRes {
	app.mtx.Lock()
	if bcApp, ok := app.Application.(types.BlockchainAware); ok {
		bcApp.BeginBlock(height)
	}
	app.mtx.Unlock()
	return app.callback(
		types.ToRequestBeginBlock(height),
		types.ToResponseBeginBlock(),
	)
}
示例#4
0
func (cli *socketClient) BeginBlockAsync(height uint64) *ReqRes {
	return cli.queueRequest(types.ToRequestBeginBlock(height))
}