serialize.h
and nVersion
, nType
shadowing.
283@@ -284,7 +284,7 @@ class CBanEntry
284 ADD_SERIALIZE_METHODS;
285
286 template <typename Stream, typename Operation>
287- inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
288+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int _nVersion) {
I do not understand the original code… :(
https://github.com/bitcoin/bitcoin/blob/master/src/net.h#L286-L293
The original code is assigning to the function argument already.
The change in src/net.h is unclear (at least to me ;-), even in the current tree. What is the purpose of the line https://github.com/bitcoin/bitcoin/blob/master/src/net.h#L291? Assigning to a shadowed variable which is not used at all down below this assignment is strange… It has no meaning in READ, it has no meaning in WRITE.
IIRC we had a short talk about this on IRC with @laanwj a few days ago.
Edit: I PRed its removal in #8658 as a test…
Binaries are not the same
Indeed. Either with -O2
or without, there are binary differences.
The following functions are affected:
0void CBanEntry::SerializationOp<CDataStream, CSerActionSerialize>(CDataStream&, CSerActionSerialize, int, int)
1void CBanEntry::SerializationOp<CDataStream, CSerActionUnserialize>(CDataStream&, CSerActionUnserialize, int, int)
2void CBlockHeader::SerializationOp<CAutoFile, CSerActionSerialize>(CAutoFile&, CSerActionSerialize, int, int)
3void CBlockHeader::SerializationOp<CAutoFile, CSerActionUnserialize>(CAutoFile&, CSerActionUnserialize, int, int)
4void CBlockHeader::SerializationOp<CBufferedFile, CSerActionUnserialize>(CBufferedFile&, CSerActionUnserialize, int, int)
5void CBlockHeader::SerializationOp<CDataStream, CSerActionSerialize>(CDataStream&, CSerActionSerialize, int, int)
6void CBlockHeader::SerializationOp<CDataStream, CSerActionUnserialize>(CDataStream&, CSerActionUnserialize, int, int)
7void CBlockHeader::SerializationOp<CHashWriter, CSerActionSerialize>(CHashWriter&, CSerActionSerialize, int, int)
8void CBlockHeader::SerializationOp<CSizeComputer, CSerActionSerialize>(CSizeComputer&, CSerActionSerialize, int, int)
9void CHDChain::SerializationOp<CDataStream, CSerActionSerialize>(CDataStream&, CSerActionSerialize, int, int)
10void CHDChain::SerializationOp<CDataStream, CSerActionUnserialize>(CDataStream&, CSerActionUnserialize, int, int)
11void CKeyMetadata::SerializationOp<CDataStream, CSerActionSerialize>(CDataStream&, CSerActionSerialize, int, int)
12void CKeyMetadata::SerializationOp<CDataStream, CSerActionUnserialize>(CDataStream&, CSerActionUnserialize, int, int)
nVersion
is used in READWRITE(…). Right now, I do not know how to match the requirement to have the same binary…
paveljanik
theuni
sipa
laanwj
MarcoFalke
Labels
Refactoring