mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-26 23:09:03 +02:00
Introduce convenience type CTransactionRef
This commit is contained in:
@@ -73,7 +73,7 @@ class CBlock : public CBlockHeader
|
||||
{
|
||||
public:
|
||||
// network and disk
|
||||
std::vector<std::shared_ptr<const CTransaction>> vtx;
|
||||
std::vector<CTransactionRef> vtx;
|
||||
|
||||
// memory only
|
||||
mutable bool fChecked;
|
||||
|
||||
@@ -475,6 +475,12 @@ struct CMutableTransaction
|
||||
uint256 GetHash() const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<const CTransaction> CTransactionRef;
|
||||
static inline CTransactionRef MakeTransactionRef() { return std::make_shared<const CTransaction>(); }
|
||||
template <typename Tx> static inline CTransactionRef MakeTransactionRef(Tx&& txIn) { return std::make_shared<const CTransaction>(std::forward<Tx>(txIn)); }
|
||||
static inline CTransactionRef MakeTransactionRef(const CTransactionRef& txIn) { return txIn; }
|
||||
static inline CTransactionRef MakeTransactionRef(CTransactionRef&& txIn) { return std::move(txIn); }
|
||||
|
||||
/** Compute the weight of a transaction, as defined by BIP 141 */
|
||||
int64_t GetTransactionWeight(const CTransaction &tx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user