@@ -372,43 +372,13 @@ struct COutputEntry
372
372
class CMerkleTx
373
373
{
374
374
public:
375
- CTransactionRef tx;
376
- uint256 hashBlock;
377
-
378
- /* An nIndex == -1 means that hashBlock (in nonzero) refers to the earliest
379
- * block in the chain we know this or any in-wallet dependency conflicts
380
- * with. Older clients interpret nIndex == -1 as unconfirmed for backward
381
- * compatibility.
382
- */
383
- int nIndex;
384
-
385
- CMerkleTx ()
386
- {
387
- SetTx (MakeTransactionRef ());
388
- Init ();
389
- }
390
-
391
- explicit CMerkleTx (CTransactionRef arg)
392
- {
393
- SetTx (std::move (arg));
394
- Init ();
395
- }
396
-
397
- void Init ()
398
- {
399
- hashBlock = uint256 ();
400
- nIndex = -1 ;
401
- }
402
-
403
- void SetTx (CTransactionRef arg)
404
- {
405
- tx = std::move (arg);
406
- }
407
-
408
375
ADD_SERIALIZE_METHODS;
409
376
410
377
template <typename Stream, typename Operation>
411
378
inline void SerializationOp (Stream& s, Operation ser_action) {
379
+ CTransactionRef tx;
380
+ uint256 hashBlock;
381
+ int nIndex;
412
382
std::vector<uint256> vMerkleBranch; // For compatibility with older versions.
413
383
READWRITE (tx);
414
384
READWRITE (hashBlock);
@@ -425,7 +395,7 @@ int CalculateMaximumSignedInputSize(const CTxOut& txout, const CWallet* pwallet,
425
395
* A transaction with a bunch of additional info that only the owner cares about.
426
396
* It includes any unrecorded transactions needed to link it back to the block chain.
427
397
*/
428
- class CWalletTx : public CMerkleTx
398
+ class CWalletTx
429
399
{
430
400
private:
431
401
const CWallet* pwallet;
@@ -490,7 +460,10 @@ class CWalletTx : public CMerkleTx
490
460
mutable bool fInMempool ;
491
461
mutable CAmount nChangeCached;
492
462
493
- CWalletTx (const CWallet* pwalletIn, CTransactionRef arg) : CMerkleTx(std::move(arg))
463
+ CWalletTx (const CWallet* pwalletIn, CTransactionRef arg)
464
+ : tx(std::move(arg)),
465
+ hashBlock (uint256()),
466
+ nIndex(-1 )
494
467
{
495
468
Init (pwalletIn);
496
469
}
@@ -510,6 +483,15 @@ class CWalletTx : public CMerkleTx
510
483
nOrderPos = -1 ;
511
484
}
512
485
486
+ CTransactionRef tx;
487
+ uint256 hashBlock;
488
+ /* An nIndex == -1 means that hashBlock (in nonzero) refers to the earliest
489
+ * block in the chain we know this or any in-wallet dependency conflicts
490
+ * with. Older clients interpret nIndex == -1 as unconfirmed for backward
491
+ * compatibility.
492
+ */
493
+ int nIndex;
494
+
513
495
template <typename Stream>
514
496
void Serialize (Stream& s) const
515
497
{
@@ -522,7 +504,8 @@ class CWalletTx : public CMerkleTx
522
504
mapValueCopy[" timesmart" ] = strprintf (" %u" , nTimeSmart);
523
505
}
524
506
525
- s << static_cast <const CMerkleTx&>(*this );
507
+ std::vector<uint256> dummy_vector; // !< Used to be vMerkleBranch
508
+ s << tx << hashBlock << dummy_vector << nIndex;
526
509
std::vector<CMerkleTx> vUnused; // !< Used to be vtxPrev
527
510
s << vUnused << mapValueCopy << vOrderForm << fTimeReceivedIsTxTime << nTimeReceived << fFromMe << fSpent ;
528
511
}
@@ -533,7 +516,8 @@ class CWalletTx : public CMerkleTx
533
516
Init (nullptr );
534
517
char fSpent ;
535
518
536
- s >> static_cast <CMerkleTx&>(*this );
519
+ std::vector<uint256> dummy_vector; // !< Used to be vMerkleBranch
520
+ s >> tx >> hashBlock >> dummy_vector >> nIndex;
537
521
std::vector<CMerkleTx> vUnused; // !< Used to be vtxPrev
538
522
s >> vUnused >> mapValue >> vOrderForm >> fTimeReceivedIsTxTime >> nTimeReceived >> fFromMe >> fSpent ;
539
523
@@ -546,6 +530,11 @@ class CWalletTx : public CMerkleTx
546
530
mapValue.erase (" timesmart" );
547
531
}
548
532
533
+ void SetTx (CTransactionRef arg)
534
+ {
535
+ tx = std::move (arg);
536
+ }
537
+
549
538
// ! make sure balances are recalculated
550
539
void MarkDirty ()
551
540
{
0 commit comments