|
@ -1,10 +1,12 @@ |
|
|
package types |
|
|
package types |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
|
|
|
"encoding/json" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"time" |
|
|
"time" |
|
|
|
|
|
|
|
|
"github.com/tendermint/tendermint/types" |
|
|
"github.com/tendermint/tendermint/types" |
|
|
|
|
|
cmn "github.com/tendermint/tmlibs/common" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
@ -77,6 +79,27 @@ type RoundState struct { |
|
|
LastValidators *types.ValidatorSet `json:"last_validators"` |
|
|
LastValidators *types.ValidatorSet `json:"last_validators"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type RoundStateSimple struct { |
|
|
|
|
|
HeightRoundStep string `json:"height/round/step"` |
|
|
|
|
|
StartTime time.Time `json:"start_time"` |
|
|
|
|
|
ProposalBlockHash cmn.HexBytes `json:"proposal_block_hash"` |
|
|
|
|
|
LockedBlockHash cmn.HexBytes `json:"locked_block_hash"` |
|
|
|
|
|
ValidBlockHash cmn.HexBytes `json:"valid_block_hash"` |
|
|
|
|
|
Votes json.RawMessage `json:"height_vote_set"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (rs *RoundState) RoundStateSimple() RoundStateSimple { |
|
|
|
|
|
votesJSON, _ := rs.Votes.MarshalJSON() // TODO err
|
|
|
|
|
|
return RoundStateSimple{ |
|
|
|
|
|
HeightRoundStep: fmt.Sprintf("%d/%d/%d", rs.Height, rs.Round, rs.Step), |
|
|
|
|
|
StartTime: rs.StartTime, |
|
|
|
|
|
ProposalBlockHash: rs.ProposalBlock.Hash(), |
|
|
|
|
|
LockedBlockHash: rs.LockedBlock.Hash(), |
|
|
|
|
|
ValidBlockHash: rs.ValidBlock.Hash(), |
|
|
|
|
|
Votes: votesJSON, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// RoundStateEvent returns the H/R/S of the RoundState as an event.
|
|
|
// RoundStateEvent returns the H/R/S of the RoundState as an event.
|
|
|
func (rs *RoundState) RoundStateEvent() types.EventDataRoundState { |
|
|
func (rs *RoundState) RoundStateEvent() types.EventDataRoundState { |
|
|
// XXX: copy the RoundState
|
|
|
// XXX: copy the RoundState
|
|
|