nVersion = BitConverter.ToUInt32(wBytes.Get(4), 0);
nTime = BitConverter.ToUInt32(wBytes.Get(4), 0);
- int nInputs = (int)(int)wBytes.GetVarInt();
+ int nInputs = (int)wBytes.GetVarInt();
vin = new CTxIn[nInputs];
for (int nCurrentInput = 0; nCurrentInput < nInputs; nCurrentInput++)
}
/// <summary>
+ /// Serialized size
+ /// </summary>
+ public int Size
+ {
+ get
+ {
+ int nSize = 12; // nVersion, nTime, nLockLime
+
+ nSize += VarInt.GetEncodedSize(vin.Length);
+ nSize += VarInt.GetEncodedSize(vout.Length);
+
+ foreach (var input in vin)
+ {
+ nSize += input.Size;
+ }
+
+ foreach (var output in vout)
+ {
+ nSize += output.Size;
+ }
+
+ return nSize;
+ }
+ }
+
+ /// <summary>
/// Read transactions array which is encoded in the block body.
/// </summary>
/// <param name="wTxBytes">Bytes sequence</param>