From 50a8f188a38f93698dc73110e796bc00944580c0 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Mon, 27 May 2019 16:14:50 -0700 Subject: [PATCH] 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. --- sweep/sweeper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sweep/sweeper.go b/sweep/sweeper.go index 9c8e59c7b..1785d70bc 100644 --- a/sweep/sweeper.go +++ b/sweep/sweeper.go @@ -80,6 +80,10 @@ type pendingInput struct { // map it into a fee rate whenever we attempt to cluster inputs for a // sweep. 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. @@ -580,6 +584,8 @@ func (s *UtxoSweeper) clusterBySweepFeeRate() []inputCluster { inputs = make(pendingInputs) bucketInputs[bucket] = inputs } + + input.lastFeeRate = feeRate inputs[op] = input inputFeeRates[op] = feeRate }