@@ -390,42 +390,36 @@ class CWalletTx : public CMerkleTx
390
390
nOrderPos = -1 ;
391
391
}
392
392
393
- ADD_SERIALIZE_METHODS;
394
-
395
- template <typename Stream, typename Operation>
396
- inline void SerializationOp (Stream& s, Operation ser_action) {
397
- if (ser_action.ForRead ())
398
- Init (nullptr );
393
+ template <typename Stream>
394
+ void Serialize (Stream& s) const
395
+ {
399
396
char fSpent = false ;
397
+ mapValue_t mapValueCopy = mapValue;
400
398
401
- if (!ser_action.ForRead ())
402
- {
403
- mapValue[" fromaccount" ] = strFromAccount;
404
-
405
- WriteOrderPos (nOrderPos, mapValue);
406
-
407
- if (nTimeSmart)
408
- mapValue[" timesmart" ] = strprintf (" %u" , nTimeSmart);
399
+ mapValueCopy[" fromaccount" ] = strFromAccount;
400
+ WriteOrderPos (nOrderPos, mapValueCopy);
401
+ if (nTimeSmart) {
402
+ mapValueCopy[" timesmart" ] = strprintf (" %u" , nTimeSmart);
409
403
}
410
404
411
- READWRITE ( *static_cast <CMerkleTx*>(this ) );
405
+ s << *static_cast <const CMerkleTx*>(this );
412
406
std::vector<CMerkleTx> vUnused; // !< Used to be vtxPrev
413
- READWRITE (vUnused);
414
- READWRITE (mapValue);
415
- READWRITE (vOrderForm);
416
- READWRITE (fTimeReceivedIsTxTime );
417
- READWRITE (nTimeReceived);
418
- READWRITE (fFromMe );
419
- READWRITE (fSpent );
407
+ s << vUnused << mapValueCopy << vOrderForm << fTimeReceivedIsTxTime << nTimeReceived << fFromMe << fSpent ;
408
+ }
420
409
421
- if (ser_action.ForRead ())
422
- {
423
- strFromAccount = mapValue[" fromaccount" ];
410
+ template <typename Stream>
411
+ void Unserialize (Stream& s)
412
+ {
413
+ Init (nullptr );
414
+ char fSpent ;
424
415
425
- ReadOrderPos (nOrderPos, mapValue);
416
+ s >> *static_cast <CMerkleTx*>(this );
417
+ std::vector<CMerkleTx> vUnused; // !< Used to be vtxPrev
418
+ s >> vUnused >> mapValue >> vOrderForm >> fTimeReceivedIsTxTime >> nTimeReceived >> fFromMe >> fSpent ;
426
419
427
- nTimeSmart = mapValue.count (" timesmart" ) ? (unsigned int )atoi64 (mapValue[" timesmart" ]) : 0 ;
428
- }
420
+ strFromAccount = std::move (mapValue[" fromaccount" ]);
421
+ ReadOrderPos (nOrderPos, mapValue);
422
+ nTimeSmart = mapValue.count (" timesmart" ) ? (unsigned int )atoi64 (mapValue[" timesmart" ]) : 0 ;
429
423
430
424
mapValue.erase (" fromaccount" );
431
425
mapValue.erase (" spent" );
0 commit comments