mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-23 17:51:39 +00:00
New TMSP message BeginBlock
This commit is contained in:
@ -108,6 +108,44 @@ func (app *localClient) CommitAsync() *ReqRes {
|
||||
)
|
||||
}
|
||||
|
||||
func (app *localClient) InitChainAsync(validators []*types.Validator) *ReqRes {
|
||||
app.mtx.Lock()
|
||||
if bcApp, ok := app.Application.(types.BlockchainAware); ok {
|
||||
bcApp.InitChain(validators)
|
||||
}
|
||||
reqRes := app.callback(
|
||||
types.RequestInitChain(validators),
|
||||
types.ResponseInitChain(),
|
||||
)
|
||||
app.mtx.Unlock()
|
||||
return reqRes
|
||||
}
|
||||
|
||||
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.RequestBeginBlock(height),
|
||||
types.ResponseBeginBlock(),
|
||||
)
|
||||
}
|
||||
|
||||
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.RequestEndBlock(height),
|
||||
types.ResponseEndBlock(validators),
|
||||
)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
|
||||
func (app *localClient) FlushSync() error {
|
||||
@ -169,6 +207,15 @@ func (app *localClient) InitChainSync(validators []*types.Validator) (err error)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (app *localClient) BeginBlockSync(height uint64) (err error) {
|
||||
app.mtx.Lock()
|
||||
if bcApp, ok := app.Application.(types.BlockchainAware); ok {
|
||||
bcApp.BeginBlock(height)
|
||||
}
|
||||
app.mtx.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (app *localClient) EndBlockSync(height uint64) (changedValidators []*types.Validator, err error) {
|
||||
app.mtx.Lock()
|
||||
if bcApp, ok := app.Application.(types.BlockchainAware); ok {
|
||||
|
Reference in New Issue
Block a user