From c5cb214f689e5c34bf487daa8eb4234d6e3237a7 Mon Sep 17 00:00:00 2001 From: Javier Peletier Date: Mon, 8 Oct 2018 10:57:38 +0200 Subject: swarm/storage/feed: Expose MaxUpdateDataLength constant (#17858) --- swarm/storage/feed/update.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'swarm/storage/feed/update.go') diff --git a/swarm/storage/feed/update.go b/swarm/storage/feed/update.go index 627a537d1..21c004ca4 100644 --- a/swarm/storage/feed/update.go +++ b/swarm/storage/feed/update.go @@ -42,7 +42,9 @@ type Update struct { } const minimumUpdateDataLength = idLength + headerLength + 1 -const maxUpdateDataLength = chunk.DefaultSize - signatureLength - idLength - headerLength + +//MaxUpdateDataLength indicates the maximum payload size for a feed update +const MaxUpdateDataLength = chunk.DefaultSize - signatureLength - idLength - headerLength // binaryPut serializes the feed update information into the given slice func (r *Update) binaryPut(serializedData []byte) error { @@ -51,8 +53,8 @@ func (r *Update) binaryPut(serializedData []byte) error { return NewError(ErrInvalidValue, "a feed update must contain data") } - if datalength > maxUpdateDataLength { - return NewErrorf(ErrInvalidValue, "feed update data is too big (length=%d). Max length=%d", datalength, maxUpdateDataLength) + if datalength > MaxUpdateDataLength { + return NewErrorf(ErrInvalidValue, "feed update data is too big (length=%d). Max length=%d", datalength, MaxUpdateDataLength) } if len(serializedData) != r.binaryLength() { -- cgit