sweep+lnrpc: add new interface FeePreference

This commit adds a new interface `FeePreference` which makes it easier
to write unit tests and allows more customized implementation in
following commits.
This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:21 +08:00
1 parent 530eed92a0
commit 3bcac318eb
6 files changed
+108 -21

No files matched your search

+7 -1
View File
@@ -884,7 +884,13 @@ func (w *WalletKit) PendingSweeps(ctx context.Context,
broadcastAttempts := uint32(pendingInput.BroadcastAttempts)
nextBroadcastHeight := uint32(pendingInput.NextBroadcastHeight)
requestedFee := pendingInput.Params.Fee
feePref := pendingInput.Params.Fee
requestedFee, ok := feePref.(sweep.FeeEstimateInfo)
if !ok {
return nil, fmt.Errorf("unknown fee preference type: "+
"%v", feePref)
}
requestedFeeRate := uint64(requestedFee.FeeRate.FeePerVByte())
rpcPendingSweeps = append(rpcPendingSweeps, &PendingSweep{