From 5dc0cb5544744e5cc68a05ca96dbe9a07b4d6f01 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Wed, 6 Jun 2018 23:00:17 -0500 Subject: [PATCH] move wire_encode_locator logic into getBytesForSig, since that's the only place it's used --- src/yggdrasil/peer.go | 8 +++----- src/yggdrasil/wire.go | 11 ----------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/yggdrasil/peer.go b/src/yggdrasil/peer.go index 059ec739..47f29f81 100644 --- a/src/yggdrasil/peer.go +++ b/src/yggdrasil/peer.go @@ -347,11 +347,9 @@ func (p *peer) handleSwitchMsg(packet []byte) { } func getBytesForSig(next *sigPubKey, loc *switchLocator) []byte { - //bs, err := wire_encode_locator(loc) - //if err != nil { panic(err) } bs := append([]byte(nil), next[:]...) - bs = append(bs, wire_encode_locator(loc)...) - //bs := wire_encode_locator(loc) - //bs = append(next[:], bs...) + bs = append(bs, loc.root[:]...) + bs = append(bs, wire_encode_uint64(wire_intToUint(loc.tstamp))...) + bs = append(bs, wire_encode_coords(loc.getCoords())...) return bs } diff --git a/src/yggdrasil/wire.go b/src/yggdrasil/wire.go index 9344d902..be2fb4e6 100644 --- a/src/yggdrasil/wire.go +++ b/src/yggdrasil/wire.go @@ -170,17 +170,6 @@ func (m *switchMsg) decode(bs []byte) bool { //////////////////////////////////////////////////////////////////////////////// -// Format used to check signatures only, so no need to also support decoding -// TODO something else for signatures -func wire_encode_locator(loc *switchLocator) []byte { - coords := wire_encode_coords(loc.getCoords()) - var bs []byte - bs = append(bs, loc.root[:]...) - bs = append(bs, wire_encode_uint64(wire_intToUint(loc.tstamp))...) - bs = append(bs, coords...) - return bs -} - func wire_chop_slice(toSlice []byte, fromSlice *[]byte) bool { if len(*fromSlice) < len(toSlice) { return false