swarm/storage/mru: HOTFIX - fix panic in Handler.update (#17313)

This commit is contained in:
Javier Peletier 2018-08-07 11:53:56 +02:00 committed by Balint Gabor
parent eef65b20fc
commit 64a4e89504

View File

@ -469,7 +469,7 @@ func (h *Handler) update(ctx context.Context, r *SignedResourceUpdate) (updateAd
log.Trace("resource update", "updateAddr", r.updateAddr, "lastperiod", r.period, "version", r.version, "data", chunk.SData, "multihash", r.multihash) log.Trace("resource update", "updateAddr", r.updateAddr, "lastperiod", r.period, "version", r.version, "data", chunk.SData, "multihash", r.multihash)
// update our resources map entry if the new update is older than the one we have, if we have it. // update our resources map entry if the new update is older than the one we have, if we have it.
if rsrc != nil && r.period > rsrc.period || (rsrc.period == r.period && r.version > rsrc.version) { if rsrc != nil && (r.period > rsrc.period || (rsrc.period == r.period && r.version > rsrc.version)) {
rsrc.period = r.period rsrc.period = r.period
rsrc.version = r.version rsrc.version = r.version
rsrc.data = make([]byte, len(r.data)) rsrc.data = make([]byte, len(r.data))