sweep: make sure max fee rate can be reached

Previously we don't allow confTarget to be 0, which ended up the final
position being never reached. We fix it here by allowing confTarget to
be 0 in case the deadline has already been passed for a given input.
This commit is contained in:
yyforyongyu
2024-04-03 16:13:49 +08:00
parent dc7d90c16f
commit 4134b1c00a
4 changed files with 35 additions and 22 deletions

View File

@@ -951,11 +951,11 @@ func calcCurrentConfTarget(currentHeight, deadline int32) uint32 {
// If we are already past the deadline, we will set the conf target to
// be 1.
if deadlineDelta <= 0 {
if deadlineDelta < 0 {
log.Warnf("Deadline is %d blocks behind current height %v",
-deadlineDelta, currentHeight)
confTarget = 1
confTarget = 0
} else {
confTarget = uint32(deadlineDelta)
}