Change hardcoded character constants to descriptive named constants for db keys#5707
Change hardcoded character constants to descriptive named constants for db keys#5707laanwj merged 1 commit intobitcoin:masterfrom
Conversation
|
This changes the prefix bytes into prefix ints. Ideally you'd mark the enum as char, but that's not valid C++98 (and we can't use C++11 due to compatibility reasons yet), so for now you'll have to stick with a list of constants rather than making it an enum. |
…nstants for database keys
|
Alrght, I changed it to use |
|
I expected this to result in the same binary, but it doesn't. What appears to happen is that in 40e96a3 it puts the character in a local buffer on the stack, whereas in 14d023f it uses the address of the constant. This makes sense as it passes a reference (pointer). In any case, I did a verification in which I replaced the constants with #defines, and that one matched. I also did rudimentary testing to make sure this doesn't result in a different on-disk format. So ACK. |
14d023f change hardcoded character constants to a set of descriptive named constants for database keys (Earlz)
82f9088 Refactor: Remove using namespace <xxx> from /dbwrapper_tests (random-zebra) 6db0b37 rpc: make `gettxoutsettinfo` run lock-free (random-zebra) f009cf4 Do not shadow members in dbwrapper (random-zebra) b7e540c dbwrapper: Move `HandleError` to `dbwrapper_private` (random-zebra) 43004d0 leveldbwrapper file rename to dbwrapper.* (random-zebra) c882dd9 leveldbwrapper symbol rename: Remove "Level" from class, etc. names (random-zebra) f6496da leveldbwrapper: Remove unused .Prev(), .SeekToLast() methods (random-zebra) cacf3c2 Fix chainstate serialized_size computation (random-zebra) a2a3d33 Add tests for CLevelDBBatch, CLevelDBIterator (random-zebra) 94150ac Encapsulate CLevelDB iterators cleanly (random-zebra) 21df7cc [DB] Refactor leveldbwrapper (random-zebra) 2251db3 change hardcoded character constants to a set of descriptive named co… (random-zebra) Pull request description: This backports a series of updates and cleanups to the LevelDB wrapper from: - bitcoin#5707 - bitcoin#6650 [`*`] - bitcoin#6777 [`*`] - bitcoin#6865 - bitcoin#6873 - bitcoin#7927 [`*`] - bitcoin#8467 - bitcoin#6290 - bitcoin#9281 PIVX-specific edits were required to keep the sporks and zerocoin databases in line. [`*`] NOTE: excluding the obfuscation of databases by xoring data, as we might not want this feature (e.g. as zcash/zcash#2598). Otherwise it can be discussed, and added, with a separate PR. ACKs for top commit: furszy: Re ACK 82f9088 . Fuzzbawls: ACK 82f9088 Tree-SHA512: 1e4a75621d2ec2eb68e01523d15321d1d2176b81aac0525617852899ab38c9b4980daecb9056d054e7961fc758a22143edf914c40d1819144a394f2869a8ad57
This change makes it so that all the magical constants used as database keys like 'b' are actually self-describing. I tried to make it obvious when a key is only suppose to have 1 value in the database (opposed to many).