/// <param name="parameters">Parameters of the strategy specifying input coins, the target and final selection restrictions.</param> /// <param name="bestSelection">Best selection so far.</param> public SelectionStrategy(StrategyParameters parameters, CoinSelection bestSelection) { Parameters = parameters; BestSelection = bestSelection; RemainingAmounts = new long[InputValues.Length]; long accumulator = InputValues.Sum(); for (int i = 0; i < InputValues.Length; i++) { accumulator -= InputValues[i]; RemainingAmounts[i] = accumulator; } }
/// <param name="target">Value in satoshis.</param> /// <param name="inputValues">Values in satoshis of the coins the user has (in descending order).</param> /// <param name="inputCosts">Costs of spending coins in satoshis.</param> public SelectionStrategy(long target, long[] inputValues, long[] inputCosts, CoinSelection bestSelection) { InputCosts = inputCosts; InputValues = inputValues; Target = target; BestSelection = bestSelection; RemainingAmounts = new long[inputValues.Length]; long accumulator = InputValues.Sum(); for (int i = 0; i < inputValues.Length; i++) { accumulator -= inputValues[i]; RemainingAmounts[i] = accumulator; } }