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:
5 files changed
+10
-7
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
+1
-1
@@ -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:
|
||||
|
||||
+2
-1
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user