Read/write mempool.dat as a binary. #9813

pull paveljanik wants to merge 1 commits into bitcoin:master from paveljanik:20170220_mempool_binary changing 1 files +2 −2
  1. paveljanik commented at 5:15 pm on February 20, 2017: contributor

    mempool.dat is a binary file and thus it should be read/written as such.

    Fixes #9810.

    I can’t test on Windows though.

  2. Read/write mempool.dat as a binary.
    mempool.dat is a binary file and thus it should be read/written as such.
    
    Fixes #9810.
    171fc91f06
  3. laanwj commented at 5:21 pm on February 20, 2017: member

    Obviously correct ACK https://github.com/bitcoin/bitcoin/pull/9813/commits/171fc91f061d4a980eedfa522e302b8598408cc5

    0<paveljanik> binary on write?
    1<paveljanik> Windows...
    2<wumpus> that could be the explanation, good catch! how is the file opened?
    3<wumpus> if its opened in text (instead of binary) mode, windows will convert \n to \r\n
    4<paveljanik> it is written with "w" and opened with "r"
    5<wumpus> that should be "wb" and "rb"
    6<wumpus> so you've found the issue, congrats
    

    I wonder if we have any more instances of this.

    Edit: no, I’ve grepped for uses for r and rw and w on fopen, and the other cases all deal with text files (log file, pid file) or are only applicable to POSIX platforms (/dev/urandom in secp256k1 tests).

  4. laanwj added this to the milestone 0.14.0 on Feb 20, 2017
  5. laanwj added the label Mempool on Feb 20, 2017
  6. laanwj added the label Windows on Feb 20, 2017
  7. theuni commented at 5:28 pm on February 20, 2017: member
    Good catch. utACK 171fc91f061d4a980eedfa522e302b8598408cc5
  8. achow101 commented at 6:49 pm on February 20, 2017: member

    ACK 171fc91f061d4a980eedfa522e302b8598408cc5

    Tested on windows 10 and ubuntu 16.04.

    0
    1Edit: It works. It is overwriting the old mempool.dat properly.
    
  9. gmaxwell approved
  10. gmaxwell commented at 0:49 am on February 21, 2017: contributor
    utACK
  11. fanquake commented at 2:29 am on February 21, 2017: member
    utACK 171fc91
  12. jonasschnelli commented at 8:32 am on February 21, 2017: contributor
    utACK 171fc91f061d4a980eedfa522e302b8598408cc5
  13. laanwj merged this on Feb 21, 2017
  14. laanwj closed this on Feb 21, 2017

  15. laanwj referenced this in commit 7d46b3ea8d on Feb 21, 2017
  16. laanwj referenced this in commit 3972a8efb2 on Feb 21, 2017
  17. codablock referenced this in commit 8d2edc4698 on Jan 26, 2018
  18. andvgal referenced this in commit 4438ff8a20 on Jan 6, 2019
  19. CryptoCentric referenced this in commit 10d9ae5da5 on Feb 27, 2019
  20. MarcoFalke 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: 2024-12-22 21:12 UTC

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