Skip to content

Commit d49a2ff

Browse files
committed
. review fixes
1 parent c551410 commit d49a2ff

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sweepbatcher/presigned.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,16 @@ func (b *batch) presign(ctx context.Context, newSweep *sweep) error {
8484
"non-empty batch")
8585
}
8686

87-
// Find the feerate needed to get into next block. Use conf_target=2,
88-
nextBlockFeeRate, err := b.wallet.EstimateFeeRate(ctx, 2)
87+
// priorityConfTarget defines the confirmation target for quick
88+
// inclusion in a block. A value of 2, rather than 1, is used to prevent
89+
// overestimation caused by temporary anomalies, such as periods without
90+
// blocks.
91+
const priorityConfTarget = 2
92+
93+
// Find the feerate needed to get into next block.
94+
nextBlockFeeRate, err := b.wallet.EstimateFeeRate(
95+
ctx, priorityConfTarget,
96+
)
8997
if err != nil {
9098
return fmt.Errorf("failed to get nextBlockFeeRate: %w", err)
9199
}
@@ -147,7 +155,7 @@ func presign(ctx context.Context, presigner presigner, destAddr btcutil.Address,
147155
batchAmt += sweep.value
148156
}
149157

150-
// Find when at least one sweep expires.
158+
// Find the sweep with the earliest expiry.
151159
timeout := sweeps[0].timeout
152160
for _, sweep := range sweeps[1:] {
153161
timeout = min(timeout, sweep.timeout)

0 commit comments

Comments
 (0)