refactor: replace math.Min and math.Max with built-in min/max
Reference: https://github.com/lightningnetwork/lnd/pull/9451#pullrequestreview-2580942691 Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
4 files changed
+6
-21
No files matched your search
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
@@ -391,9 +390,7 @@ func (c *commitSweepResolver) Launch() error {
|
||||
// expires after.
|
||||
unlockHeight := confHeight + c.commitResolution.MaturityDelay
|
||||
if c.hasCLTV() {
|
||||
unlockHeight = uint32(math.Max(
|
||||
float64(unlockHeight), float64(c.leaseExpiry),
|
||||
))
|
||||
unlockHeight = max(unlockHeight, c.leaseExpiry)
|
||||
}
|
||||
|
||||
// Update report now that we learned the confirmation height.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package contractcourt
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
@@ -42,9 +40,7 @@ func (h *htlcLeaseResolver) deriveWaitHeight(csvDelay uint32,
|
||||
|
||||
waitHeight := uint32(commitSpend.SpendingHeight) + csvDelay - 1
|
||||
if h.hasCLTV() {
|
||||
waitHeight = uint32(math.Max(
|
||||
float64(waitHeight), float64(h.leaseExpiry),
|
||||
))
|
||||
waitHeight = max(waitHeight, h.leaseExpiry)
|
||||
}
|
||||
|
||||
return waitHeight
|
||||
|
||||
Reference in new issue
Block a user