Avoid permanent cs_main lock in getblockheader #12153

pull promag wants to merge 1 commits into bitcoin:master from promag:2018-01-getblockheader changing 1 files +9 −4
  1. promag commented at 2:26 pm on January 11, 2018: member
    This PR reduces the cs_main lock scope in getblockheader RPC.
  2. promag force-pushed on Jan 11, 2018
  3. fanquake added the label RPC/REST/ZMQ on Jan 11, 2018
  4. promag force-pushed on Jan 11, 2018
  5. promag force-pushed on Jan 12, 2018
  6. promag force-pushed on Jan 12, 2018
  7. promag force-pushed on Jan 15, 2018
  8. ryanofsky commented at 10:33 pm on February 5, 2018: member
    utACK last commit only 5e924f4d22a16b0c46d4c6cb19877892331d41fa (previous commits are from base PR)
  9. jnewbery commented at 9:56 pm on April 3, 2018: member
    needs rebase (but probably not worth doing until #12151 is merged)
  10. MarcoFalke added the label Needs rebase on Jun 6, 2018
  11. promag force-pushed on Jun 10, 2018
  12. promag force-pushed on Jun 10, 2018
  13. DrahtBot removed the label Needs rebase on Jun 11, 2018
  14. DrahtBot closed this on Aug 2, 2018

  15. DrahtBot reopened this on Aug 2, 2018

  16. DrahtBot added the label Needs rebase on Sep 24, 2018
  17. DrahtBot added the label Up for grabs on Jan 3, 2019
  18. DrahtBot closed this on Jan 3, 2019

  19. fanquake reopened this on Jan 4, 2019

  20. fanquake removed the label Up for grabs on Jan 4, 2019
  21. promag force-pushed on Jan 4, 2019
  22. promag commented at 12:35 pm on January 4, 2019: member
    Rebased.
  23. fanquake removed the label Needs rebase on Jan 4, 2019
  24. fanquake deleted a comment on Jan 4, 2019
  25. fanquake deleted a comment on Jan 4, 2019
  26. fanquake deleted a comment on Jan 4, 2019
  27. fanquake deleted a comment on Jan 4, 2019
  28. in src/rpc/blockchain.cpp:761 in 4572a3901f outdated
    761+    const CBlockIndex* pblockindex;
    762+    const CBlockIndex* tip;
    763+    {
    764+        LOCK(cs_main);
    765+        pblockindex = LookupBlockIndex(hash);
    766+        if (!pblockindex) {
    


    MarcoFalke commented at 1:09 pm on January 4, 2019:
    nit: Can leave this out of the cs_main lock to avoid unnecessary indentation and changes?

    promag commented at 1:17 pm on January 4, 2019:
    Yes indeed better.

    promag commented at 3:01 pm on January 4, 2019:
    Done.
  29. rpc: Avoid permanent cs_main lock in getblockheader f12e1d0b51
  30. promag force-pushed on Jan 4, 2019
  31. MarcoFalke commented at 3:08 pm on January 4, 2019: member
    utACK f12e1d0b5117e3688f52a25ed0170d76ecdbf233
  32. ryanofsky approved
  33. ryanofsky commented at 4:38 pm on January 4, 2019: member
    utACK f12e1d0b5117e3688f52a25ed0170d76ecdbf233. No change since last review other than rebase.
  34. MarcoFalke added this to the milestone 0.18.0 on Jan 5, 2019
  35. laanwj commented at 2:11 pm on January 7, 2019: member
    So to be clear: this is can be done, because it is safe to access the fields on the CBlockIndex instance without the lock?
  36. promag commented at 2:55 pm on January 7, 2019: member
    @laanwj to best of my knowledge yes. Looks like nStatus is the only field that needs the lock, which is not used.
  37. jnewbery commented at 9:27 pm on January 7, 2019: member

    utACK f12e1d0b5117e3688f52a25ed0170d76ecdbf233.

    Do you intend to do the same for getblock? Not holding cs_main while reading a block from disk and serializing into json seems like a big win.

  38. laanwj merged this on Jan 8, 2019
  39. laanwj closed this on Jan 8, 2019

  40. laanwj referenced this in commit 29a9f07743 on Jan 8, 2019
  41. promag deleted the branch on Jan 8, 2019
  42. promag commented at 3:20 pm on January 8, 2019: member
    @jnewbery #11913 #13903 are related to that.
  43. LarryRuane referenced this in commit 4b3f1d8190 on Apr 29, 2021
  44. LarryRuane referenced this in commit 7a4a025b06 on Jun 1, 2021
  45. Munkybooty referenced this in commit f3474f2102 on Aug 20, 2021
  46. Munkybooty referenced this in commit 512b959152 on Aug 20, 2021
  47. Munkybooty referenced this in commit a94fb9395d on Aug 21, 2021
  48. Munkybooty referenced this in commit d69fde57c6 on Aug 23, 2021
  49. Munkybooty referenced this in commit 2c2eba6629 on Aug 24, 2021
  50. Munkybooty referenced this in commit 314e1f4fb3 on Aug 24, 2021
  51. UdjinM6 referenced this in commit df08b0a6e6 on Aug 24, 2021
  52. Munkybooty referenced this in commit 60d7fd708c on Aug 24, 2021
  53. 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: 2024-11-17 09:12 UTC

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