From 05b56d1c937b7667ad51400d2f9fb674af72953f Mon Sep 17 00:00:00 2001 From: John Newbery Date: Wed, 24 Jul 2019 14:09:28 -0400 Subject: [PATCH] [wallet] Remove CMerkleTx serialization logic CMerkleTx is only used for deserialization of old wallet files. Remove the serialization logic, and tidy up CWalletTx serialization logic. --- src/wallet/wallet.h | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index faed0f46a70..27f74728062 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -372,20 +372,16 @@ struct COutputEntry class CMerkleTx { public: - ADD_SERIALIZE_METHODS; - - template - inline void SerializationOp(Stream& s, Operation ser_action) { + template + void Unserialize(Stream& s) + { CTransactionRef tx; uint256 hashBlock; + std::vector vMerkleBranch; int nIndex; - std::vector vMerkleBranch; // For compatibility with older versions. - READWRITE(tx); - READWRITE(hashBlock); - READWRITE(vMerkleBranch); - READWRITE(nIndex); - } + s >> tx >> hashBlock >> vMerkleBranch >> nIndex; + } }; //Get the marginal bytes of spending the specified output @@ -495,7 +491,6 @@ public: template void Serialize(Stream& s) const { - char fSpent = false; mapValue_t mapValueCopy = mapValue; mapValueCopy["fromaccount"] = ""; @@ -504,22 +499,21 @@ public: mapValueCopy["timesmart"] = strprintf("%u", nTimeSmart); } - std::vector dummy_vector; //!< Used to be vMerkleBranch - s << tx << hashBlock << dummy_vector << nIndex; - std::vector vUnused; //!< Used to be vtxPrev - s << vUnused << mapValueCopy << vOrderForm << fTimeReceivedIsTxTime << nTimeReceived << fFromMe << fSpent; + std::vector dummy_vector1; //!< Used to be vMerkleBranch + std::vector dummy_vector2; //!< Used to be vtxPrev + char dummy_char = false; //!< Used to be fSpent + s << tx << hashBlock << dummy_vector1 << nIndex << dummy_vector2 << mapValueCopy << vOrderForm << fTimeReceivedIsTxTime << nTimeReceived << fFromMe << dummy_char; } template void Unserialize(Stream& s) { Init(nullptr); - char fSpent; - std::vector dummy_vector; //!< Used to be vMerkleBranch - s >> tx >> hashBlock >> dummy_vector >> nIndex; - std::vector vUnused; //!< Used to be vtxPrev - s >> vUnused >> mapValue >> vOrderForm >> fTimeReceivedIsTxTime >> nTimeReceived >> fFromMe >> fSpent; + std::vector dummy_vector1; //!< Used to be vMerkleBranch + std::vector dummy_vector2; //!< Used to be vtxPrev + char dummy_char; //! Used to be fSpent + s >> tx >> hashBlock >> dummy_vector1 >> nIndex >> dummy_vector2 >> mapValue >> vOrderForm >> fTimeReceivedIsTxTime >> nTimeReceived >> fFromMe >> dummy_char; ReadOrderPos(nOrderPos, mapValue); nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(mapValue["timesmart"]) : 0;