Pretty printing of hashes

This commit is contained in:
Mark Spanbroek 2021-08-04 14:20:24 +02:00
parent 0a604491ee
commit 7db55248fa
1 changed files with 7 additions and 0 deletions

View File

@ -15,3 +15,10 @@ func toBytes*(hash: Hash): array[32, byte] =
func hash*(hash: Hash): hashes.Hash =
hashes.hash(hash.toBytes)
func `$`*(hash: Hash): string =
case hash.kind
of Tx:
"Tx(" & $hash.hash & ")"
of Ack:
"Ack(" & $hash.hash & ")"