From da60506fc80f6a78f1b271a9a53b956b49b37234 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 10 Nov 2016 15:53:43 -0800 Subject: Add deserializing constructors to CTransaction and CMutableTransaction --- src/primitives/transaction.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/primitives/transaction.h') diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 1d176e5d8c..015a89ff10 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -379,6 +379,7 @@ public: /** Convert a CMutableTransaction into a CTransaction. */ CTransaction(const CMutableTransaction &tx); + CTransaction(CMutableTransaction &&tx); CTransaction& operator=(const CTransaction& tx); @@ -392,6 +393,9 @@ public: } } + template + CTransaction(deserialize_type, Stream& s) : CTransaction(CMutableTransaction(deserialize, s)) {} + bool IsNull() const { return vin.empty() && vout.empty(); } @@ -460,6 +464,11 @@ struct CMutableTransaction SerializeTransaction(*this, s, ser_action); } + template + CMutableTransaction(deserialize_type, Stream& s) { + Unserialize(s); + } + /** Compute the hash of this CMutableTransaction. This is computed on the * fly, as opposed to GetHash() in CTransaction, which uses a cached result. */ -- cgit v1.2.3