aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet.h')
-rw-r--r--src/wallet.h56
1 files changed, 25 insertions, 31 deletions
diff --git a/src/wallet.h b/src/wallet.h
index cea61afed3..f8e1ebac12 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -64,7 +64,7 @@ public:
CKeyPool();
CKeyPool(const CPubKey& vchPubKeyIn);
- IMPLEMENT_SERIALIZE;
+ ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
@@ -492,7 +492,7 @@ public:
fMerkleVerified = false;
}
- IMPLEMENT_SERIALIZE;
+ ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
@@ -605,25 +605,22 @@ public:
nOrderPos = -1;
}
- IMPLEMENT_SERIALIZE;
+ ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
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)
- pthis->Init(NULL);
+ if (ser_action.ForRead())
+ Init(NULL);
char fSpent = false;
- if (!fRead)
+ if (!ser_action.ForRead())
{
- pthis->mapValue["fromaccount"] = pthis->strFromAccount;
+ mapValue["fromaccount"] = strFromAccount;
- WriteOrderPos(pthis->nOrderPos, pthis->mapValue);
+ WriteOrderPos(nOrderPos, mapValue);
if (nTimeSmart)
- pthis->mapValue["timesmart"] = strprintf("%u", nTimeSmart);
+ mapValue["timesmart"] = strprintf("%u", nTimeSmart);
}
READWRITE(*(CMerkleTx*)this);
@@ -636,13 +633,13 @@ public:
READWRITE(fFromMe);
READWRITE(fSpent);
- if (fRead)
+ if (ser_action.ForRead())
{
- pthis->strFromAccount = pthis->mapValue["fromaccount"];
+ strFromAccount = mapValue["fromaccount"];
- ReadOrderPos(pthis->nOrderPos, pthis->mapValue);
+ ReadOrderPos(nOrderPos, mapValue);
- pthis->nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(pthis->mapValue["timesmart"]) : 0;
+ nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(mapValue["timesmart"]) : 0;
}
mapValue.erase("fromaccount");
@@ -896,7 +893,7 @@ public:
CWalletKey(int64_t nExpires=0);
- IMPLEMENT_SERIALIZE;
+ ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
@@ -932,7 +929,7 @@ public:
vchPubKey = CPubKey();
}
- IMPLEMENT_SERIALIZE;
+ ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
@@ -975,13 +972,10 @@ public:
nEntryNo = 0;
}
- IMPLEMENT_SERIALIZE;
+ ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
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))
READWRITE(nVersion);
// Note: strAccount is serialized as part of the key, not here.
@@ -989,9 +983,9 @@ public:
READWRITE(nTime);
READWRITE(LIMITED_STRING(strOtherAccount, 65536));
- if (!fRead)
+ if (!ser_action.ForRead())
{
- WriteOrderPos(nOrderPos, me.mapValue);
+ WriteOrderPos(nOrderPos, mapValue);
if (!(mapValue.empty() && _ssExtra.empty()))
{
@@ -999,26 +993,26 @@ public:
ss.insert(ss.begin(), '\0');
ss << mapValue;
ss.insert(ss.end(), _ssExtra.begin(), _ssExtra.end());
- me.strComment.append(ss.str());
+ strComment.append(ss.str());
}
}
READWRITE(LIMITED_STRING(strComment, 65536));
size_t nSepPos = strComment.find("\0", 0, 1);
- if (fRead)
+ if (ser_action.ForRead())
{
- me.mapValue.clear();
+ mapValue.clear();
if (std::string::npos != nSepPos)
{
CDataStream ss(std::vector<char>(strComment.begin() + nSepPos + 1, strComment.end()), nType, nVersion);
- ss >> me.mapValue;
- me._ssExtra = std::vector<char>(ss.begin(), ss.end());
+ ss >> mapValue;
+ _ssExtra = std::vector<char>(ss.begin(), ss.end());
}
- ReadOrderPos(me.nOrderPos, me.mapValue);
+ ReadOrderPos(nOrderPos, mapValue);
}
if (std::string::npos != nSepPos)
- me.strComment.erase(nSepPos);
+ strComment.erase(nSepPos);
mapValue.erase("n");
}