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

Fix coinbase transaction amount returned by filtertransactions #971

Closed cmihai closed 5 years ago

cmihai commented 5 years ago

This commit cherry-picks the GetAmount changes from #811 and fixes the filtertransactions RPC output for coinbase transactions, setting the "fee" field to zero and "amount" to the reward received by the miner. Previously, as a side-effect of the algorithm, it was the other way around.

See also #779 and #961.

castarco commented 5 years ago

Although I understand the spirit of the change, I'm not sure about changing the meaning of the "amount" field for coinbase transactions. I would prefer to add fields like "reward", "collected_fees" & "used_stake" that only appears for them, and remove the "amount" field.

cmihai commented 5 years ago

Although I understand the spirit of the change, I'm not sure about changing the meaning of the "amount" field for coinbase transactions. I would prefer to add fields like "reward", "collected_fees" & "used_stake" that only appears for them, and remove the "amount" field.

@castarco that's a good idea, but it's not a one-line change since 1) for now, filtertransactions only deals with a transaction's outputs, and the stake is an input, and 2) the block reward and the fees are combined into the first output. Let's first have the RPC output make some kind of sense to the client, and then we can add new fields.