Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Refactor mempool.dat to be extensible, and store missing info #9422

Open
wants to merge 2 commits into
from

Conversation

Projects
None yet
7 participants
Member

luke-jr commented Dec 25, 2016

Should fix #9103

@fanquake fanquake added the Mempool label Dec 26, 2016

@@ -4027,7 +4027,7 @@ int VersionBitsTipStateSinceHeight(const Consensus::Params& params, Consensus::D
return VersionBitsStateSinceHeight(chainActive.Tip(), params, pos, versionbitscache);
}
-static const uint64_t MEMPOOL_DUMP_VERSION = 1;
+static const uint64_t MEMPOOL_DUMP_VERSION = 2;
@sipa

sipa Dec 27, 2016

Owner

We never released a version with version 1, I think?

@luke-jr

luke-jr Dec 27, 2016

Member

I'm planning to for Knots 0.13.2

@sipa

sipa Jan 10, 2017

Owner

Ok. There is hardly any loss...

Contributor

paveljanik commented Jan 8, 2017

Needs rebase.

@@ -4027,7 +4027,7 @@ int VersionBitsTipStateSinceHeight(const Consensus::Params& params, Consensus::D
return VersionBitsStateSinceHeight(chainActive.Tip(), params, pos, versionbitscache);
}
-static const uint64_t MEMPOOL_DUMP_VERSION = 1;
+static const uint64_t MEMPOOL_DUMP_VERSION = 2;
@sipa

sipa Jan 10, 2017

Owner

Ok. There is hardly any loss...

src/validation.cpp
+
+ it = mapData.find("deltas");
+ if (it == mapData.end()) {
+ try {
@sipa

sipa Jan 10, 2017

Owner

Can't this try block be made to enclose all deserialization operations, so that the catch and error reporting can be written only once?

src/validation.cpp
@@ -4092,24 +4113,43 @@ bool LoadMempool(void)
return true;
}
+template <class T>
+std::vector<unsigned char> SerializeToVector(T o) {
+ CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
@sipa

sipa Jan 10, 2017

Owner

SER_DISK / CLIENT_VERSION? I doubt it matters for anything, but better be consistent for now.

Member

luke-jr commented Jan 12, 2017

Fixed serialisation params. There are conflicts now - may I rebase?

Member

luke-jr commented Jan 12, 2017

Rebased.

@@ -4192,42 +4192,63 @@ bool LoadMempool(void)
if (version != MEMPOOL_DUMP_VERSION) {
@kallewoof

kallewoof Feb 10, 2017

Member

The implications seem to be minor, but this means all bitcoin nodes prior to this PR being merged will drop all their mempools on startup. Is that okay? Would it be possible / worth it to load version=1 mempools too? Above comment by @sipa seems to indicate this was never used, in which case I think we should simply say MEMPOOL_DUMP_VERSION = 1 above.

I'm not actually sure we want to save mempoolminfee - if you just restarted the practical mempoolminfee on the network may be much lower....it puts you in a state of downloading lots of transactions only pretty briefly (assuming any of your peers aren't limiting their mempool, which they almost always are, so mempoolminfee on most nodes never actually leaves 0 anyway). Probably not worth a incompatible version just for this, IMO, though if we had other things we wanted to store we could revisit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment