givelotus / lotus-vase

A simple reference wallet for Lotus which supports mobile devices.
GNU General Public License v3.0
4 stars 2 forks source link

Transaction output serialization fix #159

Closed limonadev closed 3 years ago

limonadev commented 3 years ago

The calcVarInt method was using the BigEndian encoding, but according to the Bitcoin specification it should be LittleEndian.

This method was used in the serialization of the TransactionOutputs, generating invalid transactions. This PR deletes the calcVarInt method and replace it with varintBufNum, which does the same function but with LittleEndian encoding instead.

The invalid transactions were probably invisible because none of them had an output with a script length big enough to use more than 1 byte in the Varint decoding.