RPC: savemempool: Don’t write mempool.dat while not having the previous one in memory #12142

issue jtimon openend this issue on January 11, 2018
  1. jtimon commented at 0:57 am on January 11, 2018: contributor

    Currently it is possible to stupidly lose mempool data by calling the rpc “savemempool” before the previous stored mempool has been read and processed to the memory mempool.

    I haven’t looked at the code yet, but at minimum one ugly solution would be to have a global g_is_mempool_read_finished (or something of the short) that starts false and gets sets to true once the reading is reading processing of mempool.dat is successfully finished. The rpc savemempool checks this global on the start and returns a an error while it remains false.

  2. jtimon referenced this in commit cce6c03e19 on Jan 11, 2018
  3. sipa commented at 7:29 am on January 11, 2018: member
    Good point, seems easy to fix.
  4. fanquake added the label RPC/REST/ZMQ on Jan 11, 2018
  5. fanquake added the label Mempool on Jan 11, 2018
  6. jtimon commented at 9:01 pm on January 12, 2018: contributor
  7. Willtech commented at 0:51 am on January 14, 2018: contributor

    Having a global g_is_mempool_read_finished (or something of the short) may be one ugly solution but, it is also useful for (proposed/intended) other purposes.

    I haven’t looked at your fix but presume that also the mempool is not again saved if exiting before the mempool is finished loading when persistmempool is true. Is that the expected behaviour? Ideally, it should add any newly received transactions to the dump in that case. Probably outside the scope of your fix.

    It should be noted that on my not particularly low spec system running Fedora, loading mempool takes over 1 hour when the node is started so, it is a long process on some systems, it is possible to receive lots of new transactions if the node is restarted again in that time.

  8. jtimon referenced this in commit 198eee0190 on Jan 20, 2018
  9. laanwj closed this on Mar 29, 2018

  10. laanwj referenced this in commit 3b62a91386 on Mar 29, 2018
  11. markblundeberg referenced this in commit 007edfcb94 on May 9, 2019
  12. jonspock referenced this in commit 42c7c9a3e4 on Jun 13, 2019
  13. jonspock referenced this in commit 1dee08ffdb on Jun 13, 2019
  14. PastaPastaPasta referenced this in commit be018722f1 on Sep 27, 2020
  15. PastaPastaPasta referenced this in commit be87ffbad8 on Oct 22, 2020
  16. DrahtBot locked this on Sep 8, 2021
  17. gades referenced this in commit 08a6de9936 on Mar 17, 2022

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 12:12 UTC

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