more metrics

This commit is contained in:
Anton Kaliaev
2018-06-14 16:09:32 +04:00
parent 3cdf3b670d
commit 489d9b9184
4 changed files with 59 additions and 4 deletions

View File

@ -135,6 +135,15 @@ func (b *Block) HashesTo(hash []byte) bool {
return bytes.Equal(b.Hash(), hash)
}
// Size returns size of the block in bytes.
func (b *Block) Size() int {
bz, err := cdc.MarshalBinaryBare(b)
if err != nil {
return 0
}
return len(bz)
}
// String returns a string representation of the block
func (b *Block) String() string {
return b.StringIndented("")