handshake-org / hsd

Handshake Daemon & Full Node
Other
1.94k stars 281 forks source link

wallet getbids includes bids for previous (expired) auction for same name #422

Open pinheadmz opened 4 years ago

pinheadmz commented 4 years ago

Related to: https://github.com/handshake-org/hsd/pull/316

To reproduce:

This is entirely a UI issue (for example, Bob will show the user the old bid on the screen for the new auction, even though this bid IS NOT participating in this new auction). None of the sendreveal functions are affected, etc - everything is fine under the hood.

Potential solution: add a parameter to getbids like minconf or minheight to filter out bids that are inactive or for expired auctions.

nodech commented 1 year ago

Another solution, but which needs migration is to change layout.i/layout.B - entries in txdb responsible for bid/reveal tracking to have additional height after the hash. (height referring to the auction open height)

  i[namehash][height][txhash][index] - 
  B[namehash][height][txhash][index]

This allows to query all Bids/Namehash related to the name (+historical) or Specifically the newest one. Unfortunately, writing migration for this will be troublesome, as the information about past auctions per name is not preserved anywhere. So at the point of migration everything in the past will have the same height.

For the better namestate tracking on top of it, it's possible to also introduce this change to name and undo records (and probably all name entries in the db)