But if createWalletTxInput returns an error, the original inputs are not restored.
Solution
Today createWalletTxInput shouldn't ever return an error, though it may in the future if a new witness type is added. We should unify all error paths in AddWalletInputs to ensure inputs are restored.
BudgetInputSet.AddWalletInputs
currently restores the original inputs if there aren't enough wallet inputs to meet the budget.https://github.com/lightningnetwork/lnd/blob/9d358bc64934caef724108fc9704097db31658c4/sweep/tx_input_set.go#L297-L327
But if
createWalletTxInput
returns an error, the original inputs are not restored.Solution
Today
createWalletTxInput
shouldn't ever return an error, though it may in the future if a new witness type is added. We should unify all error paths inAddWalletInputs
to ensure inputs are restored.