multi: rename FeePreference to FeeEstimateInfo

Results from running,
```
gofmt -d -w -r 'FeePreference -> FeeEstimateInfo' .
```
This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:21 +08:00
1 parent 6ff6c86155
commit 530eed92a0
15 files changed
+53 -49

No files matched your search

+14 -12
View File
@@ -18,8 +18,8 @@ import (
"github.com/stretchr/testify/require"
)
// TestFeePreferenceEstimate checks `Estimate` method works as expected.
func TestFeePreferenceEstimate(t *testing.T) {
// TestFeeEstimateInfo checks `Estimate` method works as expected.
func TestFeeEstimateInfo(t *testing.T) {
t.Parallel()
dummyErr := errors.New("dummy")
@@ -44,7 +44,7 @@ func TestFeePreferenceEstimate(t *testing.T) {
testCases := []struct {
name string
setupMocker func()
feePref FeePreference
feePref FeeEstimateInfo
expectedFeeRate chainfee.SatPerKWeight
expectedErr error
}{
@@ -52,14 +52,14 @@ func TestFeePreferenceEstimate(t *testing.T) {
// When the fee preference is empty, we should see an
// error.
name: "empty fee preference",
feePref: FeePreference{},
feePref: FeeEstimateInfo{},
expectedErr: ErrNoFeePreference,
},
{
// When the fee preference has conflicts, we should see
// an error.
name: "conflict fee preference",
feePref: FeePreference{
feePref: FeeEstimateInfo{
FeeRate: validFeeRate,
ConfTarget: conf,
},
@@ -74,12 +74,12 @@ func TestFeePreferenceEstimate(t *testing.T) {
chainfee.SatPerKWeight(0), dummyErr,
).Once()
},
feePref: FeePreference{ConfTarget: conf},
feePref: FeeEstimateInfo{ConfTarget: conf},
expectedErr: dummyErr,
},
{
// When FeePreference uses a too small value, we should
// return an error.
// When FeeEstimateInfo uses a too small value, we
// should return an error.
name: "fee rate below relay fee rate",
setupMocker: func() {
// Mock the relay fee rate.
@@ -87,11 +87,11 @@ func TestFeePreferenceEstimate(t *testing.T) {
chainfee.SatPerKWeight(relayFeeRate),
).Once()
},
feePref: FeePreference{FeeRate: relayFeeRate - 1},
feePref: FeeEstimateInfo{FeeRate: relayFeeRate - 1},
expectedErr: ErrFeePreferenceTooLow,
},
{
// When FeePreference gives a too large value, we
// When FeeEstimateInfo gives a too large value, we
// should cap it at the max fee rate.
name: "fee rate above max fee rate",
setupMocker: func() {
@@ -100,7 +100,9 @@ func TestFeePreferenceEstimate(t *testing.T) {
chainfee.SatPerKWeight(relayFeeRate),
).Once()
},
feePref: FeePreference{FeeRate: maxFeeRate + 1},
feePref: FeeEstimateInfo{
FeeRate: maxFeeRate + 1,
},
expectedFeeRate: maxFeeRate,
},
{
@@ -117,7 +119,7 @@ func TestFeePreferenceEstimate(t *testing.T) {
chainfee.SatPerKWeight(relayFeeRate),
).Once()
},
feePref: FeePreference{ConfTarget: conf},
feePref: FeeEstimateInfo{ConfTarget: conf},
expectedFeeRate: validFeeRate,
},
}