sweep: patch unit test for feeRateForPreference

This commit is contained in:
yyforyongyu committed 2023-10-13 17:00:53 +08:00
1 parent 82053970ef
commit 497f421009
2 files changed
+125 -2

No files matched your search

+7 -2
View File
@@ -47,6 +47,10 @@ var (
// request from a client whom did not specify a fee preference.
ErrNoFeePreference = errors.New("no fee preference specified")
// ErrFeePreferenceTooLow is returned when the fee preference gives a
// fee rate that's below the relay fee rate.
ErrFeePreferenceTooLow = errors.New("fee preference too low")
// ErrExclusiveGroupSpend is returned in case a different input of the
// same exclusive group was spent.
ErrExclusiveGroupSpend = errors.New("other member of exclusive group " +
@@ -485,9 +489,10 @@ func (s *UtxoSweeper) feeRateForPreference(
if err != nil {
return 0, err
}
if feeRate < s.relayFeeRate {
return 0, fmt.Errorf("fee preference resulted in invalid fee "+
"rate %v, minimum is %v", feeRate, s.relayFeeRate)
return 0, fmt.Errorf("%w: got %v, minimum is %v",
ErrFeePreferenceTooLow, feeRate, s.relayFeeRate)
}
// If the estimated fee rate is above the maximum allowed fee rate,