Ejemplo n.º 1
0
        public TxIn(TxOutpoint outpoint, byte[] script, uint sequence)
        {
            Contract.Requires <ArgumentNullException>(outpoint != null, "outpoint");
            Contract.Requires <ArgumentNullException>(script != null, "script");

            Outpoint     = outpoint;
            ScriptLength = (ulong)script.LongLength;
            _script      = (byte[])script.Clone();
            Sequence     = sequence;

            ByteSize = Outpoint.ByteSize + ScriptLength.ByteSize + (uint)ScriptLength.Value * BufferOperations.UINT8_SIZE + Sequence.ByteSize();
        }
Ejemplo n.º 2
0
        public TxIn(TxOutpoint outpoint, byte[] script, uint sequence)
        {
            Contract.Requires<ArgumentNullException>(outpoint != null, "outpoint");
            Contract.Requires<ArgumentNullException>(script != null, "script");

            Outpoint = outpoint;
            ScriptLength = (ulong)script.LongLength;
            _script = (byte[])script.Clone();
            Sequence = sequence;

            ByteSize = Outpoint.ByteSize + ScriptLength.ByteSize + (uint)ScriptLength.Value * BufferOperations.UINT8_SIZE + Sequence.ByteSize();
        }
Ejemplo n.º 3
0
        public TxIn(byte[] buffer, int offset)
            : base(buffer, offset)
        {
            Contract.Requires<ArgumentNullException>(buffer != null, "buffer");
            Contract.Requires<ArgumentException>(buffer.Length >= TxIn.MinimumByteSize, "buffer");
            Contract.Requires<ArgumentOutOfRangeException>(offset >= 0, "offset");
            Contract.Requires<ArgumentOutOfRangeException>(offset <= buffer.Length - TxIn.MinimumByteSize, "offset");

            Outpoint = new TxOutpoint(buffer, offset);
            ScriptLength = new VarInt(buffer, offset + SCRIPTLEN_OFFSET);
            var script = new byte[ScriptLength];
            Array.Copy(buffer, offset + SCRIPTLEN_OFFSET + (int)ScriptLength.ByteSize, script, 0, (int)ScriptLength.Value);
            _script = script;
            Sequence = buffer.ReadUInt32(offset + SCRIPTLEN_OFFSET + (int)ScriptLength.ByteSize + (int)ScriptLength.Value * BufferOperations.UINT8_SIZE);

            ByteSize = Outpoint.ByteSize + ScriptLength.ByteSize + (uint)ScriptLength.Value * BufferOperations.UINT8_SIZE + Sequence.ByteSize();
        }
Ejemplo n.º 4
0
        public TxIn(byte[] buffer, int offset)
            : base(buffer, offset)
        {
            Contract.Requires <ArgumentNullException>(buffer != null, "buffer");
            Contract.Requires <ArgumentException>(buffer.Length >= TxIn.MinimumByteSize, "buffer");
            Contract.Requires <ArgumentOutOfRangeException>(offset >= 0, "offset");
            Contract.Requires <ArgumentOutOfRangeException>(offset <= buffer.Length - TxIn.MinimumByteSize, "offset");

            Outpoint     = new TxOutpoint(buffer, offset);
            ScriptLength = new VarInt(buffer, offset + SCRIPTLEN_OFFSET);
            var script = new byte[ScriptLength];

            Array.Copy(buffer, offset + SCRIPTLEN_OFFSET + (int)ScriptLength.ByteSize, script, 0, (int)ScriptLength.Value);
            _script  = script;
            Sequence = buffer.ReadUInt32(offset + SCRIPTLEN_OFFSET + (int)ScriptLength.ByteSize + (int)ScriptLength.Value * BufferOperations.UINT8_SIZE);

            ByteSize = Outpoint.ByteSize + ScriptLength.ByteSize + (uint)ScriptLength.Value * BufferOperations.UINT8_SIZE + Sequence.ByteSize();
        }