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

Amount/fee display for coinbase transactions is not user-friendly #961

Open cmihai opened 5 years ago

cmihai commented 5 years ago

Describe the bug When calling gettransaction on a coinbase transaction, the result looks like:

gettransaction 31311af5c831b38a1498f71ec870c1ed36c4c030463709067a08ed8df5ecc8b3
10:51:31
{
  "amount": -3.74999999,
  "bip125-replaceable": "no",
  "blockhash": "85b494203985bcbf5a0d8d9e840988c34091bf09c1f0b8bd42ce84c656e4b951",
  "blockindex": 0,
  "blocktime": 1555058872,
  "confirmations": 9,
  "details": [],
  "fee": 3.74999999,
  "generated": true,
  "hex": "010001000001020000000000000000000000000000000000000000000000000000000000000000000000002402cd00202f24abbab39267b916b77f1f39e0a62f5134402a0026ca8f5f6d0e2ec2fb4884ffffffffd360d5e63a98ff4a10b32874a0a1a1a2c8d1422bd4f5ffbb03d4c423c277a1360100000000ffffffff02bf0b5a16000000001600142176bae014a27bb24903db14aa43afd9bff1f6470080c6a47e8d03001600142176bae014a27bb24903db14aa43afd9bff1f6470002483045022100f92276eefca1d8709f9ddd113508d49e5e4822883412cfbd458da5fb50ce2d2a0220663d4e332bffa3675fb79801497d8af54cca50d53adc8be6185abd31cfb04fde012102c8d61f0af45c20a90a43fceaaa2f65bf05a4417ea3347c65225d4a1639f09d4300000000",
  "time": 1555058868,
  "timereceived": 1555058868,
  "txid": "31311af5c831b38a1498f71ec870c1ed36c4c030463709067a08ed8df5ecc8b3",
  "walletconflicts": []
}

Note the negative "amount" and the positive "fee". While there is some internal logic to it ('amount' being the sum we spent, and if we actually gained money, then that number is negative; 'fee' being the negative sum we paid to the miner, and if we mined the block, then the fee is positive), it's confusing. Likewise, filtertransaction adds the amount and the fee, and displays zero for coinbase transactions, so, in the GUI wallet, you see a row of 0-UTE transactions.

To Reproduce Steps to reproduce the behavior:

  1. Start the node (optionally, the GUI wallet)
  2. Wait until a few blocks are mined.
  3. Inspect the coinbase transactions, either with gettransaction, filtertransactions or in the GUI wallet.

Expected behavior The shown amounts for coinbase transactions should be positive and equal to the block reward + fees. The "fee" field should be zero.

Nizametdinov commented 5 years ago

There is also related issue #779.

cmihai commented 5 years ago

Thanks, I'll close them both when I fix this.