|
|
@ -609,21 +609,18 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
template <typename Stream, typename Operation> |
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
bool fRead = ser_action.ForRead(); |
|
|
|
if (ser_action.ForRead()) |
|
|
|
|
|
|
|
Init(NULL); |
|
|
|
CWalletTx* pthis = const_cast<CWalletTx*>(this); |
|
|
|
|
|
|
|
if (fRead) |
|
|
|
|
|
|
|
pthis->Init(NULL); |
|
|
|
|
|
|
|
char fSpent = false; |
|
|
|
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) |
|
|
|
if (nTimeSmart) |
|
|
|
pthis->mapValue["timesmart"] = strprintf("%u", nTimeSmart); |
|
|
|
mapValue["timesmart"] = strprintf("%u", nTimeSmart); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
READWRITE(*(CMerkleTx*)this); |
|
|
|
READWRITE(*(CMerkleTx*)this); |
|
|
@ -636,13 +633,13 @@ public: |
|
|
|
READWRITE(fFromMe); |
|
|
|
READWRITE(fFromMe); |
|
|
|
READWRITE(fSpent); |
|
|
|
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"); |
|
|
|
mapValue.erase("fromaccount"); |
|
|
@ -979,9 +976,6 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
template <typename Stream, typename Operation> |
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
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)) |
|
|
|
if (!(nType & SER_GETHASH)) |
|
|
|
READWRITE(nVersion); |
|
|
|
READWRITE(nVersion); |
|
|
|
// Note: strAccount is serialized as part of the key, not here.
|
|
|
|
// Note: strAccount is serialized as part of the key, not here.
|
|
|
@ -989,9 +983,9 @@ public: |
|
|
|
READWRITE(nTime); |
|
|
|
READWRITE(nTime); |
|
|
|
READWRITE(LIMITED_STRING(strOtherAccount, 65536)); |
|
|
|
READWRITE(LIMITED_STRING(strOtherAccount, 65536)); |
|
|
|
|
|
|
|
|
|
|
|
if (!fRead) |
|
|
|
if (!ser_action.ForRead()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WriteOrderPos(nOrderPos, me.mapValue); |
|
|
|
WriteOrderPos(nOrderPos, mapValue); |
|
|
|
|
|
|
|
|
|
|
|
if (!(mapValue.empty() && _ssExtra.empty())) |
|
|
|
if (!(mapValue.empty() && _ssExtra.empty())) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -999,26 +993,26 @@ public: |
|
|
|
ss.insert(ss.begin(), '\0'); |
|
|
|
ss.insert(ss.begin(), '\0'); |
|
|
|
ss << mapValue; |
|
|
|
ss << mapValue; |
|
|
|
ss.insert(ss.end(), _ssExtra.begin(), _ssExtra.end()); |
|
|
|
ss.insert(ss.end(), _ssExtra.begin(), _ssExtra.end()); |
|
|
|
me.strComment.append(ss.str()); |
|
|
|
strComment.append(ss.str()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
READWRITE(LIMITED_STRING(strComment, 65536)); |
|
|
|
READWRITE(LIMITED_STRING(strComment, 65536)); |
|
|
|
|
|
|
|
|
|
|
|
size_t nSepPos = strComment.find("\0", 0, 1); |
|
|
|
size_t nSepPos = strComment.find("\0", 0, 1); |
|
|
|
if (fRead) |
|
|
|
if (ser_action.ForRead()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
me.mapValue.clear(); |
|
|
|
mapValue.clear(); |
|
|
|
if (std::string::npos != nSepPos) |
|
|
|
if (std::string::npos != nSepPos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CDataStream ss(std::vector<char>(strComment.begin() + nSepPos + 1, strComment.end()), nType, nVersion); |
|
|
|
CDataStream ss(std::vector<char>(strComment.begin() + nSepPos + 1, strComment.end()), nType, nVersion); |
|
|
|
ss >> me.mapValue; |
|
|
|
ss >> mapValue; |
|
|
|
me._ssExtra = std::vector<char>(ss.begin(), ss.end()); |
|
|
|
_ssExtra = std::vector<char>(ss.begin(), ss.end()); |
|
|
|
} |
|
|
|
} |
|
|
|
ReadOrderPos(me.nOrderPos, me.mapValue); |
|
|
|
ReadOrderPos(nOrderPos, mapValue); |
|
|
|
} |
|
|
|
} |
|
|
|
if (std::string::npos != nSepPos) |
|
|
|
if (std::string::npos != nSepPos) |
|
|
|
me.strComment.erase(nSepPos); |
|
|
|
strComment.erase(nSepPos); |
|
|
|
|
|
|
|
|
|
|
|
mapValue.erase("n"); |
|
|
|
mapValue.erase("n"); |
|
|
|
} |
|
|
|
} |
|
|
|