moneybutton / yours-core

Client-side key and content management for Yours.
https://www.yours.network
MIT License
132 stars 27 forks source link

wallet/content: Tipping user announce messages should not burn bitcoin #99

Closed willy-b closed 7 years ago

willy-b commented 8 years ago

Right now the tipping address associated with User announcement messages ( the message automatically generated when a user "registers" ) is the unspendable address 1111111111111111111114oLvT2 corresponding to an all zeros hash160.

The address associated with the User announcement message should be the one of user's own addresses.

willy-b commented 8 years ago

Issue is in core/content-auth.js, in ContentAuth.prototype.initialize , where the unspendable address is set as the default address:

ContentAuth.prototype.initialize = function () {
  let buf = new Buffer(32)
  buf.fill(0)
  this.parenthashbuf = buf // Default to 'null' parent
  this.date = new Date()

  // TODO: Default address is useful for testing but is a bad idea in
  // production.
  this.address = Address().fromPubkeyHashbuf(buf.slice(0, 20))

  return this
}

My proposal (which seems to be in the TODO here) is to get rid of this, make it an error for ContentAuth not to have an address set. Just to avoid silently sending money into unspendable address.

This is in addition to setting the address for the User announcement content to one of the User's external addresses.