Skip to content

Commit

Permalink
Update packages/upload-client/src/car.js
Browse files Browse the repository at this point in the history
Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
  • Loading branch information
Alan Shaw and Gozala authored Sep 7, 2023
1 parent 786d873 commit 33011b6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/upload-client/src/car.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ export function headerEncodingLength(root) {

/** @param {Block} block */
export function blockEncodingLength(block) {
const varintLength = varint.encodingLength(
block.cid.bytes.length + block.bytes.length
)
const cidLength = block.cid.bytes.length
return varintLength + cidLength + block.bytes.length
const payloadLength = block.cid.bytes.length + block.bytes.length
const varintLength = varint.encodingLength(payloadLength)

return varintLength + payloadLength
}

/**
Expand Down

0 comments on commit 33011b6

Please sign in to comment.