pretty print ConsensusState

This commit is contained in:
Jae Kwon
2014-10-18 01:42:33 -07:00
parent ca1d8a54be
commit 9ea504030e
10 changed files with 179 additions and 32 deletions

View File

@ -144,6 +144,13 @@ func (ps *PartSet) RootHash() []byte {
return ps.rootHash
}
func (ps *PartSet) Count() uint16 {
if ps == nil {
return 0
}
return ps.count
}
func (ps *PartSet) Total() uint16 {
if ps == nil {
return 0
@ -197,3 +204,11 @@ func (ps *PartSet) GetReader() io.Reader {
}
return bytes.NewReader(buf)
}
func (ps *PartSet) Description() string {
if ps == nil {
return "nil-PartSet"
} else {
return fmt.Sprintf("(%v of %v)", ps.Count(), ps.Total())
}
}