diff options
Diffstat (limited to 'src/wallet.h')
-rw-r--r-- | src/wallet.h | 48 |
1 files changed, 16 insertions, 32 deletions
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: |