示例#1
0
func (cli *grpcClient) EndBlockAsync(height uint64) *ReqRes {
	req := types.ToRequestEndBlock(height)
	res, err := cli.client.EndBlock(context.Background(), req.GetEndBlock(), grpc.FailFast(true))
	if err != nil {
		cli.StopForError(err)
	}
	return cli.finishAsyncCall(req, &types.Response{&types.Response_EndBlock{res}})
}
示例#2
0
func (cli *socketClient) EndBlockSync(height uint64) (validators []*types.Validator, err error) {
	reqres := cli.queueRequest(types.ToRequestEndBlock(height))
	cli.FlushSync()
	if err := cli.Error(); err != nil {
		return nil, err
	}
	return reqres.Response.GetEndBlock().Diffs, nil
}
示例#3
0
func (app *localClient) EndBlockAsync(height uint64) *ReqRes {
	app.mtx.Lock()
	var validators []*types.Validator
	if bcApp, ok := app.Application.(types.BlockchainAware); ok {
		validators = bcApp.EndBlock(height)
	}
	app.mtx.Unlock()
	return app.callback(
		types.ToRequestEndBlock(height),
		types.ToResponseEndBlock(validators),
	)
}
示例#4
0
func (cli *socketClient) EndBlockAsync(height uint64) *ReqRes {
	return cli.queueRequest(types.ToRequestEndBlock(height))
}