mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-05 20:49:48 +02:00
sweep+contractcourt: replace ParamsUpdate
with Params
This commit is contained in:
parent
b6a2984167
commit
9be5b370a7
@ -167,7 +167,7 @@ func (s *mockSweeper) RelayFeePerKW() chainfee.SatPerKWeight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *mockSweeper) UpdateParams(input wire.OutPoint,
|
func (s *mockSweeper) UpdateParams(input wire.OutPoint,
|
||||||
params sweep.ParamsUpdate) (chan sweep.Result, error) {
|
params sweep.Params) (chan sweep.Result, error) {
|
||||||
|
|
||||||
s.updatedInputs <- input
|
s.updatedInputs <- input
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ type UtxoSweeper interface {
|
|||||||
// fee preference that will be used for a new sweep transaction of the
|
// fee preference that will be used for a new sweep transaction of the
|
||||||
// input that will act as a replacement transaction (RBF) of the
|
// input that will act as a replacement transaction (RBF) of the
|
||||||
// original sweeping transaction, if any.
|
// original sweeping transaction, if any.
|
||||||
UpdateParams(input wire.OutPoint, params sweep.ParamsUpdate) (
|
UpdateParams(input wire.OutPoint, params sweep.Params) (
|
||||||
chan sweep.Result, error)
|
chan sweep.Result, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,7 +988,7 @@ func (w *WalletKit) BumpFee(ctx context.Context,
|
|||||||
// bump its fee, which will result in a replacement transaction (RBF)
|
// bump its fee, which will result in a replacement transaction (RBF)
|
||||||
// being broadcast. If it is not aware of the input however,
|
// being broadcast. If it is not aware of the input however,
|
||||||
// lnwallet.ErrNotMine is returned.
|
// lnwallet.ErrNotMine is returned.
|
||||||
params := sweep.ParamsUpdate{
|
params := sweep.Params{
|
||||||
Fee: feePreference,
|
Fee: feePreference,
|
||||||
Immediate: in.Immediate,
|
Immediate: in.Immediate,
|
||||||
}
|
}
|
||||||
|
@ -71,22 +71,6 @@ type Params struct {
|
|||||||
StartingFeeRate fn.Option[chainfee.SatPerKWeight]
|
StartingFeeRate fn.Option[chainfee.SatPerKWeight]
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParamsUpdate contains a new set of parameters to update a pending sweep with.
|
|
||||||
type ParamsUpdate struct {
|
|
||||||
// Fee is the fee preference of the client who requested the input to be
|
|
||||||
// swept. If a confirmation target is specified, then we'll map it into
|
|
||||||
// a fee rate whenever we attempt to cluster inputs for a sweep.
|
|
||||||
Fee FeePreference
|
|
||||||
|
|
||||||
// Immediate indicates that the input should be swept immediately
|
|
||||||
// without waiting for blocks to come.
|
|
||||||
Immediate bool
|
|
||||||
|
|
||||||
// StartingFeeRate is an optional parameter that can be used to specify
|
|
||||||
// the initial fee rate to use for the fee function.
|
|
||||||
StartingFeeRate fn.Option[chainfee.SatPerKWeight]
|
|
||||||
}
|
|
||||||
|
|
||||||
// String returns a human readable interpretation of the sweep parameters.
|
// String returns a human readable interpretation of the sweep parameters.
|
||||||
func (p Params) String() string {
|
func (p Params) String() string {
|
||||||
deadline := "none"
|
deadline := "none"
|
||||||
@ -283,7 +267,7 @@ type PendingInputResponse struct {
|
|||||||
// intent to update the sweep parameters of a given input.
|
// intent to update the sweep parameters of a given input.
|
||||||
type updateReq struct {
|
type updateReq struct {
|
||||||
input wire.OutPoint
|
input wire.OutPoint
|
||||||
params ParamsUpdate
|
params Params
|
||||||
responseChan chan *updateResp
|
responseChan chan *updateResp
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,6 +684,12 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) {
|
|||||||
err: err,
|
err: err,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform an sweep immediately if asked.
|
||||||
|
if req.params.Immediate {
|
||||||
|
inputs := s.updateSweeperInputs()
|
||||||
|
s.sweepPendingInputs(inputs)
|
||||||
|
}
|
||||||
|
|
||||||
case result := <-s.bumpResultChan:
|
case result := <-s.bumpResultChan:
|
||||||
// Handle the bump event.
|
// Handle the bump event.
|
||||||
err := s.handleBumpEvent(result)
|
err := s.handleBumpEvent(result)
|
||||||
@ -1095,7 +1085,7 @@ func (s *UtxoSweeper) handlePendingSweepsReq(
|
|||||||
// is actually successful. The responsibility of doing so should be handled by
|
// is actually successful. The responsibility of doing so should be handled by
|
||||||
// the caller.
|
// the caller.
|
||||||
func (s *UtxoSweeper) UpdateParams(input wire.OutPoint,
|
func (s *UtxoSweeper) UpdateParams(input wire.OutPoint,
|
||||||
params ParamsUpdate) (chan Result, error) {
|
params Params) (chan Result, error) {
|
||||||
|
|
||||||
// Ensure the client provided a sane fee preference.
|
// Ensure the client provided a sane fee preference.
|
||||||
_, err := params.Fee.Estimate(
|
_, err := params.Fee.Estimate(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user