begin block
This commit is contained in:
parent
c05b2c5c59
commit
c3d5634efa
|
@ -14,7 +14,7 @@ type AppConnConsensus interface {
|
|||
|
||||
InitChainSync(validators []*types.Validator) (err error)
|
||||
|
||||
BeginBlockSync(height uint64) (err error)
|
||||
BeginBlockSync(header *types.Header) (err error)
|
||||
AppendTxAsync(tx []byte) *tmspcli.ReqRes
|
||||
EndBlockSync(height uint64) (changedValidators []*types.Validator, err error)
|
||||
CommitSync() (res types.Result)
|
||||
|
@ -34,7 +34,7 @@ type AppConnQuery interface {
|
|||
Error() error
|
||||
|
||||
EchoSync(string) (res types.Result)
|
||||
InfoSync() (res types.Result)
|
||||
InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo)
|
||||
QuerySync(tx []byte) (res types.Result)
|
||||
|
||||
// SetOptionSync(key string, value string) (res types.Result)
|
||||
|
@ -62,8 +62,8 @@ func (app *appConnConsensus) Error() error {
|
|||
func (app *appConnConsensus) InitChainSync(validators []*types.Validator) (err error) {
|
||||
return app.appConn.InitChainSync(validators)
|
||||
}
|
||||
func (app *appConnConsensus) BeginBlockSync(height uint64) (err error) {
|
||||
return app.appConn.BeginBlockSync(height)
|
||||
func (app *appConnConsensus) BeginBlockSync(header *types.Header) (err error) {
|
||||
return app.appConn.BeginBlockSync(header)
|
||||
}
|
||||
func (app *appConnConsensus) AppendTxAsync(tx []byte) *tmspcli.ReqRes {
|
||||
return app.appConn.AppendTxAsync(tx)
|
||||
|
@ -131,7 +131,7 @@ func (app *appConnQuery) EchoSync(msg string) (res types.Result) {
|
|||
return app.appConn.EchoSync(msg)
|
||||
}
|
||||
|
||||
func (app *appConnQuery) InfoSync() (res types.Result) {
|
||||
func (app *appConnQuery) InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
|
||||
return app.appConn.InfoSync()
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tmsp/types"
|
||||
)
|
||||
|
||||
// Convert tendermint types to protobuf types
|
||||
var TM2PB = tm2pb{}
|
||||
|
||||
type tm2pb struct{}
|
||||
|
||||
func (tm2pb) Header(header *Header) *types.Header {
|
||||
return &types.Header{
|
||||
ChainId: header.ChainID,
|
||||
Height: uint64(header.Height),
|
||||
Time: uint64(header.Time.Unix()),
|
||||
NumTxs: uint64(header.NumTxs),
|
||||
LastBlockHash: header.LastBlockHash,
|
||||
LastBlockParts: TM2PB.PartSetHeader(header.LastBlockParts),
|
||||
LastCommitHash: header.LastCommitHash,
|
||||
DataHash: header.DataHash,
|
||||
}
|
||||
}
|
||||
|
||||
func (tm2pb) PartSetHeader(partSetHeader PartSetHeader) *types.PartSetHeader {
|
||||
return &types.PartSetHeader{
|
||||
Total: uint64(partSetHeader.Total),
|
||||
Hash: partSetHeader.Hash,
|
||||
}
|
||||
}
|
||||
|
||||
func (tm2pb) Validator(val *Validator) *types.Validator {
|
||||
return &types.Validator{
|
||||
PubKey: val.PubKey.Bytes(),
|
||||
Power: uint64(val.VotingPower),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue