namecoin / electrum-nmc

Namecoin port of Electrum Bitcoin client.
https://www.namecoin.org/
MIT License
29 stars 24 forks source link

A pending domain is reported as available to register #236

Closed gits7r closed 4 years ago

gits7r commented 4 years ago

If you try to register a domain name, while it is pending, when you go to Buy names and try to search for it, it reports it as available to register. It should detect that we already registered it, and it is pending.

JeremyRand commented 4 years ago

Hmm, I suspect this is (in some cases) a feature rather than a bug. If we prevented registering a name just because there was an unconfirmed registration of this name, then a malicious server could prevent users from registering a name just by returning an unverified transaction for it.

We could, I suppose, search the local wallet for transactions that were created locally rather than retrieved from a server, but I don't think Electrum stores this metadata right now. The name_firstupdate transaction queue happens to be only writable locally (network activity won't result in transactions being added to it), so as a temporary workaround we could check that set of transactions.

gits7r commented 4 years ago

Yea, the only way is to local check and see if we have a Pre-registration fee for that name.

JeremyRand commented 4 years ago

Yes, seems reasonable to search the queued transaction list. This won't work for all cases, but it's an easy heuristic that will work a lot of the time.

gits7r commented 4 years ago

Also, even after it is registered (name_firstupdate was sent), for some like 20 blocks more the domain name still is reported as available to register. I think there is a bug here as well.

So you send a name_new, and wait for 12 blocks. During this time, the same wallet reports this domain name as available to register - this is the bug we will fix in this issue by looking at the local transactions list.

After 12 blocks, you send name_firstupdate and the name becomes available under Manage Names tab. At this moment, for few more hours at least, the same domain name is still being reported as available to register under the Buy names tab.