Add test for CWalletTx::GetImmatureCredit() returning stale values. #9359

pull ryanofsky wants to merge 1 commits into bitcoin:master from ryanofsky:pr/immature changing 1 files +25 −0
  1. ryanofsky commented at 2:42 AM on December 16, 2016: member

    Fix CWalletTx::GetImmatureCredit() returning stale values.

    One line fix. Add missing assignment to CWalletTx::MarkDirty() to clear the cached immature credit flag.

    Updated description: Add test for cached immature credit flag not being cleared in CWalletTx::MarkDirty() bug, which was fixed in #8717, commit a560378.

  2. ryanofsky force-pushed on Dec 16, 2016
  3. laanwj commented at 10:03 AM on December 16, 2016: member

    Seems a duplicate of #8717?

    (except that you add a test)

  4. fanquake added the label Wallet on Dec 16, 2016
  5. ryanofsky force-pushed on Dec 16, 2016
  6. ryanofsky commented at 4:08 PM on December 16, 2016: member

    @laanwj, it's basically the same as #8717 (which I didn't know about) except it adds the test and places the new assignment in between fCreditCached and fAvailableCreditCached following the order of CWalletTx class members. So I think it's a slightly better PR.

  7. laanwj commented at 10:29 AM on December 21, 2016: member

    Right. Will merge #8717 first, then we can rebase this into a test-only pull. (utACK otherwise)

  8. MarcoFalke added the label Tests on Dec 21, 2016
  9. in src/wallet/test/wallet_tests.cpp:None in e18c4b6178 outdated
     366 | +    wtx.hashBlock = chainActive.Tip()->GetBlockHash();
     367 | +    wtx.nIndex = 0;
     368 | +
     369 | +    // Call GetImmatureCredit() once before adding the key to the wallet to
     370 | +    // cache the current immature credit amount, which is 0.
     371 | +    BOOST_CHECK_EQUAL(wtx.GetImmatureCredit(), 0);
    


    MarcoFalke commented at 12:22 PM on December 21, 2016:

    Travis:

    Assertion failed: lock cs_main not held in ../../src/wallet/wallet.cpp:3761; locks held:
    Running 221 test cases...
    unknown location(0): fatal error: in "wallet_tests/coin_mark_dirty_immature_credit": signal: SIGABRT (application abort requested)
    ../../src/wallet/test/wallet_tests.cpp(371): last checkpoint
    test_bitcoin: ../../src/key.cpp:300: void ECC_Start(): Assertion `secp256k1_context_sign == __null' failed.
    unknown location(0): fatal error: in "wallet_tests/coin_selection_tests": signal: SIGABRT (application abort requested)
    ../../src/wallet/test/wallet_tests.cpp(70): last checkpoint: "coin_selection_tests" fixture entry.
    test_bitcoin: ../../src/key.cpp:300: void ECC_Start(): Assertion `secp256k1_context_sign == __null' failed.
    unknown location(0): fatal error: in "wallet_crypto/decrypt": signal: SIGABRT (application abort requested)
    ../../src/wallet/test/crypto_tests.cpp(217): last checkpoint: "decrypt" fixture entry.
    

    ryanofsky commented at 11:43 PM on January 4, 2017:

    Thanks, the locking error has been fixed.

  10. ryanofsky force-pushed on Dec 21, 2016
  11. ryanofsky force-pushed on Dec 21, 2016
  12. ryanofsky renamed this:
    Fix CWalletTx::GetImmatureCredit() returning stale values.
    Add test for CWalletTx::GetImmatureCredit() returning stale values.
    on Dec 21, 2016
  13. ryanofsky force-pushed on Jan 4, 2017
  14. kallewoof commented at 5:46 AM on February 9, 2017: member

    ACK 52045d1 (test passes on version rebased onto master)

  15. Add test for CWalletTx::GetImmatureCredit() returning stale values.
    Add test for cached immature credit flag not being cleared in
    CWalletTx::MarkDirty() bug, which was fixed in
    https://github.com/bitcoin/bitcoin/pull/8717, commit a560378.
    7ed143c10e
  16. ryanofsky force-pushed on Mar 1, 2017
  17. ryanofsky commented at 10:47 AM on March 1, 2017: member

    Rebased 52045d1bb71cd4be7ae269c63a8260df02a8cb56 -> 7ed143c10ec7c34843cb025951a6bbf279d1774d (immature.5 -> immature.6) because of conflict with recent changes in wallet_tests.cpp.

  18. MarcoFalke commented at 9:26 PM on March 2, 2017: member

    utACK 7ed143c10ec7c34843cb025951a6bbf279d1774d. Sorry, somehow forgot about this pull.

  19. MarcoFalke merged this on Mar 2, 2017
  20. MarcoFalke closed this on Mar 2, 2017

  21. MarcoFalke referenced this in commit f7ec7cfd38 on Mar 2, 2017
  22. PastaPastaPasta referenced this in commit 73fc2d437e on Dec 29, 2018
  23. PastaPastaPasta referenced this in commit 4565004a6c on Dec 31, 2018
  24. PastaPastaPasta referenced this in commit e3a253dd1d on Dec 31, 2018
  25. PastaPastaPasta referenced this in commit d6a162e945 on Dec 31, 2018
  26. PastaPastaPasta referenced this in commit 7994d9854b on Jan 2, 2019
  27. PastaPastaPasta referenced this in commit ae8d82a2bf on Jan 2, 2019
  28. PastaPastaPasta referenced this in commit 18badef855 on Jan 2, 2019
  29. PastaPastaPasta referenced this in commit 5ecebcc32b on Jan 2, 2019
  30. PastaPastaPasta referenced this in commit a9a6021226 on Jan 3, 2019
  31. PastaPastaPasta referenced this in commit 960cdc431f on Jan 3, 2019
  32. PastaPastaPasta referenced this in commit 13101d8307 on Jan 5, 2019
  33. PastaPastaPasta referenced this in commit c012ec73e5 on Jan 5, 2019
  34. PastaPastaPasta referenced this in commit 4e8e889c7f on Jan 7, 2019
  35. PastaPastaPasta referenced this in commit cf740dd4fc on Jan 7, 2019
  36. PastaPastaPasta referenced this in commit 18ba7b5519 on Jan 7, 2019
  37. PastaPastaPasta referenced this in commit fb4423c99b on Jan 7, 2019
  38. PastaPastaPasta referenced this in commit 55a656c24c on Jan 23, 2019
  39. PastaPastaPasta referenced this in commit 3d0700b57d on Jan 25, 2019
  40. PastaPastaPasta referenced this in commit 25dee871e3 on Jan 25, 2019
  41. MarcoFalke locked this on Dec 16, 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