src/Stratis.FederatedPeg.Features.FederationGateway/Wallet/FederationWallet.cs
/// <summary>
/// Lists all spendable transactions in the current wallet.
/// </summary>
/// <param name="currentChainHeight">The current height of the chain. Used for calculating the number of confirmations a transaction has.</param>
/// <param name="confirmations">The minimum number of confirmations required for transactions to be considered.</param>
/// <returns>A collection of spendable outputs that belong to the given account.</returns>
Lists all spendable transactions in the current wallet.
Lists all spendable transactions in the current wallet .
public IEnumerable<UnspentOutputReference> GetSpendableTransactions(int currentChainHeight, int confirmations = 0)
        {
            int countFrom = currentChainHeight + 1;
            foreach (TransactionData transactionData in this.GetSpendableTransactions())
            {
                int? confirmationCount = 0;
                if (transactionData.BlockHeight != null)
                    confirmationCount = countFrom >= transactionData.BlockHeight ? countFrom - transactionData.BlockHeight : 0;
                if (confirmationCount >= confirmations)
                {
                    yield return new UnspentOutputReference
                    {
                        Transaction = transactionData,
                    };
                }
            }
        }
public IEnumerable < UnspentOutputReference > GetSpendableTransactions ( int currentChainHeight , int confirmations = 0 ) { int countFrom = currentChainHeight + 1 ; foreach ( TransactionData transactionData in this . GetSpendableTransactions ( ) ) { int ? confirmationCount = 0 ; if ( transactionData . BlockHeight != null ) confirmationCount = countFrom >= transactionData . BlockHeight ? countFrom - transactionData . BlockHeight : 0 ; if ( confirmationCount >= confirmations ) { yield return new UnspentOutputReference { Transaction = transactionData , } ; } } }
Lists all spendable transactions in the current wallet.
Lists all spendable transactions in the current wallet .
// A block that is at the tip has 1 confirmation. // When calculating the confirmations the tip must be advanced by one.
A collection of spendable outputs that belong to the given account.
A collection of spendable outputs that belong to the given account .
currentChainHeight
int
The current height of the chain. Used for calculating the number of confirmations a transaction has.
The current height of the chain . Used for calculating the number of confirmations a transaction has .
confirmations
int
The minimum number of confirmations required for transactions to be considered.
The minimum number of confirmations required for transactions to be considered .