-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send OPENs to nulldata address #499
Conversation
Pull Request Test Coverage Report for Build 209047434
💛 - Coveralls |
Thanks zippy! This is a great change |
Back when I wrote this PR I tried to test it so I could add an example to the description here. I didn't realize in advance that nulldata addresses were accidentally classified as nonstandard and would be rejected by all network nodes and not relayed. I actually set my own node to accept non standard transactions to complete the test. That transaction (an OPEN for the name Because this was (I think) the first nulldata address on the chain, HNScan.com actually crashed on this block because of a an error in its backend when parsing such an address (unrelated to hsd or this PR). Anyway - the test basically worked. We can open auctions with nulldata addresses and apparently there are enough v2.2 nodes on the network (including miners) for such transactions to get confirmed. I hesitate to merge this PR too soon though because relay may still be quite choppy. Here's the peer version breakdown from easyhandshake today:
and the TX that broke everything :-)
|
Signed-off-by: rozaydin <ridvan@namebase.io>
// to the wallet database's name map. Normally the wallet would do this in | ||
// txdb.js connectNames() when a TX is inserted into the DB, and the wallet | ||
// recognizes the output address. | ||
await this.importName(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I missed it,
but does not this need to change rescan logic as well, so wallets can recover the OPENs they have sent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
importName()
will add the name to the wallet's name map, which means the wallet will "track" all auction activity like bids etc even if the user did not bid themselves (this is weird, but its how the wallet works already). This will persist for rescans as well, especially because of this change: 0301f47
Since the wallet sent the open, it should recover the TX normally because its own keys were used for the inputs and change.
OPENs are weird things - they are just a marker for the chain and wallet (this is why they have 0 value), announcing to the network a namehash and its preimage. JJ told me OPENs weren't even added to the system until late in development because they didn't seem necessary, but definitely made wallet logic a lot easier.
We have a few rescan tests now in hsd, I'll rebase this PR and we can double check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure,
I was wondering about importing wallet into fresh wallet instance.
I can test after rebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering about importing wallet into fresh wallet instance.
Yes! this needs to be patched. Its' going to be in txdb.insert()
or txdb.confirm()
I think
Closing this for now, I think the approach is a bit flawed. First of all, the bloat is not that bad. An OPEN UTXO is at most only about 130 bytes, meaning this year with over a million names on chain we're only "wasting" 130 MB. Second, sending to nulldata address just to make an output unspendable seems a bit hacky. What we should do is just... make 0-value OPENs unspendable! Whether or not that ever becomes a consensus rule, it can certainly be factored in to the wallet so we don't add these coins to the txdb. What makes the most sense is to refactor the coinselector in the wallet, and refactor the layout of txdb so coins can be pulled out by value (instead of randomly by hash and then filtered by value and spent-ness) |
What would happen to the "0-value OPENs" already spent, when a new node tries to sync? |
This is why soft forks have activation height! |
Closes #481
Chips away at #478
Requires network deployment (especially miners) of #498✅Motivation is partly explained in #481 but here are the pros and cons:
PROs
Prevents an annoyance where an attacker can send an OPEN to someone else's wallet, forcing that wallet to watch and collect all bids for that auction, whether or not the unwilling recipient cares about the name (also adds a 0-value UTXO to the victim's wallet, because OPENs aren't checked for dust)<- This will require a second patch in txdb if we decide it is a big enough issue.CONs
Review
commit 4b75f8a address: don't restrict data length to 20 or 32
commit 0301f47 wallet: do not remove wallet-name-map when disconnecting a block
commit 4075ae8 wallet: send OPENs to unspendable nullData address
importName()
now! Wallet: enable importing names and "watch" for auction activity without bidding #408commit 8edaea6 test: OPEN outputs no longer inserted as coins into txdb
commit c193247 pkg: update CHANGELOG