aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2019-07-24 14:09:28 -0400
committerJohn Newbery <john@johnnewbery.com>2019-07-30 11:57:06 -0400
commit05b56d1c937b7667ad51400d2f9fb674af72953f (patch)
treee2e472524e2a4449d9a42ac60e4a9e36c3c3de2b /src
parent783a76f23ba4f33b6e6f609eaf3bf41afd9bcd6f (diff)
[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.
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index faed0f46a7..27f7472806 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -372,20 +372,16 @@ struct COutputEntry
class CMerkleTx
{
public:
- ADD_SERIALIZE_METHODS;
-
- template <typename Stream, typename Operation>
- inline void SerializationOp(Stream& s, Operation ser_action) {
+ template<typename Stream>
+ void Unserialize(Stream& s)
+ {
CTransactionRef tx;
uint256 hashBlock;
+ std::vector<uint256> vMerkleBranch;
int nIndex;
- std::vector<uint256> 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<typename Stream>
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<uint256> dummy_vector; //!< Used to be vMerkleBranch
- s << tx << hashBlock << dummy_vector << nIndex;
- std::vector<CMerkleTx> vUnused; //!< Used to be vtxPrev
- s << vUnused << mapValueCopy << vOrderForm << fTimeReceivedIsTxTime << nTimeReceived << fFromMe << fSpent;
+ std::vector<char> dummy_vector1; //!< Used to be vMerkleBranch
+ std::vector<char> 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<typename Stream>
void Unserialize(Stream& s)
{
Init(nullptr);
- char fSpent;
- std::vector<uint256> dummy_vector; //!< Used to be vMerkleBranch
- s >> tx >> hashBlock >> dummy_vector >> nIndex;
- std::vector<CMerkleTx> vUnused; //!< Used to be vtxPrev
- s >> vUnused >> mapValue >> vOrderForm >> fTimeReceivedIsTxTime >> nTimeReceived >> fFromMe >> fSpent;
+ std::vector<uint256> dummy_vector1; //!< Used to be vMerkleBranch
+ std::vector<CMerkleTx> 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;