Skip to content

Sweep Siafunds

Luke Champine requested to merge sweep-funds into wallet

Previously SweepSeed did not support sweeping siafunds. This PR adds support for sweeping both coins and funds.

When sweeping coins, it is assumed that the user will want to abort the sweep if the value of the coins is less than the cost of the transaction fees. But when sweeping funds, it is assumed the user will never want to abort the sweep for this reason, since funds are much more valuable than coins.

A related complication arises if only funds are found in the scan. When sweeping coins, we can subtract the transaction fee from the total value swept. This is convenient because it means we don't need to touch the existing wallet outputs at all; you can sweep coins even if your balance is zero. However, this is not the case if only funds are found (or if the value of coins found is less than the transaction fee). In this case, we must use the existing wallet outputs to pay for the transaction fee. To make this easier, I first refactored SweepSeed to use a transaction builder before adding siafund support.

Merge request reports