Treat generation (mined) transactions less different from receive transactions #1409

pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:listtx_generate_fold changing 5 files +38 −61
  1. luke-jr commented at 2:52 AM on June 2, 2012: member
    • Show address receiving the generation, and include it in the correct "account"
    • Multiple entries in listtransactions output if the coinbase has multiple outputs to us

    Goal: don't make service providers have to jump through near-impossible hoops to handle receiving generated payments/deposits (right now, only MtGox actually handles them correctly); this also makes things nicer for miners who receive to their own wallets (eg, they can tell which pool it came from)

  2. wizkid057 commented at 3:49 AM on June 2, 2012: none

    ACK

  3. Diapolo commented at 3:03 PM on June 3, 2012: none

    I'm not sure if I understand it, do you intend to remove the "generated" status from the client? That would lead to more changes, I think of the mature vs. immature state and other strings used in Qt. Perhaps you can clarify this.

  4. wizkid057 commented at 3:33 PM on June 3, 2012: none

    @Diapolo It seems to set it up so that generation transactions are just treated more like normal transactions and are tagged in the category "received". Since I would guess that anything that made use of this data already should be able to handle a "received" transaction, I don't see the issue.

    Here is a paste of the last block I mined on testnet3 with it: http://pastebin.com/Q6HdDiiT

  5. Diapolo commented at 3:37 PM on June 3, 2012: none

    @wizkid057 I think there are still places in the code that need to be changed for the GUI client to handle generated like received, but I guess @luke-jr should give his thoughts on this, too.

  6. luke-jr commented at 5:36 PM on June 3, 2012: member

    It's not meant to make generation identical to ordinary received coins. That would create problems. It's just intended to make the common parts behave the same, so it's not a hassle to handle generated coins properly. With all current versions, it's impossible to tell what address or account generation was received on, which makes it impossible to handle them without hacking the code.

  7. in src/bitcoinrpc.cpp:None in ee9eecb54d outdated
    1581 |          mapAccountBalances[strSentAccount] -= nFee;
    1582 |          BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& s, listSent)
    1583 |              mapAccountBalances[strSentAccount] -= s.second;
    1584 |          if (wtx.GetDepthInMainChain() >= nMinDepth)
    1585 |          {
    1586 | -            mapAccountBalances[""] += nGeneratedMature;
    


    sipa commented at 10:59 AM on June 13, 2012:

    Do I understand correctly that this doesn't change the "generated coins always to '' account" behaviour?

    EDIT: nevermind


    luke-jr commented at 2:08 PM on June 13, 2012:

    It does, intentionally.

  8. sipa commented at 11:33 AM on June 13, 2012: member

    I like this. Less special casing for generations and ability to assign them to accounts. I do think that changing the way for denoting generations (by "from" : "generation" instead of "category" : "generation") may need some discussion first though, as this breaks compatibility.

  9. jgarzik commented at 11:25 PM on August 2, 2012: contributor

    It is nice to remove this special casing

  10. BitcoinPullTester commented at 3:37 AM on August 10, 2012: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/ee9eecb54db794a97de6e5add719aa6c4c020589 for binaries and test log.

  11. sipa commented at 6:50 PM on August 13, 2012: member

    ACK on the latest change ({"generated" : true} instead of {"from" : "generated"}).

    One minor nitpick: setting the status to "processing" instead of "validating" only at 2 confirmations seems arbitrary to me. 1 confirmation seems more natural. Anyone else with an opinion?

  12. in src/bitcoinrpc.cpp:None in 22e16c5d56 outdated
     171 | +            if (!wtx.GetBlocksToMaturity())
     172 | +                strStatus = "confirmed";
     173 | +            else
     174 | +                strStatus = "processing";
     175 | +        }
     176 | +        else
    


    Diapolo commented at 8:50 PM on August 13, 2012:

    Why don't you just use else if, this looks weird ... same for all other occurrences!


    wizkid057 commented at 8:52 PM on August 13, 2012:

    I personally prefer to not use else if, but, that's me. Doesn't make the code any less functional.


    Diapolo commented at 8:55 PM on August 13, 2012:

    Yes it is a personal favor, but I wanted to express my dislike here :-D. I think it's also harder to read.


    luke-jr commented at 10:35 PM on August 13, 2012:

    The actual meaning/syntax is clearer this way, and plays nicer with diff


    laanwj commented at 3:46 AM on August 14, 2012:

    It is harder to see that the if()s belong to an else this way, while reading the code quickly, as they start on their own line just like stand-alone ifs. Also this is style is used nowhere else in the source.


    Diapolo commented at 8:52 AM on August 14, 2012:

    @laanwj I couldn't have said it any better!

  13. Diapolo commented at 8:52 PM on August 13, 2012: none

    @sipa I also like "processing" on 1+ confirmation better, I don't get the 2+ here. @luke-jr Does this touch or better do you need to look into other Qt code using mature / immature amounts or did you consider all that with the current patch?

  14. luke-jr commented at 10:36 PM on August 13, 2012: member

    @Diapolo The only effect on Bitcoin-Qt is that it shows the address.

  15. BitcoinPullTester commented at 11:15 PM on August 13, 2012: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/22e16c5d56f9506f2ff7fbce01e488bc0551aaf4 for binaries and test log.

  16. sipa commented at 11:51 AM on August 22, 2012: member

    Can you rebase?

  17. gavinandresen commented at 2:12 PM on August 22, 2012: contributor

    I don't like the "processing" state. I say simplify and go with:

    "confirmed" -- 6+ confirmations (120+ for generation) "validating" -- 0+ confirmations ( 1+ for generation) "invalid" -- negative confirmations (contradicted in main chain)

    Those three states plus the explicit 'confirmations' number should be plenty.

  18. luke-jr commented at 4:07 PM on August 22, 2012: member

    @gavinandresen I think it might be nice to have a state that represents "possible to spend immediately, but not confirmed yet" (so 1+/100+); thoughts?

  19. sipa commented at 4:43 PM on August 23, 2012: member

    I don't mind a "maturing"/"processing"/"confirming" state for 1+/100+, but I don't really care.

  20. freewil commented at 5:00 PM on August 23, 2012: contributor

    I think it might be nice to have a state that represents "possible to spend immediately, but not confirmed yet" (so 1+/100+); thoughts?

    +1

  21. gmaxwell commented at 8:24 PM on August 23, 2012: contributor

    Hm. I thought this was supposted to make generated txn work better with accounts, but it doesn't seem to. E.g. listtransactions "accountthathashadgenerationsenttoit" still doesn't give the expected results.

  22. luke-jr commented at 8:38 PM on August 23, 2012: member

    @gmaxwell It does for me?

  23. gmaxwell commented at 8:41 PM on August 23, 2012: contributor

    erp. Nevermind. I fail at testing— just didn't have an account set on my last p2pool address.

  24. gmaxwell commented at 8:45 PM on August 23, 2012: contributor

    How about: "invalid" for conflicted txn / orphan coinbase "validating" for 0 "confirming" for 1-6 "maturing" for 1-120 coinbase "confirmed" for >=6 / >=120

    In any case, shed painting the terms aside, this appears to work for me.

  25. luke-jr commented at 8:59 PM on August 23, 2012: member

    @gmaxwell Having a special status for coinbases contradicts the main goal of the status ;)

    I'd worry "confirming" could be misread as "confirmed" too easily.

    I can rebase this as soon as @gavinandresen makes a final call on the shed painting :)

  26. gmaxwell commented at 9:24 PM on August 23, 2012: contributor

    Good call on confirming being potentially misread (even though the RPC is, in theory, just for machines— lots of code will pass along our text, and it costs nothing to use another string).

    I think this is ready to go in, except for the rebase and shed painting.

  27. gavinandresen commented at 9:48 PM on August 23, 2012: contributor

    Luke, it is long discussions like this where you're pig-headed and ignore what everybody else says that makes me want to ignore every single one of your pull requests.

    So: fix your idiosyncratic coding conventions for ... else if.

    And get rid of the status key entirely; applications have survived without it, and there is obviously no consensus on what words or confirmation levels aught to be.

    And maybe this will make it into the 0.8 release. It is too late for 0.7.

  28. luke-jr commented at 10:18 PM on August 23, 2012: member

    Rebased without "status"

  29. Treat generation (mined) transactions less different from receive transactions
    - Show address receiving the generation, and include it in the correct "account"
    - Multiple entries in listtransactions output if the coinbase has multiple outputs to us
    e07c8e9123
  30. luke-jr commented at 11:22 PM on August 23, 2012: member

    "category" changes reverted to be safer (without "status" it can more easily be misinterpreted).

  31. gmaxwell commented at 11:28 PM on August 23, 2012: contributor

    This is a often requested big improvement, even without the status changes. With the category being left alone, it's reasonably conservative. I've tested it fairly extensively both on testnet and mainnet wallets.

    Future pulls can put the status stuff back in after we figure it out in some future version. The status can also indicate things like observed doublespends. I'll open an issue for that.

  32. gmaxwell referenced this in commit 0050cf21ce on Aug 23, 2012
  33. gmaxwell merged this on Aug 23, 2012
  34. gmaxwell closed this on Aug 23, 2012

  35. suprnurd referenced this in commit ff30aed68f on Dec 5, 2017
  36. lateminer referenced this in commit 8c112d3ac0 on May 6, 2020
  37. 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-13 21:16 UTC

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