mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-13 12:32:48 +02:00
multi: fix non-constant input of fmt.Errorf
Fixed multiple cases in which a non-constact string variable was used as a format string for fmt.Errorf.
This commit is contained in:
parent
f3d52ba7a8
commit
612ad7da27
5 changed files with 10 additions and 7 deletions
|
|
@ -548,7 +548,7 @@ func (r *RPCAcceptor) validateAcceptorResponse(dustLimit btcutil.Amount,
|
|||
|
||||
// If we reject the channel, and have a custom error, then we use it.
|
||||
case haveCustomError:
|
||||
return false, fmt.Errorf(req.Error), nil, nil
|
||||
return false, fmt.Errorf("%s", req.Error), nil, nil
|
||||
|
||||
// Otherwise, we have rejected the channel with no custom error, so we
|
||||
// just use a generic error to fail the channel.
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ func decodeBech32(bech string) (string, []byte, error) {
|
|||
moreInfo = fmt.Sprintf("Expected %v, got %v.",
|
||||
expected, checksum)
|
||||
}
|
||||
return "", nil, fmt.Errorf("checksum failed. " + moreInfo)
|
||||
|
||||
return "", nil, fmt.Errorf("checksum failed. %s", moreInfo)
|
||||
}
|
||||
|
||||
// We exclude the last 6 bytes, which is the checksum.
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ func IPLockChecker() (string, checkers.Func) {
|
|||
// check.
|
||||
pr, ok := peer.FromContext(ctx)
|
||||
if !ok {
|
||||
return fmt.Errorf("unable to get peer info from context")
|
||||
return fmt.Errorf("unable to get peer info from " +
|
||||
"context")
|
||||
}
|
||||
peerAddr, _, err := net.SplitHostPort(pr.Addr.String())
|
||||
if err != nil {
|
||||
|
|
@ -144,8 +145,8 @@ func IPLockChecker() (string, checkers.Func) {
|
|||
}
|
||||
|
||||
if !net.ParseIP(arg).Equal(net.ParseIP(peerAddr)) {
|
||||
msg := "macaroon locked to different IP address"
|
||||
return fmt.Errorf(msg)
|
||||
return fmt.Errorf("macaroon locked to different IP " +
|
||||
"address")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7986,7 +7986,7 @@ func (r *rpcServer) UpdateChannelPolicy(ctx context.Context,
|
|||
errMsg := "cannot set both FeeRate and FeeRatePpm at the " +
|
||||
"same time"
|
||||
|
||||
return nil, status.Errorf(codes.InvalidArgument, errMsg)
|
||||
return nil, status.Errorf(codes.InvalidArgument, "%v", errMsg)
|
||||
|
||||
// If the request is using fee_rate.
|
||||
case req.FeeRate != 0:
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ func decodeBech32(bech string) (string, []byte, error) {
|
|||
moreInfo = fmt.Sprintf("Expected %v, got %v.",
|
||||
expected, checksum)
|
||||
}
|
||||
return "", nil, fmt.Errorf("checksum failed. " + moreInfo)
|
||||
|
||||
return "", nil, fmt.Errorf("checksum failed. %s", moreInfo)
|
||||
}
|
||||
|
||||
// We exclude the last 6 bytes, which is the checksum.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue