Output List Initialization

From Open Transactions
Jump to: navigation, search

Initial Conditions

The startwithdrawal API call has been received by the wallet, and all the arguments have been checked for errors.


  1. Pass the inputstart, inputstop, and dustthreshold parameters to the input selection algorithm to obtain an ordered list of eligible inputs.
  2. Perform a first pass check to determine if the requested outputs exceed the size of the eligible inputs. Note that this check is only definitive in the case where the output sum is greater than the input sum. At this stage of the algorithm, the input sum exceeding the output sum does not prove that all outputs will be successfully created.
    1. Take the sum of both lists.
    2. If the sum of the outputs exceeds the sum of the inputs, remove outputs in descending size order until this is no longer true. Note this may result in the output list being an empty set.
      1. Removed outputs are given a status of "partial-" at this stage. This status will be updated at the end of the procedure to include the series number which must be made hot to satisfy the outBailment.
  3. If the output list is non-empty, sort it by SHA256(server id, transaction number) where the server id and transaction number come from the outBailmentID.
    1. Express the server id and transaction number as strings, and concatenate them prior to hashing
  4. Move both the input lists and outputs lists into separate stacks by pushing them in reverse list order. The first input and first output should be on the top of their respective stacks.