@@ -364,13 +364,13 @@ struct COutputEntry
364
364
int vout;
365
365
};
366
366
367
- /* * A transaction with a merkle branch linking it to the block chain. */
367
+ /* * Legacy class used for deserializing vtxPrev for backwards compatibility.
368
+ * vtxPrev was removed in commit 93a18a3650292afbb441a47d1fa1b94aeb0164e3,
369
+ * but old wallet.dat files may still contain vtxPrev vectors of CMerkleTxs.
370
+ * These need to get deserialized for field alignment when deserializing
371
+ * a CWalletTx, but the deserialized values are discarded.**/
368
372
class CMerkleTx
369
373
{
370
- private:
371
- /* * Constant used in hashBlock to indicate tx has been abandoned */
372
- static const uint256 ABANDON_HASH;
373
-
374
374
public:
375
375
CTransactionRef tx;
376
376
uint256 hashBlock;
@@ -416,30 +416,6 @@ class CMerkleTx
416
416
READWRITE (nIndex);
417
417
}
418
418
419
- void SetMerkleBranch (const uint256& block_hash, int posInBlock);
420
-
421
- /* *
422
- * Return depth of transaction in blockchain:
423
- * <0 : conflicts with a transaction this deep in the blockchain
424
- * 0 : in memory pool, waiting to be included in a block
425
- * >=1 : this many blocks deep in the main chain
426
- */
427
- int GetDepthInMainChain (interfaces::Chain::Lock& locked_chain) const ;
428
- bool IsInMainChain (interfaces::Chain::Lock& locked_chain) const { return GetDepthInMainChain (locked_chain) > 0 ; }
429
-
430
- /* *
431
- * @return number of blocks to maturity for this transaction:
432
- * 0 : is not a coinbase transaction, or is a mature coinbase transaction
433
- * >0 : is a coinbase transaction which matures in this many blocks
434
- */
435
- int GetBlocksToMaturity (interfaces::Chain::Lock& locked_chain) const ;
436
- bool hashUnset () const { return (hashBlock.IsNull () || hashBlock == ABANDON_HASH); }
437
- bool isAbandoned () const { return (hashBlock == ABANDON_HASH); }
438
- void setAbandoned () { hashBlock = ABANDON_HASH; }
439
-
440
- const uint256& GetHash () const { return tx->GetHash (); }
441
- bool IsCoinBase () const { return tx->IsCoinBase (); }
442
- bool IsImmatureCoinBase (interfaces::Chain::Lock& locked_chain) const ;
443
419
};
444
420
445
421
// Get the marginal bytes of spending the specified output
@@ -454,6 +430,9 @@ class CWalletTx : public CMerkleTx
454
430
private:
455
431
const CWallet* pwallet;
456
432
433
+ /* * Constant used in hashBlock to indicate tx has been abandoned */
434
+ static const uint256 ABANDON_HASH;
435
+
457
436
public:
458
437
/* *
459
438
* Key/value map with information about the transaction.
@@ -630,6 +609,31 @@ class CWalletTx : public CMerkleTx
630
609
// that we still have the runtime check "AssertLockHeld(pwallet->cs_wallet)"
631
610
// in place.
632
611
std::set<uint256> GetConflicts () const NO_THREAD_SAFETY_ANALYSIS;
612
+
613
+ void SetMerkleBranch (const uint256& block_hash, int posInBlock);
614
+
615
+ /* *
616
+ * Return depth of transaction in blockchain:
617
+ * <0 : conflicts with a transaction this deep in the blockchain
618
+ * 0 : in memory pool, waiting to be included in a block
619
+ * >=1 : this many blocks deep in the main chain
620
+ */
621
+ int GetDepthInMainChain (interfaces::Chain::Lock& locked_chain) const ;
622
+ bool IsInMainChain (interfaces::Chain::Lock& locked_chain) const { return GetDepthInMainChain (locked_chain) > 0 ; }
623
+
624
+ /* *
625
+ * @return number of blocks to maturity for this transaction:
626
+ * 0 : is not a coinbase transaction, or is a mature coinbase transaction
627
+ * >0 : is a coinbase transaction which matures in this many blocks
628
+ */
629
+ int GetBlocksToMaturity (interfaces::Chain::Lock& locked_chain) const ;
630
+ bool hashUnset () const { return (hashBlock.IsNull () || hashBlock == ABANDON_HASH); }
631
+ bool isAbandoned () const { return (hashBlock == ABANDON_HASH); }
632
+ void setAbandoned () { hashBlock = ABANDON_HASH; }
633
+
634
+ const uint256& GetHash () const { return tx->GetHash (); }
635
+ bool IsCoinBase () const { return tx->IsCoinBase (); }
636
+ bool IsImmatureCoinBase (interfaces::Chain::Lock& locked_chain) const ;
633
637
};
634
638
635
639
class COutput
0 commit comments