BitSharper.Wallet.GetBalance C# (CSharp) Méthode

GetBalance() public méthode

Returns the balance of this wallet as calculated by the provided balanceType.
public GetBalance ( BalanceType balanceType ) : ulong
balanceType BalanceType
Résultat ulong
        public ulong GetBalance(BalanceType balanceType)
        {
            lock (this)
            {
                var available = 0UL;
                foreach (var tx in Unspent.Values)
                {
                    foreach (var output in tx.Outputs)
                    {
                        if (!output.IsMine(this)) continue;
                        if (!output.IsAvailableForSpending) continue;
                        available += output.Value;
                    }
                }
                if (balanceType == BalanceType.Available)
                    return available;
                Debug.Assert(balanceType == BalanceType.Estimated);
                // Now add back all the pending outputs to assume the transaction goes through.
                var estimated = available;
                foreach (var tx in Pending.Values)
                {
                    foreach (var output in tx.Outputs)
                    {
                        if (!output.IsMine(this)) continue;
                        estimated += output.Value;
                    }
                }
                return estimated;
            }
        }

Same methods

Wallet::GetBalance ( ) : ulong