TX fees and policy: fix relaypriority calculation error Issues #8334 #8336

pull maiiz wants to merge 3 commits into bitcoin:master from maiiz:issues-8334 changing 1 files +1 −1
  1. maiiz commented at 7:19 AM on July 13, 2016: contributor

    CCoinsViewCache::GetPriority has an overflow bug that affects the relaypriority calculation. The way the arithmetic works in that function is

    dResult += coins->vout[txin.prevout.n].nValue * (nHeight-coins->nHeight); 
    the nValue variable type is int64_t, and the int64_t max value is 9223372036854775807
    

    for example

    nValue value  is 40000000000000
    (nHeight->coins - nHeight )value is 300000 
    40000000000000 * 300000 > 9223372036854775807 
    

    so the dResult will be negative number! and the AllowFree function will return False, and the high priority transaction with low fee will be reject by node with error insufficient priority!

  2. Issues #8334
    fix bug Issues #8334
    e290b2ab00
  3. MarcoFalke commented at 8:20 AM on July 13, 2016: member

    Mind to amend the commit subject to be more verbose?

  4. maiiz renamed this:
    Issues #8334
    TX fees and policy: fix relaypriority calculation error Issues #8334
    on Jul 13, 2016
  5. jonasschnelli commented at 10:37 AM on July 13, 2016: contributor

    utACK e290b2ab0055405099f5a4899b9f7aa506a2648d. I think a short unit or RPC test would be nice.

  6. jonasschnelli added the label Wallet on Jul 13, 2016
  7. paveljanik commented at 11:20 AM on July 13, 2016: contributor

    I think that in this case, it is also worth to mention the reason to cast the value to double in the source code!

  8. MarcoFalke commented at 11:40 AM on July 13, 2016: member

    I think that in this case, it is also worth to mention the reason to cast the value to double in the source code!

    Should be enough to mention it in the commit subject line, so when in doubt, you can always do git blame.

  9. MarcoFalke commented at 8:23 AM on July 17, 2016: member

    @maiiz You can change the commit subject line with git commit --amend, if you didn't know. Make sure to force push afterward.

  10. [Wallet]Fix relaypriority calculation error issues #8334 771844062d
  11. Merge branch 'issues-8334' of https://github.com/maiiz/bitcoin into issues-8334 157e6dd785
  12. maiiz closed this on Jul 18, 2016

  13. maiiz deleted the branch on Jul 18, 2016
  14. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me