BitSharper.TransactionInput.Connect C# (CSharp) Method

Connect() private method

Connects this input to the relevant output of the referenced transaction if it's in the given map. Connecting means updating the internal pointers and spent flags.
private Connect ( Transaction>.IDictionary transactions, bool disconnect ) : ConnectionResult
transactions Transaction>.IDictionary Map of txhash->transaction.
disconnect bool Whether to abort if there's a pre-existing connection or not.
return ConnectionResult
        internal ConnectionResult Connect(IDictionary<Sha256Hash, Transaction> transactions, bool disconnect)
        {
            Transaction tx;
            if (!transactions.TryGetValue(Outpoint.Hash, out tx))
                return ConnectionResult.NoSuchTx;
            var @out = tx.Outputs[Outpoint.Index];
            if ([email protected])
            {
                if (disconnect)
                    @out.MarkAsUnspent();
                else
                    return ConnectionResult.AlreadySpent;
            }
            Outpoint.FromTx = tx;
            @out.MarkAsSpent(this);
            return ConnectionResult.Success;
        }