mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 06:31:57 +00:00
Separated out certifiers.Commit from rpc structs
This commit is contained in:
+3
-3
@@ -280,7 +280,7 @@ func Commit(heightPtr *int) (*ctypes.ResultCommit, error) {
|
||||
height := blockStore.Height()
|
||||
header := blockStore.LoadBlockMeta(height).Header
|
||||
commit := blockStore.LoadSeenCommit(height)
|
||||
return &ctypes.ResultCommit{header, commit, false}, nil
|
||||
return ctypes.NewResultCommit(header, commit, false), nil
|
||||
}
|
||||
|
||||
height := *heightPtr
|
||||
@@ -298,10 +298,10 @@ func Commit(heightPtr *int) (*ctypes.ResultCommit, error) {
|
||||
// use a non-canonical commit
|
||||
if height == storeHeight {
|
||||
commit := blockStore.LoadSeenCommit(height)
|
||||
return &ctypes.ResultCommit{header, commit, false}, nil
|
||||
return ctypes.NewResultCommit(header, commit, false), nil
|
||||
}
|
||||
|
||||
// Return the canonical commit (comes from the block at height+1)
|
||||
commit := blockStore.LoadBlockCommit(height)
|
||||
return &ctypes.ResultCommit{header, commit, true}, nil
|
||||
return ctypes.NewResultCommit(header, commit, true), nil
|
||||
}
|
||||
|
||||
@@ -26,9 +26,24 @@ type ResultBlock struct {
|
||||
}
|
||||
|
||||
type ResultCommit struct {
|
||||
Header *types.Header `json:"header"`
|
||||
Commit *types.Commit `json:"commit"`
|
||||
CanonicalCommit bool `json:"canonical"`
|
||||
// SignedHeader is header and commit, embedded so we only have
|
||||
// one level in the json output
|
||||
types.SignedHeader
|
||||
CanonicalCommit bool `json:"canonical"`
|
||||
}
|
||||
|
||||
// NewResultCommit is a helper to initialize the ResultCommit with
|
||||
// the embedded struct
|
||||
func NewResultCommit(header *types.Header, commit *types.Commit,
|
||||
canonical bool) *ResultCommit {
|
||||
|
||||
return &ResultCommit{
|
||||
SignedHeader: types.SignedHeader{
|
||||
Header: header,
|
||||
Commit: commit,
|
||||
},
|
||||
CanonicalCommit: canonical,
|
||||
}
|
||||
}
|
||||
|
||||
type ResultStatus struct {
|
||||
|
||||
Reference in New Issue
Block a user