Skip to content

Buffer.equals() requires Buffer, not Uint8Array #2249

@a-khushal

Description

@a-khushal

The following comparison fails when toXOnly() returns a Buffer and outputKey is a Uint8Array:

Image

Even if both values contain the same underlying bytes, .equals() does not accept Uint8Array arguments directly.

Using Buffer.from(outputKey) works as expected:

if ((0, bip371_1.toXOnly)(pubkey).equals(Buffer.from(outputKey))) {
  // works
}

Version
6.1.5

Expected behavior
outputKey must be a Buffer when used with .equals(). Currently, it’s an Uint8Array.

Metadata

Metadata

Assignees

No one assigned

    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