Remove vtxPrev from CWalletTx #2966

pull pstratem wants to merge 5 commits into bitcoin:master from pstratem:removevtxprev changing 3 files +111 −102
  1. pstratem commented at 1:26 PM on September 1, 2013: contributor

    vtxPrev was intended to make it possible to broadcast supporting transactions.

    For various reasons it doesn't actually accomplish this goal while still consuming a sizable amount of space in the wallet.

    I've removed most references to vtxPrev and replaced them with procedures that pull transactions from mapWallet.

    As a side effect this code includes similar performance improvements to CWalletTx::IsConfirmed as #2952

  2. Remove vtxPrev by replacing with depth first transversal pulling transactions from mapWallet.
    All transactions in vtxPrev are present in mapWallet as well making vtxPrev pointless.
    0c55f1aed0
  3. Simplify implementation with ListUnconfirmedSupportingTransactions 8e74c205fa
  4. Simplify CWalletTx::AcceptWalletTransaction 3a2d650e3b
  5. Dont attempt to put CoinBase transactions in mempool 4928066e98
  6. move CWalletTx::AcceptWalletTransaction to wallet.cpp a80864e8c8
  7. BitcoinPullTester commented at 7:23 PM on September 1, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/a80864e8c8fe19101e54287a770769784ddafd17 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  8. sipa commented at 2:04 PM on September 29, 2013: member

    @pstratem I've forgotten what we've discussed related to this. Do you remember, and is this still the suggested change?

  9. gavinandresen commented at 5:35 AM on October 4, 2013: contributor

    Can you elaborate on "For various reasons it doesn't actually accomplish this goal" ?

    I worry that this pull will break a coinjoin implementation that uses the raw transactions API, but from your comment it sounds like that might be broken anyway ( @gmaxwell : have you done any testing with using other people's unconfirmed inputs to build a coinjoin transaction? )

  10. sipa commented at 8:39 AM on October 4, 2013: member

    @pstratem, @gmaxwell and I discussed this prior to this pull request.

    It seems that currently, vtxPrev is only ever pulled from your wallet, meaning there is no way that something in vtxPrev is something you don't already have. After some digging, we found out this was likely because of the original pay-to-IP protocol, so that unconfirmed dependencies get sent out to receivers automatically (mental note: the payment protocol could use this too). In its current state it is both useless and inefficient (there is a degree of duplication, if you have wallets with many unconfirmed transactions). The solution was to remove it altogether now, and perhaps later re-introduce it when it's useful, in a saner way (without duplication, for starters).

  11. pstratem commented at 8:43 AM on October 4, 2013: contributor

    @sipa this is still the suggested change, however at least one bug was revealed and there are likely more that I have not noticed

    getbalance conf=0 can be negative if you have transactions which pay to an IsMine address

  12. pstratem commented at 8:40 PM on October 9, 2013: contributor

    I just noticed that bug above is actually currently possible to trigger if you happen to have a wallet where vtxPrev has at least one correct entry. Assuming this worked correctly at some point that would be something to fix also.

  13. mikehearn commented at 3:04 PM on November 1, 2013: contributor

    mental note: the payment protocol could use this too

    The payment protocol was designed with this in mind from the start :) That's why you are allowed to submit multiple transactions in a Payment message submission.

  14. sipa commented at 11:36 PM on January 27, 2014: member

    Looks good overall,, but a few suggestions:

    • Can you rebase? AcceptWalletTransaction is no longer in main, for example.
    • It would make things more efficient and shorter, if ListUnconfirmedSupportingTransactions would:
      • Return itself as well, in addition to the dependencies (only if it isn't confirmed already).
      • Would reverse the result already.
      • Would return CWalletTx* objects (as it's called within a cs_wallet, the pointers should remain valid) directly.

    There are basically three cases (relay, accept, isconfirmed) where you want to do some operation on the dependencies, and then on the object itself. If the list returned by ListUnconfirmed... already contains the object itself, no code duplicate is necessary for those.

    I'm not convinced about the pfCompleteSet semantics yet.

  15. laanwj commented at 2:12 PM on February 24, 2014: member

    Closing in favor of #3694 which does this as well

  16. laanwj closed this on Feb 24, 2014

  17. Bushstar referenced this in commit a83b63186b on Apr 8, 2020
  18. Bushstar referenced this in commit c5415e746a on Apr 8, 2020
  19. 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-19 00:16 UTC

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