swarm/network: simplify some trivial statements

This commit is contained in:
Ferenc Szabo 2019-01-17 10:44:50 +01:00
parent aa149ad16b
commit 9e1180a82e

View file

@ -668,8 +668,7 @@ func peerStreamIntervalsKey(p *Peer, s Stream) string {
func (c *client) AddInterval(start, end uint64) (err error) { func (c *client) AddInterval(start, end uint64) (err error) {
i := &intervals.Intervals{} i := &intervals.Intervals{}
err = c.intervalsStore.Get(c.intervalsKey, i) if err = c.intervalsStore.Get(c.intervalsKey, i); err != nil {
if err != nil {
return err return err
} }
i.Add(start, end) i.Add(start, end)
@ -733,11 +732,7 @@ func (c *client) batchDone(p *Peer, req *OfferedHashesMsg, hashes []byte) error
} }
return nil return nil
} }
// TODO: make a test case for testing if the interval is added when the batch is done return c.AddInterval(req.From, req.To)
if err := c.AddInterval(req.From, req.To); err != nil {
return err
}
return nil
} }
func (c *client) close() { func (c *client) close() {