sweep: embed input.Input interface

Get rid of needless referencing of the embedded object.
This commit is contained in:
Joost Jager 2019-12-09 15:26:05 +01:00
parent 38adfd7ecc
commit 071c57d4a4
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -70,16 +70,15 @@ type Params struct {
}
// pendingInput is created when an input reaches the main loop for the first
// time. It tracks all relevant state that is needed for sweeping.
// time. It wraps the input and tracks all relevant state that is needed for
// sweeping.
type pendingInput struct {
input.Input
// listeners is a list of channels over which the final outcome of the
// sweep needs to be broadcasted.
listeners []chan Result
// input is the original struct that contains the input and sign
// descriptor.
input input.Input
// ntfnRegCancel is populated with a function that cancels the chain
// notifier spend registration.
ntfnRegCancel func()
@ -474,7 +473,7 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) {
// channel will be appended to this slice.
pendInput = &pendingInput{
listeners: []chan Result{input.resultChan},
input: input.input,
Input: input.input,
minPublishHeight: bestHeight,
params: input.params,
}
@ -800,9 +799,9 @@ func (s *UtxoSweeper) getInputLists(cluster inputCluster,
// Add input to the either one of the lists.
if input.publishAttempts == 0 {
newInputs = append(newInputs, input.input)
newInputs = append(newInputs, input)
} else {
retryInputs = append(retryInputs, input.input)
retryInputs = append(retryInputs, input)
}
}
@ -1002,12 +1001,12 @@ func (s *UtxoSweeper) handlePendingSweepsReq(
for _, pendingInput := range s.pendingInputs {
// Only the exported fields are set, as we expect the response
// to only be consumed externally.
op := *pendingInput.input.OutPoint()
op := *pendingInput.OutPoint()
pendingInputs[op] = &PendingInput{
OutPoint: op,
WitnessType: pendingInput.input.WitnessType(),
WitnessType: pendingInput.WitnessType(),
Amount: btcutil.Amount(
pendingInput.input.SignDesc().Output.Value,
pendingInput.SignDesc().Output.Value,
),
LastFeeRate: pendingInput.lastFeeRate,
BroadcastAttempts: pendingInput.publishAttempts,