mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Get rid of nType and nVersion
Remove the nType and nVersion as parameters to all serialization methods and functions. There is only one place where it's read and has an impact (in CAddress), and even there it does not impact any of the recursively invoked serializers. Instead, the few places that need nType or nVersion are changed to read it directly from the stream object, through GetType() and GetVersion() methods which are added to all stream classes.
This commit is contained in:
@@ -17,7 +17,7 @@ using namespace std;
|
||||
class CAddrManSerializationMock : public CAddrMan
|
||||
{
|
||||
public:
|
||||
virtual void Serialize(CDataStream& s, int nType, int nVersionDummy) const = 0;
|
||||
virtual void Serialize(CDataStream& s) const = 0;
|
||||
|
||||
//! Ensure that bucket placement is always the same for testing purposes.
|
||||
void MakeDeterministic()
|
||||
@@ -30,16 +30,16 @@ public:
|
||||
class CAddrManUncorrupted : public CAddrManSerializationMock
|
||||
{
|
||||
public:
|
||||
void Serialize(CDataStream& s, int nType, int nVersionDummy) const
|
||||
void Serialize(CDataStream& s) const
|
||||
{
|
||||
CAddrMan::Serialize(s, nType, nVersionDummy);
|
||||
CAddrMan::Serialize(s);
|
||||
}
|
||||
};
|
||||
|
||||
class CAddrManCorrupted : public CAddrManSerializationMock
|
||||
{
|
||||
public:
|
||||
void Serialize(CDataStream& s, int nType, int nVersionDummy) const
|
||||
void Serialize(CDataStream& s) const
|
||||
{
|
||||
// Produces corrupt output that claims addrman has 20 addrs when it only has one addr.
|
||||
unsigned char nVersion = 1;
|
||||
|
||||
Reference in New Issue
Block a user