Skip to content

ListKeys returns keys in wrong order for wallets with 10 or more addresses #161

@Dunsin-cyber

Description

@Dunsin-cyber

When a user has generated 10 or more addresses, ListKeys returns them in the wrong order. This is because the code sorts the keys as text (like words in a dictionary) rather than as numbers. In text sorting, "10" comes before "2"... the same way "cat" comes before "dog" because it only looks at the first character.

sort.SliceStable(keys, func(i, j int) bool {
return keys[i].Id < keys[j].Id
})

This doesn't affect users with fewer than 10 addresses because single digit numbers sort the same way whether you treat them as text or numbers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions