Skip to content

Commit 334b5f9

Browse files
committed
s/nextBlockFeerate/nextBlockFeeRate/
1 parent 1d4fd56 commit 334b5f9

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

sweepbatcher/presigned.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ func (b *batch) presign(ctx context.Context, newSweep *sweep) error {
8484
}
8585

8686
// Find the feerate needed to get into next block. Use conf_target=2,
87-
nextBlockFeerate, err := b.wallet.EstimateFeeRate(ctx, 2)
87+
nextBlockFeeRate, err := b.wallet.EstimateFeeRate(ctx, 2)
8888
if err != nil {
89-
return fmt.Errorf("failed to get nextBlockFeerate: %w", err)
89+
return fmt.Errorf("failed to get nextBlockFeeRate: %w", err)
9090
}
9191

92-
b.Infof("nextBlockFeerate is %v", nextBlockFeerate)
92+
b.Infof("nextBlockFeeRate is %v", nextBlockFeeRate)
9393

9494
// Create the list of sweeps of the future batch.
9595
sweeps := make([]sweep, 0, len(b.sweeps)+1)
@@ -106,7 +106,7 @@ func (b *batch) presign(ctx context.Context, newSweep *sweep) error {
106106
}
107107

108108
return presign(
109-
ctx, b.cfg.presignedHelper, destAddr, sweeps, nextBlockFeerate,
109+
ctx, b.cfg.presignedHelper, destAddr, sweeps, nextBlockFeeRate,
110110
)
111111
}
112112

