miner_tests number clarification #7784

pull instagibbs wants to merge 1 commits into bitcoin:master from instagibbs:patch-4 changing 1 files +1 −1
  1. instagibbs commented at 7:35 PM on April 1, 2016: member

    The unchecked simulated fee is 10x smaller than the actual fee. Doesn't hurt the test, but lacks clarity for the reader.

  2. Miner test number clarification 9da1bf5c7d
  3. morcos commented at 8:19 PM on April 1, 2016: member

    ah shoot, i thought i double checked all those thanks

    utACK

  4. laanwj commented at 5:18 AM on April 2, 2016: member

    I'm sorry, but I don't think the new magic value is much clearer than the older one. Could we format this as an expression? (e.g. if there is a factor *10, make it explicit)

  5. laanwj added the label Tests on Apr 2, 2016
  6. MarcoFalke commented at 9:09 AM on April 2, 2016: member

    Agree with @laanwj. It is really hard to parse such numbers without putting the finger/cursor on the screen and counting... Using 1000 * 1000 * ... or int(4e6) could make sense, imo.

    Maybe even add MEGA, GIGA, MEBI, GIBI etc as constants to some header file?

  7. instagibbs commented at 10:23 AM on April 2, 2016: member

    I can do that sure On Apr 2, 2016 5:10 AM, "MarcoFalke" notifications@github.com wrote:

    Agree with @laanwj https://github.com/laanwj. It is really hard to parse such numbers without putting the finger/cursor on the screen and counting... Using 1000 * 1000 * ... or int(4e6) could make sense, imo.

    Maybe even add MEGA, GIGA, MEBI, GIBI etc as constants to some header file?

    — You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub #7784 (comment)

  8. morcos commented at 1:25 PM on April 2, 2016: member

    @laanwj Yeah I hate these things as well. But the right answer is not to write them more clearly but to get rid of the need to manually calculate them. They are not magic values but just the mechanical result of subtracting valueOut from valueIn. They used to just be random values but then mining code was changed to depend on the value in CTxMemPoolEntry instead of calculating it itself, and so I figured it was safer to put the right calculation in there and avoid spurious test errors. I've been meaning to create a helper class to generate CTxMemPoolEntry's in tests for some time.

  9. laanwj commented at 11:57 AM on April 3, 2016: member

    But the right answer is not to write them more clearly but to get rid of the need to manually calculate them.

    Computing the values in the test itself is exactly what I mean by 'writing more clearly'. It means it's possible to see where the number comes from. (this is not just idle aesthetics by me, but I know at some point the test will need to be updated, and tons of numbers without clear explanation will make that more difficult)

  10. instagibbs commented at 12:03 PM on April 3, 2016: member

    (this is not just idle aesthetics by me, but I know at some point the test will need to be updated, and tons of numbers without clear explanation will make that more difficult)

    Yes, I had to diagram the transactions to figure out what it was trying to do and convince myself they were wrong.

  11. instagibbs closed this on Apr 4, 2016

  12. 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-27 03:16 UTC

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