/// <summary> /// Initialize new CTxIn instance as copy of another one. /// </summary> /// <param name="i">CTxIn instance.</param> public CTxIn(CTxIn i) { prevout = new COutPoint(i.prevout); scriptSig = i.scriptSig; nSequence = i.nSequence; }
/// <summary> /// Read vin list from byte sequence. /// </summary> /// <param name="wBytes">Reference to binary reader</param> /// <returns>Inputs array</returns> internal static CTxIn[] ReadTxInList(ref BinaryReader reader) { try { // Get amount int nInputs = (int)VarInt.ReadVarInt(ref reader); var vin = new CTxIn[nInputs]; for (int nIndex = 0; nIndex < nInputs; nIndex++) { // Fill inputs array vin[nIndex] = new CTxIn(); vin[nIndex].prevout = new COutPoint(reader.ReadBytes(36)); vin[nIndex].scriptSig = new CScript(reader.ReadBytes((int)VarInt.ReadVarInt(ref reader))); vin[nIndex].nSequence = reader.ReadUInt32(); } // Return inputs array return vin; } catch (Exception e) { throw new TxInConstructorException("Desirealization failed.", e); } }