Difference between revisions of "Split Output"

From Open Transactions
Jump to navigation Jump to search
Line 1: Line 1:
 
<div style="float: right"><include iframe src="https://www.lucidchart.com/documents/embeddedchart/c72ce59c-65c0-4a90-943a-c669bac5a737" width="300" height="1004" frameborder="0" scrolling="yes" /></div>
 
<div style="float: right"><include iframe src="https://www.lucidchart.com/documents/embeddedchart/c72ce59c-65c0-4a90-943a-c669bac5a737" width="300" height="1004" frameborder="0" scrolling="yes" /></div>
  
This procedure is used when either the inputs required to satisfy a single output can not fit within transaction size limits (due to a large output or small inputs) or there are not enough inputs to satisfy a given output.
+
This procedure is used when either the inputs required to satisfy a single output can not fit within transaction size limits (due to a large output or small inputs) or there are not enough inputs to satisfy the last output added to the transaction.
  
 
The <code>outBailment</code> will be split across two or more transactions in the case of an oversize transaction, or be partially satisfied in the case of not sufficient inputs.
 
The <code>outBailment</code> will be split across two or more transactions in the case of an oversize transaction, or be partially satisfied in the case of not sufficient inputs.
Line 12: Line 12:
 
==Sequence==
 
==Sequence==
  
# Update the value of the output in the transaction to be the sum of the inputs minus the required transaction fee.
+
# Update the value of the last output in the transaction to be the sum of the inputs minus the required transaction fee and the total of all inputs except the last one.
 
# Make a copy of the [[Outputs (Voting Pool Wallet API)|outputs]] object corresponding to this outBailmentID.
 
# Make a copy of the [[Outputs (Voting Pool Wallet API)|outputs]] object corresponding to this outBailmentID.
 
# Update the <code>amount</code> field of the copied output by subtracting the value determined in step 1.
 
# Update the <code>amount</code> field of the copied output by subtracting the value determined in step 1.

Revision as of 16:32, 2 December 2014

This procedure is used when either the inputs required to satisfy a single output can not fit within transaction size limits (due to a large output or small inputs) or there are not enough inputs to satisfy the last output added to the transaction.

The outBailment will be split across two or more transactions in the case of an oversize transaction, or be partially satisfied in the case of not sufficient inputs.

Initial Conditions

  • The transaction being constructed contains one or more outputs, and many inputs.
  • The transaction did not exceed any size limits until the most recent input was added.

Sequence

  1. Update the value of the last output in the transaction to be the sum of the inputs minus the required transaction fee and the total of all inputs except the last one.
  2. Make a copy of the outputs object corresponding to this outBailmentID.
  3. Update the amount field of the copied output by subtracting the value determined in step 1.
  4. Push this new output to the output stack.
  5. Update the status field for this outBailmentID in the withdrawal status object to "partial-".
  6. Perform the Finalize Transaction Procedure.
  7. Initialize a new transaction.