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

Block reward validation #1093

Closed Nizametdinov closed 5 years ago

Nizametdinov commented 5 years ago

Fixes #777.

Extracted from #1081 because it contains important changes to coinbase validation which can be easily overlooked.

This PR implements the following rules for coinbase transactions:

  1. The output amount minus the input amount must not be bigger than the block reward plus fees.
  2. The output amount minus the input amount must not be smaller than the block reward. It allows proposers to burn fees. I did it this way because many functional tests generate coinbase transactions without taking into account fees.
  3. Non-reward output amount (sum of all outputs except the first one) must not be bigger than the input amount.

Note that the first output (which is subject to coinbase maturity) can be bigger than the block reward plus fees, i.e. the reward and the stake can be sent to one output. It might useful for proposers who do not want to increase the number of their coins.

scravy commented 5 years ago

Concept ACK, reviewing in greater detail

scravy commented 5 years ago

utACK 5651db0be6aa774b9d89c71b44b895f20aa23924