mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 06:01:48 +02:00
multi: use the "errors" package everywhere
Replace all usages of the "github.com/go-errors/errors" and "github.com/pkg/errors" packages with the standard lib's "errors" package. This ensures that error wrapping and `errors.Is` checks will work as expected.
This commit is contained in:
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/tlv"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -279,13 +278,13 @@ func validateChannelUpdate1Fields(capacity btcutil.Amount,
|
||||
|
||||
// The maxHTLC flag is mandatory.
|
||||
if !msg.MessageFlags.HasMaxHtlc() {
|
||||
return errors.Errorf("max htlc flag not set for channel "+
|
||||
return fmt.Errorf("max htlc flag not set for channel "+
|
||||
"update %v", spew.Sdump(msg))
|
||||
}
|
||||
|
||||
maxHtlc := msg.HtlcMaximumMsat
|
||||
if maxHtlc == 0 || maxHtlc < msg.HtlcMinimumMsat {
|
||||
return errors.Errorf("invalid max htlc for channel "+
|
||||
return fmt.Errorf("invalid max htlc for channel "+
|
||||
"update %v", spew.Sdump(msg))
|
||||
}
|
||||
|
||||
@@ -294,7 +293,7 @@ func validateChannelUpdate1Fields(capacity btcutil.Amount,
|
||||
// capacity.
|
||||
capacityMsat := lnwire.NewMSatFromSatoshis(capacity)
|
||||
if capacityMsat != 0 && maxHtlc > capacityMsat {
|
||||
return errors.Errorf("max_htlc (%v) for channel update "+
|
||||
return fmt.Errorf("max_htlc (%v) for channel update "+
|
||||
"greater than capacity (%v)", maxHtlc, capacityMsat)
|
||||
}
|
||||
|
||||
|
@@ -2,13 +2,13 @@ package netann
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"image/color"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -110,7 +110,7 @@ func ValidateNodeAnn(a *lnwire.NodeAnnouncement) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return errors.Errorf("signature on NodeAnnouncement(%x) is "+
|
||||
return fmt.Errorf("signature on NodeAnnouncement(%x) is "+
|
||||
"invalid: %x", nodeKey.SerializeCompressed(),
|
||||
msgBuf.Bytes())
|
||||
}
|
||||
|
Reference in New Issue
Block a user