From 14f12fbb7d9ca5357708331119e044b6132a8320 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 30 Jun 2016 11:30:54 -0700 Subject: [PATCH] elkrem: remote commented out encode/decode for sender --- elkrem/serdes.go | 52 ------------------------------------------------ 1 file changed, 52 deletions(-) diff --git a/elkrem/serdes.go b/elkrem/serdes.go index 0b318be3..928d5695 100644 --- a/elkrem/serdes.go +++ b/elkrem/serdes.go @@ -121,55 +121,3 @@ func ElkremReceiverFromBytes(b []byte) (*ElkremReceiver, error) { return &e, nil } -// There's no real point to the *sender* serialization because -// you just make them from scratch each time. Only thing to save -// is the 32 byte seed and the current index. - -// ToBytes turns the Elkrem Sender into a 41 byte slice: -// first the tree height (1 byte), then 8 byte index of last sent, -// then the 32 byte root sha hash. -//func (e *ElkremSender) ToBytes() ([]byte, error) { -// var buf bytes.Buffer -// // write 8 byte index of current sha (last sent) -// err := binary.Write(&buf, binary.BigEndian, e.current) -// if err != nil { -// return nil, err -// } -// // write 32 byte sha hash -// n, err := buf.Write(e.root.Bytes()) -// if err != nil { -// return nil, err -// } -// if n != 32 { -// return nil, fmt.Errorf("%d byte hash, expect 32", n) -// } - -// return buf.Bytes(), nil -//} - -// ElkremSenderFromBytes turns a 41 byte slice into a sender, picking up at -// the index where it left off. -//func ElkremSenderFromBytes(b []byte) (ElkremSender, error) { -// var e ElkremSender -// e.root = new(wire.ShaHash) -// buf := bytes.NewBuffer(b) -// if buf.Len() != 40 { -// return e, fmt.Errorf("Got %d bytes for sender, expect 41") -// } -// // read 8 byte index -// err := binary.Read(buf, binary.BigEndian, &e.current) -// if err != nil { -// return e, err -// } -// // read 32 byte sha root -// err = e.root.SetBytes(buf.Next(32)) -// if err != nil { -// return e, err -// } - -// if e.current > maxIndex { // check for index higher than height allows -// return e, fmt.Errorf("Sender claims current %d; %d max with height %d", -// e.current, maxIndex, maxHeight) -// } -// return e, nil -//}