@@ -126,7 +126,7 @@ type presigner interface {
126126
// A feerate is considered high if it is at least 100 sat/vbyte AND is at least
127127
// 10x of the current next block feerate.
128128
func presign(ctx context.Context, presigner presigner, destAddr btcutil.Address,
129-
sweeps []sweep, nextBlockFeerate chainfee.SatPerKWeight) error {
129+
sweeps []sweep, nextBlockFeeRate chainfee.SatPerKWeight) error {
130130

131131
if presigner == nil {
132132
return fmt.Errorf("presigner is not installed")
@@ -136,8 +136,8 @@ func presign(ctx context.Context, presigner presigner, destAddr btcutil.Address,
136136
return fmt.Errorf("there are no sweeps")
137137
}
138138

139-
if nextBlockFeerate == 0 {
140-
return fmt.Errorf("nextBlockFeerate is not set")
139+
if nextBlockFeeRate == 0 {
140+
return fmt.Errorf("nextBlockFeeRate is not set")
141141
}
142142

143143
// Keep track of the total amount this batch is sweeping back.
@@ -167,8 +167,8 @@ func presign(ctx context.Context, presigner presigner, destAddr btcutil.Address,
167167
highFeeRateLockTime := uint32(timeout - timeoutThreshold)
168168

169169
// Calculate which feerate to consider high. At least 100 sat/vbyte and
170-
// at least 10x of current nextBlockFeerate.
171-
highFeeRate := max(100*chainfee.FeePerKwFloor, 10*nextBlockFeerate)
170+
// at least 10x of current nextBlockFeeRate.
171+
highFeeRate := max(100*chainfee.FeePerKwFloor, 10*nextBlockFeeRate)
172172

173173
// Set LockTime to 0. It is not critical.
174174
const currentHeight = 0

sweepbatcher/presigned_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestPresign(t *testing.T) {
6060
presigner presigner
6161
sweeps []sweep
6262
destAddr btcutil.Address
63-
nextBlockFeerate chainfee.SatPerKWeight
63+
nextBlockFeeRate chainfee.SatPerKWeight
6464
wantErr string
6565
wantOutputs []btcutil.Amount
6666
wantLockTimes []uint32
@@ -75,15 +75,15 @@ func TestPresign(t *testing.T) {
7575
},
7676
},
7777
destAddr: destAddr,
78-
nextBlockFeerate: chainfee.FeePerKwFloor,
78+
nextBlockFeeRate: chainfee.FeePerKwFloor,
7979
wantErr: "presigner is not installed",
8080
},
8181

8282
{
8383
name: "error: no sweeps",
8484
presigner: &mockPresigner{},
8585
destAddr: destAddr,
86-
nextBlockFeerate: chainfee.FeePerKwFloor,
86+
nextBlockFeeRate: chainfee.FeePerKwFloor,
8787
wantErr: "there are no sweeps",
8888
},
8989

@@ -97,12 +97,12 @@ func TestPresign(t *testing.T) {
9797
timeout: 1000,
9898
},
9999
},
100-
nextBlockFeerate: chainfee.FeePerKwFloor,
100+
nextBlockFeeRate: chainfee.FeePerKwFloor,
101101
wantErr: "unsupported address type <nil>",
102102
},
103103

104104
{
105-
name: "error: zero nextBlockFeerate",
105+
name: "error: zero nextBlockFeeRate",
106106
presigner: &mockPresigner{},
107107
sweeps: []sweep{
108108
{
@@ -117,7 +117,7 @@ func TestPresign(t *testing.T) {
117117
},
118118
},
119119
destAddr: destAddr,
120-
wantErr: "nextBlockFeerate is not set",
120+
wantErr: "nextBlockFeeRate is not set",
121121
},
122122

123123
{
@@ -134,7 +134,7 @@ func TestPresign(t *testing.T) {
134134
},
135135
},
136136
destAddr: destAddr,
137-
nextBlockFeerate: chainfee.FeePerKwFloor,
137+
nextBlockFeeRate: chainfee.FeePerKwFloor,
138138
wantErr: "timeout is invalid: 0",
139139
},
140140

@@ -154,7 +154,7 @@ func TestPresign(t *testing.T) {
154154
},
155155
},
156156
destAddr: destAddr,
157-
nextBlockFeerate: chainfee.FeePerKwFloor,
157+
nextBlockFeeRate: chainfee.FeePerKwFloor,
158158
wantOutputs: []btcutil.Amount{
159159
2999842, 2999811, 2999773, 2999728, 2999674,
160160
2999609, 2999530, 2999436, 2999324, 2999189,
@@ -190,7 +190,7 @@ func TestPresign(t *testing.T) {
190190
},
191191
},
192192
destAddr: destAddr,
193-
nextBlockFeerate: 50 * chainfee.FeePerKwFloor,
193+
nextBlockFeeRate: 50 * chainfee.FeePerKwFloor,
194194
wantOutputs: []btcutil.Amount{
195195
2999842, 2999811, 2999773, 2999728, 2999674,
196196
2999609, 2999530, 2999436, 2999324, 2999189,
@@ -225,7 +225,7 @@ func TestPresign(t *testing.T) {
225225
},
226226
},
227227
destAddr: destAddr,
228-
nextBlockFeerate: chainfee.FeePerKwFloor,
228+
nextBlockFeeRate: chainfee.FeePerKwFloor,
229229
wantOutputs: []btcutil.Amount{
230230
2842, 2811, 2773, 2728, 2674, 2609, 2530, 2436,
231231
2400,
@@ -253,7 +253,7 @@ func TestPresign(t *testing.T) {
253253
},
254254
},
255255
destAddr: destAddr,
256-
nextBlockFeerate: chainfee.FeePerKwFloor,
256+
nextBlockFeeRate: chainfee.FeePerKwFloor,
257257
wantErr: "for feeRate 363 sat/kw",
258258
},
259259
}
@@ -263,7 +263,7 @@ func TestPresign(t *testing.T) {
263263
t.Run(tc.name, func(t *testing.T) {
264264
err := presign(
265265
ctx, tc.presigner, tc.destAddr, tc.sweeps,
266-
tc.nextBlockFeerate,
266+
tc.nextBlockFeeRate,
267267
)
268268
if tc.wantErr != "" {
269269
require.Error(t, err)

sweepbatcher/sweep_batcher.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,11 @@ func (b *Batcher) PresignSweep(ctx context.Context, sweepOutpoint wire.OutPoint,
639639
}
640640

641641
// Find the feerate needed to get into next block. Use conf_target=2,
642-
nextBlockFeerate, err := b.wallet.EstimateFeeRate(ctx, 2)
642+
nextBlockFeeRate, err := b.wallet.EstimateFeeRate(ctx, 2)
643643
if err != nil {
644-
return fmt.Errorf("failed to get nextBlockFeerate: %w", err)
644+
return fmt.Errorf("failed to get nextBlockFeeRate: %w", err)
645645
}
646-
infof("nextBlockFeerate is %v", nextBlockFeerate)
646+
infof("nextBlockFeeRate is %v", nextBlockFeeRate)
647647

648648
sweeps := []sweep{
649649
{
@@ -654,7 +654,7 @@ func (b *Batcher) PresignSweep(ctx context.Context, sweepOutpoint wire.OutPoint,
654654
}
655655

656656
return presign(
657-
ctx, b.presignedHelper, destAddress, sweeps, nextBlockFeerate,
657+
ctx, b.presignedHelper, destAddress, sweeps, nextBlockFeeRate,
658658
)
659659
}
660660

0 commit comments

Comments
 (0)