sweep: add lastFeeRate field to PendingInput

This will serve useful when exposing the pending inputs over RPC, since
we currently don't keep track of the last fee rate used for an input.
This commit is contained in:
Wilmer Paulino 2019-05-27 16:14:50 -07:00
parent 880279b266
commit 50a8f188a3
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -80,6 +80,10 @@ type pendingInput struct {
// map it into a fee rate whenever we attempt to cluster inputs for a // map it into a fee rate whenever we attempt to cluster inputs for a
// sweep. // sweep.
feePreference FeePreference feePreference FeePreference
// lastFeeRate is the most recent fee rate used for this input within a
// transaction broadcast to the network.
lastFeeRate lnwallet.SatPerKWeight
} }
// pendingInputs is a type alias for a set of pending inputs. // pendingInputs is a type alias for a set of pending inputs.
@ -580,6 +584,8 @@ func (s *UtxoSweeper) clusterBySweepFeeRate() []inputCluster {
inputs = make(pendingInputs) inputs = make(pendingInputs)
bucketInputs[bucket] = inputs bucketInputs[bucket] = inputs
} }
input.lastFeeRate = feeRate
inputs[op] = input inputs[op] = input
inputFeeRates[op] = feeRate inputFeeRates[op] = feeRate
} }