Skip to content

intToBuffer() fails for numbers that produce odd length hex strings #8

@vpulim

Description

@vpulim

ethjs-util

Issue Type

Description

The intToBuffer() function is broken after this PR was merged: #7

It fails for numbers that don't produce an even length hex string. It's breaking the following modules:

Steps to reproduce

const util = require('ethjs-util')

const buf = util.intToBuffer(1);
console.log(buf) // output: "<Buffer >" (expected: "<Buffer 01>")
assert.equal(buf.toString('hex'), '01');

Versions

  • Node/NPM: 9.8.0
  • Browser: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions