diff --git a/waku/waku_core/message/digest.nim b/waku/waku_core/message/digest.nim index 1d4d12281..cb4f5b014 100644 --- a/waku/waku_core/message/digest.nim +++ b/waku/waku_core/message/digest.nim @@ -8,6 +8,17 @@ import ../topics, ./message type WakuMessageHash* = array[32, byte] +func shortLog*(hash: WakuMessageHash): string = + ## Returns compact string representation of ``WakuMessageHash``. + var hexhash = newStringOfCap(13) + hexhash &= hash.toOpenArray(0, 1).to0xHex() + hexhash &= "..." + hexhash &= hash.toOpenArray(hash.len - 2, hash.high).toHex() + hexhash + +func `$`*(hash: WakuMessageHash): string = + shortLog(hash) + const EmptyWakuMessageHash*: WakuMessageHash = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,