Code Monkey home page Code Monkey logo

Comments (7)

NxtChg avatar NxtChg commented on September 27, 2024

Another bug:

coinjs.numToBytes = function(num,bytes) {
if (typeof bytes === undefined) bytes = 8;

'undefined' must be a string, otherwise it doesn't work.

Luckily you never omit the 'bytes' argument anywhere.

from coinbin.

NxtChg avatar NxtChg commented on September 27, 2024

Another bug:

coinjs.numToVarInt = function(num) {
    if (num < 253) {
        return [num];
    } else if (num < 65536) {
        return [253].concat(coinjs.numToBytes(num,2));
    } else if (num < 4294967296) {
        return [254].concat(coinjs.numToBytes(num,4));
    } else {
        return [253].concat(coinjs.numToBytes(num,8));
    }
}

Last line must be:
return [255].concat(coinjs.numToBytes(num,8));

from coinbin.

NxtChg avatar NxtChg commented on September 27, 2024

Major bug in clone():

    var temp = obj.constructor();

must be

    var temp = new obj.constructor();

Not only it's wrong to just call obj.constructor(), but this also fails cloning completely if transaction has any outputs, because the BigInteger 'value' copying crashes: a simple call returns 'undefined' in that case.

from coinbin.

NxtChg avatar NxtChg commented on September 27, 2024

In deterministicK() these lines make no sense:

var v = new Uint8Array(32);
v = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];

var k = new Uint8Array(32);
k = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];

There is no need to use Uint8Array(32) if you immediately overwrite it with a regular array.

from coinbin.

OutCast3k avatar OutCast3k commented on September 27, 2024

Hey, thanks for all your support in reviewing the code, if you aren't able to submit a pull request I'll make the amendments shorty.

from coinbin.

NxtChg avatar NxtChg commented on September 27, 2024

It would be easier for you to just make all the changes. I rewrote a lot of coin.js and removed 2/3 of the code, so my version differs too much now.

from coinbin.

OutCast3k avatar OutCast3k commented on September 27, 2024

your suggestions have been made and are now live. thanks.

from coinbin.

Related Issues (20)

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.