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:
@@ -117,14 +117,14 @@ public:
|
||||
|
||||
//! Implement serialization, as if this was a byte vector.
|
||||
template <typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const
|
||||
void Serialize(Stream& s) const
|
||||
{
|
||||
unsigned int len = size();
|
||||
::WriteCompactSize(s, len);
|
||||
s.write((char*)vch, len);
|
||||
}
|
||||
template <typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion)
|
||||
void Unserialize(Stream& s)
|
||||
{
|
||||
unsigned int len = ::ReadCompactSize(s);
|
||||
if (len <= 65) {
|
||||
@@ -211,7 +211,7 @@ struct CExtPubKey {
|
||||
bool Derive(CExtPubKey& out, unsigned int nChild) const;
|
||||
|
||||
template <typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const
|
||||
void Serialize(Stream& s) const
|
||||
{
|
||||
unsigned int len = BIP32_EXTKEY_SIZE;
|
||||
::WriteCompactSize(s, len);
|
||||
@@ -220,7 +220,7 @@ struct CExtPubKey {
|
||||
s.write((const char *)&code[0], len);
|
||||
}
|
||||
template <typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion)
|
||||
void Unserialize(Stream& s)
|
||||
{
|
||||
unsigned int len = ::ReadCompactSize(s);
|
||||
unsigned char code[BIP32_EXTKEY_SIZE];
|
||||
|
||||
Reference in New Issue
Block a user