@ -9,7 +9,6 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/proto"
tmtime "github.com/tendermint/tendermint/libs/time"
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
tmversion "github.com/tendermint/tendermint/proto/tendermint/version"
tmversion "github.com/tendermint/tendermint/proto/tendermint/version"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/types"
@ -287,7 +286,7 @@ func (state State) MakeBlock(
// the votes sent by honest processes, i.e., a faulty processes can not arbitrarily increase or decrease the
// the votes sent by honest processes, i.e., a faulty processes can not arbitrarily increase or decrease the
// computed value.
// computed value.
func MedianTime ( commit * types . Commit , validators * types . ValidatorSet ) time . Time {
func MedianTime ( commit * types . Commit , validators * types . ValidatorSet ) time . Time {
weightedTimes := make ( [ ] * tmtime . W eightedTime, len ( commit . Signatures ) )
weightedTimes := make ( [ ] * w eightedTime, len ( commit . Signatures ) )
totalVotingPower := int64 ( 0 )
totalVotingPower := int64 ( 0 )
for i , commitSig := range commit . Signatures {
for i , commitSig := range commit . Signatures {
@ -298,11 +297,11 @@ func MedianTime(commit *types.Commit, validators *types.ValidatorSet) time.Time
// If there's no condition, TestValidateBlockCommit panics; not needed normally.
// If there's no condition, TestValidateBlockCommit panics; not needed normally.
if validator != nil {
if validator != nil {
totalVotingPower += validator . VotingPower
totalVotingPower += validator . VotingPower
weightedTimes [ i ] = tmtime . N ewWeightedTime( commitSig . Timestamp , validator . VotingPower )
weightedTimes [ i ] = n ewWeightedTime( commitSig . Timestamp , validator . VotingPower )
}
}
}
}
return tmtime . W eightedMedian( weightedTimes , totalVotingPower )
return w eightedMedian( weightedTimes , totalVotingPower )
}
}
//------------------------------------------------------------------------
//------------------------------------------------------------------------