aboutsummaryrefslogtreecommitdiff
path: root/types/trunnel.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-05-31 13:34:04 +0200
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-05-31 13:34:04 +0200
commitf3465d2088f54e49c4939137116d23e5e26c3d22 (patch)
tree11006fa3d2dc5c91275f9f4db43e95a7f59e1b8a /types/trunnel.go
parent6a20aec8e8a93ce11f8b940659f49c889f94aef1 (diff)
added (un)marshal methods
Diffstat (limited to 'types/trunnel.go')
-rw-r--r--types/trunnel.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/types/trunnel.go b/types/trunnel.go
index 72ae68d..268f6f7 100644
--- a/types/trunnel.go
+++ b/types/trunnel.go
@@ -46,12 +46,15 @@ func (l *Leaf) Unmarshal(buf []byte) error {
l.ShardHint = binary.BigEndian.Uint64(buf)
offset := 8
// Checksum
+ l.Checksum = &[HashSize]byte{}
copy(l.Checksum[:], buf[offset:offset+HashSize])
offset += HashSize
// Signature
+ l.Signature = &[SignatureSize]byte{}
copy(l.Signature[:], buf[offset:offset+SignatureSize])
offset += SignatureSize
// KeyHash
+ l.KeyHash = &[HashSize]byte{}
copy(l.KeyHash[:], buf[offset:])
return nil
}