Git Product home page Git Product logo

Comments (2)

davecgh avatar davecgh commented on August 23, 2024

I personally would prefer to go further than deprecating them and remove them outright. You've made a great summary of why this needs to happen.

The only questionable one is JSONToNumber since I believe it has some extra range checks that should happen before converting to an int that btcutil.Amount does not do.

I fully agree with the rest however.

from btcjson.

jrick avatar jrick commented on August 23, 2024

JSONToAmount checks that the floating point value being converted is no greater than 1.797693134862315708145274237317043567981e+300 and no less than -1.797693134862315708145274237317043567981e+300. It does not perform any checking that the returned int64 is within the total amount of bitcoin producable.

If that check is desired, I can add a function to check that to btcutil, but since that's an application specific requirement (for example, an Amount returned by getreceivedbyaddress may exceed 21e6 * 1e8) I don't think checking that from NewAmount is a good idea. In fact, it used to, but I removed that additonal bounds check for this very reason.

from btcjson.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.