From 3a6968d9e873281fe33555904a90a5921929d993 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Fri, 21 Aug 2015 02:15:00 +0300 Subject: [PATCH] CTransaction: copy constructor --- Novacoin/CTransaction.cs | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/Novacoin/CTransaction.cs b/Novacoin/CTransaction.cs index 1fa5bf5..4467ebe 100644 --- a/Novacoin/CTransaction.cs +++ b/Novacoin/CTransaction.cs @@ -42,6 +42,33 @@ namespace Novacoin } /// + /// Initialize new instance as a copy of another transaction + /// + /// Transaction to copy from + public CTransaction(CTransaction tx) + { + nVersion = tx.nVersion; + nTime = tx.nTime; + + vin = new CTxIn[tx.vin.Length]; + + for (int i = 0; i < vin.Length; i++) + { + vin[i] = new CTxIn(tx.vin[i]); + } + + vout = new CTxOut[tx.vout.Length]; + + for (int i = 0; i < vout.Length; i++) + { + vout[i] = new CTxOut(tx.vout[i]); + } + + nLockTime = tx.nLockTime; + } + + + /// /// Parse byte sequence and initialize new instance of CTransaction /// /// -- 1.7.1