dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Use proper meta input prevout #1099

Closed scravy closed 5 years ago

scravy commented 5 years ago

A coinbase transaction in both bitcoin as well as in unit-e includes a meta input which does not spend anything and is skipped in validation. It's scriptSig contains block height and snapshot hash.

The prevout of that input should be 0x00000 (which it is) and 0xFFFF as index (currently uses 0). This is not correct and changed in this pull request. By using the default constructor of COutPoint, which in turn invokes SetNull (which sets the afore mentioned values), the right values are being filled in + delegated to the definition of `SetNull (as it should).

The problem otherwise: Theoretically it is allowed for a transaction to have the hash 0x00...00 (although this will lead to other problems in the wallet...), but it is super unlikely that any transaction would ever have 2^16 number of inputs. That both happen is astronomically super black hole merger unlikely.

Signed-off-by: Julian Fleischer julian@thirdhash.com