Skip to content

bn.toBuffer issue or make BN and Buffer available #227

@Ayms

Description

@Ayms

Browserifying https://github.com/Ayms/bitcoin-transactions, everything going well except an unexpected "trivial" issue, calling BN outside of elliptic in https://github.com/Ayms/bitcoin-transactions/blob/master/src/keys.js (see the first function privatekeyderive)

This causes browserify to duplicate twice BN and a call to bn.toBuffer just throws because Buffer is undefined

Not using the latest bn.js version but looking at the code it does not throw now but is just ignored, so if I am correct the "problem" is still there

Suggested fix (or simple workaround instead of making everything available from ec):

if (Buffer===undefined) { Buffer=Uint8Array; };
I don't see what it could harm and to whatever else than Uint8Array Buffer could be derived from if undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions