mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 23:21:12 +02:00
sweep: pass dustLimit to CreateSweepTx
This commit is contained in:
@@ -132,7 +132,7 @@ func generateInputPartitionings(sweepableInputs []txInput,
|
||||
// createSweepTx builds a signed tx spending the inputs to a the output script.
|
||||
func createSweepTx(inputs []input.Input, outputPkScript []byte,
|
||||
currentBlockHeight uint32, feePerKw chainfee.SatPerKWeight,
|
||||
signer input.Signer) (*wire.MsgTx, error) {
|
||||
dustLimit btcutil.Amount, signer input.Signer) (*wire.MsgTx, error) {
|
||||
|
||||
inputs, estimator := getWeightEstimate(inputs, feePerKw)
|
||||
|
||||
@@ -169,14 +169,16 @@ func createSweepTx(inputs []input.Input, outputPkScript []byte,
|
||||
}
|
||||
|
||||
// Sweep as much possible, after subtracting txn fees.
|
||||
sweepAmt := int64(totalSum - txFee)
|
||||
sweepAmt := totalSum - txFee
|
||||
|
||||
// The txn will sweep the amount after fees to the pkscript generated
|
||||
// above.
|
||||
sweepTx.AddTxOut(&wire.TxOut{
|
||||
PkScript: outputPkScript,
|
||||
Value: sweepAmt,
|
||||
})
|
||||
if sweepAmt >= dustLimit {
|
||||
sweepTx.AddTxOut(&wire.TxOut{
|
||||
PkScript: outputPkScript,
|
||||
Value: int64(sweepAmt),
|
||||
})
|
||||
}
|
||||
|
||||
// We'll default to using the current block height as locktime, if none
|
||||
// of the inputs commits to a different locktime.
|
||||
|
Reference in New Issue
Block a user