Skip to content

Conversation

@paveljanik
Copy link
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.

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

Fixes bitcoin#9810.
@laanwj
Copy link
Member

laanwj commented Feb 20, 2017

Obviously correct ACK 171fc91

<paveljanik> binary on write?
<paveljanik> Windows...
<wumpus> that could be the explanation, good catch! how is the file opened?
<wumpus> if its opened in text (instead of binary) mode, windows will convert \n to \r\n
<paveljanik> it is written with "w" and opened with "r"
<wumpus> that should be "wb" and "rb"
<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).

@laanwj laanwj added this to the 0.14.0 milestone Feb 20, 2017
@theuni
Copy link
Member

theuni commented Feb 20, 2017

Good catch. utACK 171fc91

@achow101
Copy link
Member

achow101 commented Feb 20, 2017

ACK 171fc91

Tested on windows 10 and ubuntu 16.04.


Edit: It works. It is overwriting the old mempool.dat properly.

Copy link
Contributor

@gmaxwell gmaxwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@fanquake
Copy link
Member

utACK 171fc91

@jonasschnelli
Copy link
Contributor

utACK 171fc91

@laanwj laanwj merged commit 171fc91 into bitcoin:master Feb 21, 2017
laanwj added a commit that referenced this pull request Feb 21, 2017
171fc91 Read/write mempool.dat as a binary. (Pavel Janík)
laanwj pushed a commit that referenced this pull request Feb 21, 2017
mempool.dat is a binary file and thus it should be read/written as such.

Fixes #9810.

Github-Pull: #9813
Rebased-From: 171fc91
codablock pushed a commit to codablock/dash that referenced this pull request Jan 26, 2018
171fc91 Read/write mempool.dat as a binary. (Pavel Janík)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
171fc91 Read/write mempool.dat as a binary. (Pavel Janík)
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request Feb 27, 2019
171fc91 Read/write mempool.dat as a binary. (Pavel Janík)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0.14 not loading mempool.dat?

7 participants