Calculate the extra floData size to add to the Buffer when initializing

This commit is contained in:
Sky Young 2019-10-28 13:01:59 -06:00
parent 57e88d7762
commit 8024b466e9

View File

@ -719,7 +719,16 @@ class TX {
}
}
const size = 156 + prev.getVarSize();
// Calculate the extra floData size to add to the Buffer when initializing
let extraFloDataSize = 0
if (this.version >= 2 && includeFloData){
let bufferLength = this.floData.length;
extraFloDataSize += encoding.sizeVarint(bufferLength);
extraFloDataSize += bufferLength
}
const size = 156 + prev.getVarSize() + extraFloDataSize;
const bw = bio.pool(size);
bw.writeU32(this.version);