org.ton.block.VarUInteger
addition always throws an exception
#102
Labels
wontfix
This will not be worked on
On almost any addition (say
VarUInteger(1)+VarUInteger(1)
) an exception is thrown fromplus
in line45
https://github.com/andreypfau/ton-kotlin/blob/b1edc4b134e89ccf252149f27c85fd530377cebe/ton-kotlin-block/src/commonMain/kotlin/org/ton/block/VarUInteger.kt#L41-L47
This happens, because
VarUInteger
, when constructed, holds number's length in bytes:https://github.com/andreypfau/ton-kotlin/blob/b1edc4b134e89ccf252149f27c85fd530377cebe/ton-kotlin-block/src/commonMain/kotlin/org/ton/block/VarUInteger.kt#L26-L31
Therefore, in line
45
,maxLen
contains number of bytes, butactualLen
is clearly number of bits, and very often number of bits is larger, causing this exception. It is also related to other mathematical operators withVarUInteger
Moreover, to me it seems that bit length anyway can increase when adding two numbers of the same bit length
The text was updated successfully, but these errors were encountered: