Skip to content

SQL error: UNIQUE constraint failed: keys.privkey #11

Open

Description

@cacheburner

This is in the development pipeline as GEN-9.

The problem concerns duplicate private keys. 2+ totally unique seeds can map to the same private key, for example 0 and 00 both become 32 0's using the front_pad and back_pad methods. If they're caught by the bloom filter but not in the database, they will eventually both be added to a bulk insert transaction; the transaction will fail because 0 and 00 have the same private key.

This can be fixed by removing duplicates that would be added to this specific transaction. The array of concern is the second update array that is filled with records that were caught by the bloom filter but not found in the database.

Activity

  1. added
    bug
    on Jun 1, 2019
  2. self-assigned this
    on Jun 1, 2019
  3. cacheburner commented on Jun 1, 2019

    @cacheburner
    OwnerAuthor

    Note that since GEN-5 sorts the input seed set, all duplicates will be next to each other in the update array, making the removal of duplicate records really fast and simple.

  4. cacheburner commented on Jun 2, 2019

    @cacheburner
    OwnerAuthor
  5. cacheburner commented on Jun 2, 2019

    @cacheburner
    OwnerAuthor

    Reopening this issue because it's not entirely solved. While sorting seeds helps get duplicate private keys closer together, it doesn't ensure they will be adjacent to each other. For example, the seeds destiny10 and destiny100 will be next to each other, but the private keys will appear like so in the array:

    000..destiny10
    destiny10..000
    000..destiny100
    destiny10..000 <- DUPLICATE

    Therefore, we have to sort the private keys in the candidates array

  6. cacheburner commented on Jul 18, 2019

    @cacheburner
    OwnerAuthor

    Getting this error again on Manjaro Linux using 1000 seeds. Seems to work fine on Mac. Will look into this next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions