コード例 #1
0
 internal void MarkAsUnspent()
 {
     _availableForSpending = true;
     _spentBy = null;
 }
コード例 #2
0
ファイル: Transaction.cs プロジェクト: mavrol/bitcoinsharpev
 /// <summary>
 /// Adds an input directly, with no checking that it's valid.
 /// </summary>
 public void AddInput(TransactionInput input)
 {
     _inputs.Add(input);
 }
コード例 #3
0
 internal void AddInput(TransactionInput input)
 {
     _inputs.Add(input);
 }
コード例 #4
0
 /// <summary>
 /// Sets this objects availableToSpend flag to false and the spentBy pointer to the given input.
 /// If the input is null, it means this output was signed over to somebody else rather than one of our own keys.
 /// </summary>
 internal void MarkAsSpent(TransactionInput input)
 {
     Debug.Assert(_availableForSpending);
     _availableForSpending = false;
     _spentBy = input;
 }
コード例 #5
0
 /// <summary>
 /// Sets this objects availableToSpend flag to false and the spentBy pointer to the given input.
 /// If the input is null, it means this output was signed over to somebody else rather than one of our own keys.
 /// </summary>
 internal void MarkAsSpent(TransactionInput input)
 {
     Debug.Assert(_availableForSpending);
     _availableForSpending = false;
     _spentBy = input;
 }
コード例 #6
0
 internal void MarkAsUnspent()
 {
     _availableForSpending = true;
     _spentBy = null;
 }
コード例 #7
0
ファイル: Transaction.cs プロジェクト: aklein53/bitcoinsharp
 /// <exception cref="ProtocolException"/>
 protected override void Parse()
 {
     _version = ReadUint32();
     // First come the inputs.
     var numInputs = ReadVarInt();
     _inputs = new List<TransactionInput>((int) numInputs);
     for (var i = 0UL; i < numInputs; i++)
     {
         var input = new TransactionInput(Params, this, Bytes, Cursor);
         _inputs.Add(input);
         Cursor += input.MessageSize;
     }
     // Now the outputs
     var numOutputs = ReadVarInt();
     _outputs = new List<TransactionOutput>((int) numOutputs);
     for (var i = 0UL; i < numOutputs; i++)
     {
         var output = new TransactionOutput(Params, this, Bytes, Cursor);
         _outputs.Add(output);
         Cursor += output.MessageSize;
     }
     _lockTime = ReadUint32();
 }
コード例 #8
0
ファイル: Transaction.cs プロジェクト: aklein53/bitcoinsharp
 /// <summary>
 /// Adds an input directly, with no checking that it's valid.
 /// </summary>
 public void AddInput(TransactionInput input)
 {
     _inputs.Add(input);
 }
コード例 #9
0
ファイル: Transaction.cs プロジェクト: Tsunami-ide/Bitcoin
        /// <exception cref="BitCoinSharp.ProtocolException" />
        protected override void Parse()
        {
            _version = ReadUint32();
            // First come the inputs.
            var numInputs = ReadVarInt();
            _inputs = new List<TransactionInput>((int) numInputs);
            for (var i = 0UL; i < numInputs; i++)
            {
                var input = new TransactionInput(Params, this, Bytes, Cursor);
                _inputs.Add(input);
                Cursor += input.MessageSize;
            }
            // Now the outputs
            var numOutputs = ReadVarInt();
            _outputs = new List<TransactionOutput>((int) numOutputs);
            for (var i = 0UL; i < numOutputs; i++)
            {
                var output = new TransactionOutput(Params, this, Bytes, Cursor);
                _outputs.Add(output);
                Cursor += output.MessageSize;
            }
            _lockTime = ReadUint32();

            // Store a hash, it may come in useful later (want to avoid re-serialization costs).
            _hash = new Sha256Hash(Utils.ReverseBytes(Utils.DoubleDigest(Bytes, Offset, Cursor - Offset)));
        }
コード例 #10
0
ファイル: Transaction.cs プロジェクト: Tsunami-ide/Bitcoin
 internal void AddInput(TransactionInput input)
 {
     _inputs.Add(input);
 }
コード例 #11
0
ファイル: Block.cs プロジェクト: bitspill/Gridcoin-master
        /// <summary>
        /// Returns a solved block that builds on top of this one. This exists for unit tests.
        /// </summary>
        internal Block CreateNextBlock(Address to, uint time)
        {
            var b = new Block(Params);
            b.DifficultyTarget = _difficultyTarget;
            b.AddCoinbaseTransaction(_emptyBytes);

            // Add a transaction paying 50 coins to the "to" address.
            var t = new Transaction(Params);
            t.AddOutput(new TransactionOutput(Params, t, Utils.ToNanoCoins(50, 0), to));
            // The input does not really need to be a valid signature, as long as it has the right general form.
            var input = new TransactionInput(Params, t, Script.CreateInputScript(_emptyBytes, _emptyBytes));
            // Importantly the outpoint hash cannot be zero as that's how we detect a coinbase transaction in isolation
            // but it must be unique to avoid 'different' transactions looking the same.
            var counter = new byte[32];
            counter[0] = (byte) _txCounter++;
            input.Outpoint.Hash = new Sha256Hash(counter);
            t.AddInput(input);
            b.AddTransaction(t);

            b.PrevBlockHash = Hash;
            b.TimeSeconds = time;
            b.Solve();
            b.VerifyHeader();
            return b;
        }