From b4e4ba475a5679e09f279aaf2a83dcf93c632bdb Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 10 Nov 2016 17:34:17 -0800 Subject: Introduce convenience type CTransactionRef --- src/primitives/transaction.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/primitives/transaction.h') diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 015a89ff10..0fa85a1519 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -475,6 +475,12 @@ struct CMutableTransaction uint256 GetHash() const; }; +typedef std::shared_ptr CTransactionRef; +static inline CTransactionRef MakeTransactionRef() { return std::make_shared(); } +template static inline CTransactionRef MakeTransactionRef(Tx&& txIn) { return std::make_shared(std::forward(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); -- cgit v1.2.3