diff --git a/e2e/parse/conversation/store.go b/e2e/parse/conversation/store.go index b698d473f95c9af0e64cd6bfc1bc6f51a1789b16..288e87674fa1cd6789bdacc538052cbc2173ae57 100644 --- a/e2e/parse/conversation/store.go +++ b/e2e/parse/conversation/store.go @@ -8,10 +8,11 @@ package conversation import ( + "sync" + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/storage/versioned" "gitlab.com/xx_network/primitives/id" - "sync" ) const conversationKeyPrefix = "conversation" diff --git a/e2e/parse/firstMessagePart.go b/e2e/parse/firstMessagePart.go index 05280cd16e0bbed42b7a1cbe3e62c49241143233..ae907af3d2b921f69a3770f1ad0aa8e1da72541d 100644 --- a/e2e/parse/firstMessagePart.go +++ b/e2e/parse/firstMessagePart.go @@ -9,8 +9,10 @@ package parse import ( "encoding/binary" - "gitlab.com/elixxir/client/catalog" "time" + + jww "github.com/spf13/jwalterweatherman" + "gitlab.com/elixxir/client/catalog" ) // Sizes of message parts, in bytes. @@ -36,10 +38,10 @@ type firstMessagePart struct { // newFirstMessagePart creates a new firstMessagePart for the passed in // contents. Does no length checks. func newFirstMessagePart(mt catalog.MessageType, id uint32, numParts uint8, - timestamp time.Time, contents []byte) firstMessagePart { + timestamp time.Time, contents []byte, size int) firstMessagePart { // Create the message structure - m := firstMessagePartFromBytes(make([]byte, len(contents)+firstHeaderLen)) + m := firstMessagePartFromBytes(make([]byte, size)) // Set the message type binary.BigEndian.PutUint32(m.Type, uint32(mt)) @@ -81,6 +83,7 @@ func firstMessagePartFromBytes(data []byte) firstMessagePart { // Map the data according to its version version := data[len(data)-1] + jww.INFO.Printf("Unsafeversion: %d", version) mapFunc, exists := firstMessagePartFromBytesVersions[version] if exists { return mapFunc(data) diff --git a/e2e/parse/messagePart.go b/e2e/parse/messagePart.go index 95d33cd6ac889d9050c76b62b948c1cee1fd4e8a..b1c3a9dfe2d4ef65ca247d8f940db165d5679070 100644 --- a/e2e/parse/messagePart.go +++ b/e2e/parse/messagePart.go @@ -34,9 +34,10 @@ type messagePart struct { // newMessagePart creates a new messagePart for the passed in contents. Does no // length checks. -func newMessagePart(id uint32, part uint8, contents []byte) messagePart { +func newMessagePart(id uint32, part uint8, contents []byte, + size int) messagePart { // Create the message structure - data := make([]byte, len(contents)+headerLen) + data := make([]byte, size) m := messagePartFromBytes(data) // Set the message ID diff --git a/e2e/parse/partition.go b/e2e/parse/partition.go index d01e5585a92829dd2b55bc7d20fba8670fb47e86..e23649d3a18d0d455803b9484a051a1ec225d1c3 100644 --- a/e2e/parse/partition.go +++ b/e2e/parse/partition.go @@ -8,6 +8,8 @@ package parse import ( + "time" + "github.com/pkg/errors" "gitlab.com/elixxir/client/catalog" "gitlab.com/elixxir/client/e2e/parse/conversation" @@ -16,7 +18,6 @@ import ( "gitlab.com/elixxir/client/storage/versioned" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/netTime" - "time" ) const MaxMessageParts = 255 @@ -64,12 +65,13 @@ func (p Partitioner) Partition(recipient *id.ID, mt catalog.MessageType, // Create the first message part var sub []byte sub, payload = splitPayload(payload, p.firstContentsSize) - parts[0] = newFirstMessagePart(mt, messageID, numParts, timestamp, sub).bytes() + parts[0] = newFirstMessagePart(mt, messageID, numParts, + timestamp, sub, p.baseMessageSize).bytes() // Create all subsequent message parts for i := uint8(1); i < numParts; i++ { sub, payload = splitPayload(payload, p.partContentsSize) - parts[i] = newMessagePart(messageID, i, sub).bytes() + parts[i] = newMessagePart(messageID, i, sub, p.baseMessageSize).bytes() } return parts, fullMessageID, nil