aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/addrman.h7
-rw-r--r--src/alert.h8
-rw-r--r--src/bloom.h4
-rw-r--r--src/core.h57
-rw-r--r--src/crypter.h4
-rw-r--r--src/main.h35
-rw-r--r--src/netbase.h13
-rw-r--r--src/protocol.h18
-rw-r--r--src/qt/recentrequeststablemodel.h9
-rw-r--r--src/qt/walletmodel.h7
-rw-r--r--src/serialize.h51
-rw-r--r--src/wallet.h48
-rw-r--r--src/walletdb.h4
13 files changed, 81 insertions, 184 deletions
diff --git a/src/addrman.h b/src/addrman.h
index 05af436aeb..2b6e45664c 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -49,14 +49,11 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
- CAddress* pthis = (CAddress*)(this);
- READWRITE(*pthis);
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ READWRITE(*(CAddress*)this);
READWRITE(source);
READWRITE(nLastSuccess);
READWRITE(nAttempts);
- return nSerSize;
}
void Init()
diff --git a/src/alert.h b/src/alert.h
index 46ec4fbde0..b25ac41f6b 100644
--- a/src/alert.h
+++ b/src/alert.h
@@ -49,8 +49,7 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(nRelayUntil);
@@ -66,7 +65,6 @@ public:
READWRITE(LIMITED_STRING(strComment, 65536));
READWRITE(LIMITED_STRING(strStatusBar, 256));
READWRITE(LIMITED_STRING(strReserved, 256));
- return nSerSize;
}
void SetNull();
@@ -89,11 +87,9 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(vchMsg);
READWRITE(vchSig);
- return nSerSize;
}
void SetNull();
diff --git a/src/bloom.h b/src/bloom.h
index 8dbf74f494..a5269d08d4 100644
--- a/src/bloom.h
+++ b/src/bloom.h
@@ -65,13 +65,11 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(vData);
READWRITE(nHashFuncs);
READWRITE(nTweak);
READWRITE(nFlags);
- return nSerSize;
}
void insert(const std::vector<unsigned char>& vKey);
diff --git a/src/core.h b/src/core.h
index e56be1a4ec..486782e5b7 100644
--- a/src/core.h
+++ b/src/core.h
@@ -34,10 +34,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(FLATDATA(*this));
- return nSerSize;
}
void SetNull() { hash = 0; n = (uint32_t) -1; }
@@ -96,12 +94,10 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(prevout);
READWRITE(scriptSig);
READWRITE(nSequence);
- return nSerSize;
}
bool IsFinal() const
@@ -152,10 +148,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(nSatoshisPerK);
- return nSerSize;
}
};
@@ -179,11 +173,9 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(nValue);
READWRITE(scriptPubKey);
- return nSerSize;
}
void SetNull()
@@ -264,9 +256,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
READWRITE(*const_cast<int32_t*>(&this->nVersion));
nVersion = this->nVersion;
@@ -275,8 +266,6 @@ public:
READWRITE(*const_cast<uint32_t*>(&nLockTime));
if (fRead)
UpdateHash();
-
- return nSerSize;
}
bool IsNull() const {
@@ -327,16 +316,12 @@ struct CMutableTransaction
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
-
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(vin);
READWRITE(vout);
READWRITE(nLockTime);
-
- return nSerSize;
}
/** Compute the hash of this CMutableTransaction. This is computed on the
@@ -360,9 +345,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
if (!fRead) {
uint64_t nVal = CompressAmount(txout.nValue);
READWRITE(VARINT(nVal));
@@ -373,7 +357,6 @@ public:
}
CScriptCompressor cscript(REF(txout.scriptPubKey));
READWRITE(cscript);
- return nSerSize;
}
};
@@ -430,10 +413,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(vprevout);
- return nSerSize;
}
};
@@ -465,9 +446,7 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
-
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(hashPrevBlock);
@@ -475,8 +454,6 @@ public:
READWRITE(nTime);
READWRITE(nBits);
READWRITE(nNonce);
-
- return nSerSize;
}
void SetNull()
@@ -526,13 +503,9 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
-
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(*(CBlockHeader*)this);
READWRITE(vtx);
-
- return nSerSize;
}
void SetNull()
@@ -580,14 +553,10 @@ struct CBlockLocator
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
-
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vHave);
-
- return nSerSize;
}
void SetNull()
diff --git a/src/crypter.h b/src/crypter.h
index ce4c6315aa..b00f92721c 100644
--- a/src/crypter.h
+++ b/src/crypter.h
@@ -46,14 +46,12 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(vchCryptedKey);
READWRITE(vchSalt);
READWRITE(nDerivationMethod);
READWRITE(nDeriveIterations);
READWRITE(vchOtherDerivationParameters);
- return nSerSize;
}
CMasterKey()
diff --git a/src/main.h b/src/main.h
index 8a5fa0e7e0..cea8a649e3 100644
--- a/src/main.h
+++ b/src/main.h
@@ -200,11 +200,9 @@ struct CDiskBlockPos
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(VARINT(nFile));
READWRITE(VARINT(nPos));
- return nSerSize;
}
CDiskBlockPos() {
@@ -235,11 +233,9 @@ struct CDiskTxPos : public CDiskBlockPos
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(*(CDiskBlockPos*)this);
READWRITE(VARINT(nTxOffset));
- return nSerSize;
}
CDiskTxPos(const CDiskBlockPos &blockIn, unsigned int nTxOffsetIn) : CDiskBlockPos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
@@ -320,10 +316,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(vtxundo);
- return nSerSize;
}
bool WriteToDisk(CDiskBlockPos &pos, const uint256 &hashBlock);
@@ -429,9 +423,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
READWRITE(nTransactions);
READWRITE(vHash);
@@ -449,8 +442,6 @@ public:
vBytes[p / 8] |= vBits[p] << (p % 8);
READWRITE(vBytes);
}
-
- return nSerSize;
}
// Construct a partial merkle tree from a list of transaction id's, and a mask that selects a subset of them
@@ -510,9 +501,7 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
-
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(VARINT(nBlocks));
READWRITE(VARINT(nSize));
READWRITE(VARINT(nUndoSize));
@@ -520,8 +509,6 @@ public:
READWRITE(VARINT(nHeightLast));
READWRITE(VARINT(nTimeFirst));
READWRITE(VARINT(nTimeLast));
-
- return nSerSize;
}
void SetNull() {
@@ -788,9 +775,7 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
-
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
if (!(nType & SER_GETHASH))
READWRITE(VARINT(nVersion));
@@ -811,8 +796,6 @@ public:
READWRITE(nTime);
READWRITE(nBits);
READWRITE(nNonce);
-
- return nSerSize;
}
uint256 GetBlockHash() const
@@ -1014,11 +997,9 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(header);
READWRITE(txn);
- return nSerSize;
}
};
diff --git a/src/netbase.h b/src/netbase.h
index b4ba711261..1ea37519a6 100644
--- a/src/netbase.h
+++ b/src/netbase.h
@@ -91,10 +91,8 @@ class CNetAddr
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(FLATDATA(ip));
- return nSerSize;
}
};
@@ -155,16 +153,13 @@ class CService : public CNetAddr
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
- size_t nSerSize = 0;
- CService* pthis = const_cast<CService*>(this);
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
READWRITE(FLATDATA(ip));
unsigned short portN = htons(port);
READWRITE(portN);
if (fRead)
- pthis->port = ntohs(portN);
- return nSerSize;
+ port = ntohs(portN);
}
};
diff --git a/src/protocol.h b/src/protocol.h
index 0f5c5559d1..e4b0991774 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -38,13 +38,11 @@ class CMessageHeader
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(FLATDATA(pchMessageStart));
READWRITE(FLATDATA(pchCommand));
READWRITE(nMessageSize);
READWRITE(nChecksum);
- return nSerSize;
}
// TODO: make private (improves encapsulation)
@@ -90,12 +88,10 @@ class CAddress : public CService
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
CAddress* pthis = const_cast<CAddress*>(this);
- CService* pip = (CService*)pthis;
if (fRead)
pthis->Init();
if (nType & SER_DISK)
@@ -104,9 +100,7 @@ class CAddress : public CService
(nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH)))
READWRITE(nTime);
READWRITE(nServices);
- READWRITE(*pip);
-
- return nSerSize;
+ READWRITE(*(CService*)this);
}
// TODO: make private (improves encapsulation)
@@ -131,11 +125,9 @@ class CInv
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(type);
READWRITE(hash);
- return nSerSize;
}
friend bool operator<(const CInv& a, const CInv& b);
diff --git a/src/qt/recentrequeststablemodel.h b/src/qt/recentrequeststablemodel.h
index 581d7b2c5e..a558aa4942 100644
--- a/src/qt/recentrequeststablemodel.h
+++ b/src/qt/recentrequeststablemodel.h
@@ -27,9 +27,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
RecentRequestEntry* pthis = const_cast<RecentRequestEntry*>(this);
@@ -42,9 +41,7 @@ public:
READWRITE(recipient);
if (fRead)
- pthis->date = QDateTime::fromTime_t(nDate);
-
- return nSerSize;
+ date = QDateTime::fromTime_t(nDate);
}
};
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index 553b566544..2a9ac4650f 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -62,9 +62,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
SendCoinsRecipient* pthis = const_cast<SendCoinsRecipient*>(this);
@@ -94,8 +93,6 @@ public:
pthis->paymentRequest.parse(QByteArray::fromRawData(sPaymentRequest.data(), sPaymentRequest.size()));
pthis->authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant);
}
-
- return nSerSize;
}
};
diff --git a/src/serialize.h b/src/serialize.h
index 6eefa18135..4e6ca57a49 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -22,7 +22,6 @@
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits/is_fundamental.hpp>
-#include <boost/typeof/typeof.hpp>
class CAutoFile;
class CDataStream;
@@ -88,24 +87,25 @@ enum
SER_GETHASH = (1 << 2),
};
-#define READWRITE(obj) (nSerSize += ::SerReadWrite(s, (obj), nType, nVersion, ser_action))
+#define READWRITE(obj) (::SerReadWrite(s, (obj), nType, nVersion, ser_action))
/* Implement three methods for serializable objects. These are actually wrappers over
* "SerializationOp" template, which implements the body of each class' serialization
* code. Adding "IMPLEMENT_SERIALIZE" in the body of the class causes these wrappers to be
* added as members. */
-#define IMPLEMENT_SERIALIZE \
- size_t GetSerializeSize(int nType, int nVersion) const { \
- ser_streamplaceholder s; \
- return NCONST_PTR(this)->SerializationOp(s, CSerActionGetSerializeSize(), nType, nVersion); \
- } \
- template<typename Stream> \
- void Serialize(Stream& s, int nType, int nVersion) const { \
- NCONST_PTR(this)->SerializationOp(s, CSerActionSerialize(), nType, nVersion); \
- } \
- template<typename Stream> \
- void Unserialize(Stream& s, int nType, int nVersion) { \
- SerializationOp(s, CSerActionUnserialize(), nType, nVersion); \
+#define IMPLEMENT_SERIALIZE \
+ size_t GetSerializeSize(int nType, int nVersion) const { \
+ CSizeComputer s(nType, nVersion); \
+ NCONST_PTR(this)->SerializationOp(s, CSerActionSerialize(), nType, nVersion);\
+ return s.size(); \
+ } \
+ template<typename Stream> \
+ void Serialize(Stream& s, int nType, int nVersion) const { \
+ NCONST_PTR(this)->SerializationOp(s, CSerActionSerialize(), nType, nVersion);\
+ } \
+ template<typename Stream> \
+ void Unserialize(Stream& s, int nType, int nVersion) { \
+ SerializationOp(s, CSerActionUnserialize(), nType, nVersion); \
}
@@ -809,32 +809,27 @@ void Unserialize(Stream& is, std::set<K, Pred, A>& m, int nType, int nVersion)
//
// Support for IMPLEMENT_SERIALIZE and READWRITE macro
//
-class CSerActionGetSerializeSize { };
-class CSerActionSerialize { };
-class CSerActionUnserialize { };
-
-template<typename Stream, typename T>
-inline unsigned int SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionGetSerializeSize ser_action)
+struct CSerActionSerialize
{
- return ::GetSerializeSize(obj, nType, nVersion);
-}
+ bool ForRead() const { return false; }
+};
+struct CSerActionUnserialize
+{
+ bool ForRead() const { return true; }
+};
template<typename Stream, typename T>
-inline unsigned int SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionSerialize ser_action)
+inline void SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionSerialize ser_action)
{
::Serialize(s, obj, nType, nVersion);
- return 0;
}
template<typename Stream, typename T>
-inline unsigned int SerReadWrite(Stream& s, T& obj, int nType, int nVersion, CSerActionUnserialize ser_action)
+inline void SerReadWrite(Stream& s, T& obj, int nType, int nVersion, CSerActionUnserialize ser_action)
{
::Unserialize(s, obj, nType, nVersion);
- return 0;
}
-struct ser_streamplaceholder { };
-
diff --git a/src/wallet.h b/src/wallet.h
index d30a28218f..aa811ee584 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -66,13 +66,11 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(nTime);
READWRITE(vchPubKey);
- return nSerSize;
}
};
@@ -496,16 +494,12 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
-
- nSerSize += SerReadWrite(s, *(CTransaction*)this, nType, nVersion, ser_action);
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ READWRITE(*(CTransaction*)this);
nVersion = this->nVersion;
READWRITE(hashBlock);
READWRITE(vMerkleBranch);
READWRITE(nIndex);
-
- return nSerSize;
}
int SetMerkleBranch(const CBlock* pblock=NULL);
@@ -613,9 +607,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
CWalletTx* pthis = const_cast<CWalletTx*>(this);
if (fRead)
@@ -632,7 +625,7 @@ public:
pthis->mapValue["timesmart"] = strprintf("%u", nTimeSmart);
}
- nSerSize += SerReadWrite(s, *(CMerkleTx*)this, nType, nVersion,ser_action);
+ READWRITE(*(CMerkleTx*)this);
std::vector<CMerkleTx> vUnused; // Used to be vtxPrev
READWRITE(vUnused);
READWRITE(mapValue);
@@ -651,13 +644,11 @@ public:
pthis->nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(pthis->mapValue["timesmart"]) : 0;
}
- pthis->mapValue.erase("fromaccount");
- pthis->mapValue.erase("version");
- pthis->mapValue.erase("spent");
- pthis->mapValue.erase("n");
- pthis->mapValue.erase("timesmart");
-
- return nSerSize;
+ mapValue.erase("fromaccount");
+ mapValue.erase("version");
+ mapValue.erase("spent");
+ mapValue.erase("n");
+ mapValue.erase("timesmart");
}
// make sure balances are recalculated
@@ -907,15 +898,13 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vchPrivKey);
READWRITE(nTimeCreated);
READWRITE(nTimeExpires);
READWRITE(LIMITED_STRING(strComment, 65536));
- return nSerSize;
}
};
@@ -945,12 +934,10 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vchPubKey);
- return nSerSize;
}
};
@@ -990,9 +977,8 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
CAccountingEntry& me = *const_cast<CAccountingEntry*>(this);
if (!(nType & SER_GETHASH))
@@ -1033,9 +1019,7 @@ public:
if (std::string::npos != nSepPos)
me.strComment.erase(nSepPos);
- me.mapValue.erase("n");
-
- return nSerSize;
+ mapValue.erase("n");
}
private:
diff --git a/src/walletdb.h b/src/walletdb.h
index 2dd257c2c1..c2f427ae77 100644
--- a/src/walletdb.h
+++ b/src/walletdb.h
@@ -57,12 +57,10 @@ public:
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(nCreateTime);
- return nSerSize;
}
void SetNull()