LNP-BP / LNPBPs

LNP/BP standards for bitcoin layer 2 & 3 protocols
https://standards.lnp-bp.org
202 stars 39 forks source link

Cover multiple instances of the same pubkey in LNPBP-1 and 2 standards #111

Open dr-orlovsky opened 3 years ago

dr-orlovsky commented 3 years ago

After @yojoe note,

A public key Pi appears multiple times in a scriptPubKey. (Although I don’t know of any example, this seems to be possible, else we wouldn’t have to talk about a list of keys which always needs to be reduced to a set in the fist place).

The question is now, what happens when Pi is selected as Po for tweaking and carrying the commitment? Do ALL occurences of Po have to be replaced in the modified scriptPubKey script afterwards? If not, we have to remember the exact postition of Po in the ETP (extra transaction proof) as well, because the nature of the script cannot be assumed to be commutative, right?

If Po appears multiple times and is replaced everywhere in the script after tweaking, it shouldn’t matter, right? I even wonder if it could break the script if Po wasn’t replaced everywhere and could make the output undspendable?

Anyway, this seems to be a significant detail to mention in the spec, shouldn’t it?

I think we need to tweak all instances of the pubkey - since we collect only unique pubkeys this would work the best. Need to add that part to the spec