ontio / ontology

Official Go implementation of the Ontology protocol. https://dev-docs.ont.io/#/
GNU Lesser General Public License v3.0
829 stars 290 forks source link

Fix decoding of event state without loss of numeric precision #1308

Closed tav closed 3 years ago

tav commented 3 years ago

When decoding events such as ONG transfers, numeric values are decoded to float64 by the default encoding/json configuration. This results in the loss of precision for large integer values which cannot be accurately represented by a float64.

This PR enables UseNumber on the JSON decoder so that consumers can convert the resulting json.Number appropriately, without having to lose any precision.