multi: fix fmt.Errorf error wrapping

Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
This commit is contained in:
ffranr committed 2024-02-27 11:13:40 +00:00
1 parent 581c16d72f
commit cd566eb097
103 files changed
+426 -390

No files matched your search

+3 -3
View File
@@ -43,12 +43,12 @@ func importMissionControl(ctx *cli.Context) error {
sourceNode, err := route.NewVertexFromStr(args[0])
if err != nil {
return fmt.Errorf("please provide valid source node: %v", err)
return fmt.Errorf("please provide valid source node: %w", err)
}
destNode, err := route.NewVertexFromStr(args[1])
if err != nil {
return fmt.Errorf("please provide valid dest node: %v", err)
return fmt.Errorf("please provide valid dest node: %w", err)
}
ts, err := strconv.ParseInt(args[2], 10, 64)
@@ -63,7 +63,7 @@ func importMissionControl(ctx *cli.Context) error {
amt, err := strconv.ParseInt(args[3], 10, 64)
if err != nil {
return fmt.Errorf("please provide amount in msat: %v", err)
return fmt.Errorf("please provide amount in msat: %w", err)
}
if amt <= 0 {
+5 -4
View File
@@ -98,7 +98,8 @@ func addInvoice(ctx *cli.Context) error {
amt, err = strconv.ParseInt(args.First(), 10, 64)
args = args.Tail()
if err != nil {
return fmt.Errorf("unable to decode amt argument: %v", err)
return fmt.Errorf("unable to decode amt argument: %w",
err)
}
}
@@ -110,12 +111,12 @@ func addInvoice(ctx *cli.Context) error {
}
if err != nil {
return fmt.Errorf("unable to parse preimage: %v", err)
return fmt.Errorf("unable to parse preimage: %w", err)
}
descHash, err = hex.DecodeString(ctx.String("description_hash"))
if err != nil {
return fmt.Errorf("unable to parse description_hash: %v", err)
return fmt.Errorf("unable to parse description_hash: %w", err)
}
invoice := &lnrpc.Invoice{
@@ -175,7 +176,7 @@ func lookupInvoice(ctx *cli.Context) error {
}
if err != nil {
return fmt.Errorf("unable to decode rhash argument: %v", err)
return fmt.Errorf("unable to decode rhash argument: %w", err)
}
req := &lnrpc.PaymentHash{
+3 -3
View File
@@ -372,7 +372,7 @@ func printMacaroon(ctx *cli.Context) error {
// Decode the macaroon and its protobuf encoded internal identifier.
mac := &macaroon.Macaroon{}
if err = mac.UnmarshalBinary(macBytes); err != nil {
return fmt.Errorf("unable to decode macaroon: %v", err)
return fmt.Errorf("unable to decode macaroon: %w", err)
}
rawID := mac.Id()
if rawID[0] != byte(bakery.LatestVersion) {
@@ -382,7 +382,7 @@ func printMacaroon(ctx *cli.Context) error {
idProto := rawID[1:]
err = proto.Unmarshal(idProto, decodedID)
if err != nil {
return fmt.Errorf("unable to decode macaroon version: %v", err)
return fmt.Errorf("unable to decode macaroon version: %w", err)
}
// Prepare everything to be printed in a more human-readable format.
@@ -550,7 +550,7 @@ func applyMacaroonConstraints(ctx *cli.Context,
constrainedMac, err := macaroons.AddConstraints(mac, macConstraints...)
if err != nil {
return nil, fmt.Errorf("error adding constraints: %v", err)
return nil, fmt.Errorf("error adding constraints: %w", err)
}
return constrainedMac, nil
+3 -3
View File
@@ -312,17 +312,17 @@ func queryProb(ctx *cli.Context) error {
fromNode, err := route.NewVertexFromStr(args.Get(0))
if err != nil {
return fmt.Errorf("invalid from node key: %v", err)
return fmt.Errorf("invalid from node key: %w", err)
}
toNode, err := route.NewVertexFromStr(args.Get(1))
if err != nil {
return fmt.Errorf("invalid to node key: %v", err)
return fmt.Errorf("invalid to node key: %w", err)
}
amtSat, err := strconv.ParseUint(args.Get(2), 10, 64)
if err != nil {
return fmt.Errorf("invalid amt: %v", err)
return fmt.Errorf("invalid amt: %w", err)
}
amtMsat := lnwire.NewMSatFromSatoshis(
+6 -6
View File
@@ -382,7 +382,7 @@ func openChannel(ctx *cli.Context) error {
args.First(), 10, 64,
)
if err != nil {
return fmt.Errorf("unable to decode local amt: %v", err)
return fmt.Errorf("unable to decode local amt: %w", err)
}
args = args.Tail()
case !ctx.Bool("fundmax"):
@@ -420,7 +420,7 @@ func openChannel(ctx *cli.Context) error {
} else if args.Present() {
req.PushSat, err = strconv.ParseInt(args.First(), 10, 64)
if err != nil {
return fmt.Errorf("unable to decode push amt: %v", err)
return fmt.Errorf("unable to decode push amt: %w", err)
}
}
@@ -534,14 +534,14 @@ func openChannelPsbt(rpcCtx context.Context, ctx *cli.Context,
if basePsbt != "" {
basePsbtBytes, err = base64.StdEncoding.DecodeString(basePsbt)
if err != nil {
return fmt.Errorf("error parsing base PSBT: %v", err)
return fmt.Errorf("error parsing base PSBT: %w", err)
}
}
// Generate a new, random pending channel ID that we'll use as the main
// identifier when sending update messages to the RPC server.
if _, err := rand.Read(pendingChanID[:]); err != nil {
return fmt.Errorf("unable to generate random chan ID: %v", err)
return fmt.Errorf("unable to generate random chan ID: %w", err)
}
fmt.Printf("Starting PSBT funding flow with pending channel ID %x.\n",
pendingChanID)
@@ -591,7 +591,7 @@ func openChannelPsbt(rpcCtx context.Context, ctx *cli.Context,
// explicitly capture the signal.
stream, err := client.OpenChannel(ctxc, req)
if err != nil {
return fmt.Errorf("opening stream to server failed: %v", err)
return fmt.Errorf("opening stream to server failed: %w", err)
}
// We also need to spawn a goroutine that reads from the server. This
@@ -859,7 +859,7 @@ func batchOpenChannel(ctx *cli.Context) error {
// marshaler that keeps the original snake case.
var jsonChannels []*batchChannelJSON
if err := json.Unmarshal([]byte(args.First()), &jsonChannels); err != nil {
return fmt.Errorf("error parsing channels JSON: %v", err)
return fmt.Errorf("error parsing channels JSON: %w", err)
}
req.Channels = make([]*lnrpc.BatchOpenChannel, len(jsonChannels))
+7 -5
View File
@@ -376,7 +376,8 @@ func sendPayment(ctx *cli.Context) error {
amount, err = strconv.ParseInt(args.First(), 10, 64)
args = args.Tail()
if err != nil {
return fmt.Errorf("unable to decode payment amount: %v", err)
return fmt.Errorf("unable to decode payment amount: %w",
err)
}
}
@@ -1147,7 +1148,8 @@ func queryRoutes(ctx *cli.Context) error {
case args.Present():
amt, err = strconv.ParseInt(args.First(), 10, 64)
if err != nil {
return fmt.Errorf("unable to decode amt argument: %v", err)
return fmt.Errorf("unable to decode amt argument: %w",
err)
}
default:
return fmt.Errorf("amt argument missing")
@@ -1490,7 +1492,7 @@ func forwardingHistory(ctx *cli.Context) error {
startTime = uint64(now.Add(-time.Hour * 24).Unix())
}
if err != nil {
return fmt.Errorf("unable to decode start_time: %v", err)
return fmt.Errorf("unable to decode start_time: %w", err)
}
switch {
@@ -1503,7 +1505,7 @@ func forwardingHistory(ctx *cli.Context) error {
endTime = uint64(now.Unix())
}
if err != nil {
return fmt.Errorf("unable to decode end_time: %v", err)
return fmt.Errorf("unable to decode end_time: %w", err)
}
switch {
@@ -1786,7 +1788,7 @@ func deletePayments(ctx *cli.Context) error {
},
)
if err != nil {
return fmt.Errorf("error deleting payments: %v", err)
return fmt.Errorf("error deleting payments: %w", err)
}
}
+8 -8
View File
@@ -119,7 +119,7 @@ func profileAdd(ctx *cli.Context) error {
// Create a profile struct from all the global options.
profile, err := profileFromContext(ctx, true, false)
if err != nil {
return fmt.Errorf("could not load global options: %v", err)
return fmt.Errorf("could not load global options: %w", err)
}
// Finally, all that's left is to get the profile name from either
@@ -181,7 +181,7 @@ func profileRemove(ctx *cli.Context) error {
// Load the default profile file.
f, err := loadProfileFile(defaultProfileFile)
if err != nil {
return fmt.Errorf("could not load profile file: %v", err)
return fmt.Errorf("could not load profile file: %w", err)
}
// Get the profile name from either positional argument or flag.
@@ -260,7 +260,7 @@ func profileSetDefault(ctx *cli.Context) error {
// Load the default profile file.
f, err := loadProfileFile(defaultProfileFile)
if err != nil {
return fmt.Errorf("could not load profile file: %v", err)
return fmt.Errorf("could not load profile file: %w", err)
}
// Get the profile name from either positional argument or flag.
@@ -313,7 +313,7 @@ func profileUnsetDefault(_ *cli.Context) error {
// Load the default profile file.
f, err := loadProfileFile(defaultProfileFile)
if err != nil {
return fmt.Errorf("could not load profile file: %v", err)
return fmt.Errorf("could not load profile file: %w", err)
}
// Save the file with the flag disabled.
@@ -359,7 +359,7 @@ func profileAddMacaroon(ctx *cli.Context) error {
// yet.
f, err := loadProfileFile(defaultProfileFile)
if err != nil {
return fmt.Errorf("could not load profile file: %v", err)
return fmt.Errorf("could not load profile file: %w", err)
}
// Finally, all that's left is to get the profile name from either
@@ -425,17 +425,17 @@ func profileAddMacaroon(ctx *cli.Context) error {
macPath := lncfg.CleanAndExpandPath(ctx.GlobalString("macaroonpath"))
macBytes, err := ioutil.ReadFile(macPath)
if err != nil {
return fmt.Errorf("unable to read macaroon path: %v", err)
return fmt.Errorf("unable to read macaroon path: %w", err)
}
mac := &macaroon.Macaroon{}
if err = mac.UnmarshalBinary(macBytes); err != nil {
return fmt.Errorf("unable to decode macaroon: %v", err)
return fmt.Errorf("unable to decode macaroon: %w", err)
}
macEntry := &macaroonEntry{
Name: macName,
}
if err = macEntry.storeMacaroon(mac, nil); err != nil {
return fmt.Errorf("unable to store macaroon: %v", err)
return fmt.Errorf("unable to store macaroon: %w", err)
}
// All done, store the updated profile file.
+1 -1
View File
@@ -43,7 +43,7 @@ func version(ctx *cli.Context) error {
lndVersion, err := client.GetVersion(ctxc, &verrpc.VersionRequest{})
if err != nil {
printRespJSON(versions)
return fmt.Errorf("unable fetch version from lnd: %v", err)
return fmt.Errorf("unable fetch version from lnd: %w", err)
}
versions.Lnd = lndVersion
+3 -3
View File
@@ -141,7 +141,7 @@ func create(ctx *cli.Context) error {
// Passed an invalid channel backup file.
case err != nil:
return fmt.Errorf("unable to parse chan backups: %v", err)
return fmt.Errorf("unable to parse chan backups: %w", err)
// We have an SCB recovery option with a valid backup file.
default:
@@ -356,7 +356,7 @@ mnemonicCheck:
}
seedResp, err := client.GenSeed(ctxc, genSeedReq)
if err != nil {
return fmt.Errorf("unable to generate seed: %v", err)
return fmt.Errorf("unable to generate seed: %w", err)
}
cipherSeedMnemonic = seedResp.CipherSeedMnemonic
@@ -721,7 +721,7 @@ func createWatchOnly(ctx *cli.Context) error {
jsonAccts := &walletrpc.ListAccountsResponse{}
err = lnrpc.ProtoJSONUnmarshalOpts.Unmarshal(jsonBytes, jsonAccts)
if err != nil {
return fmt.Errorf("error parsing JSON: %v", err)
return fmt.Errorf("error parsing JSON: %w", err)
}
if len(jsonAccts.Accounts) == 0 {
return fmt.Errorf("cannot import empty account list")
+13 -11
View File
@@ -365,7 +365,7 @@ func sendCoins(ctx *cli.Context) error {
return fmt.Errorf("Amount argument missing")
}
if err != nil {
return fmt.Errorf("unable to decode amount: %v", err)
return fmt.Errorf("unable to decode amount: %w", err)
}
if amt != 0 && ctx.Bool("sweepall") {
@@ -1015,7 +1015,7 @@ func closeAllChannels(ctx *cli.Context) error {
listReq := &lnrpc.ListChannelsRequest{}
openChannels, err := client.ListChannels(ctxc, listReq)
if err != nil {
return fmt.Errorf("unable to fetch open channels: %v", err)
return fmt.Errorf("unable to fetch open channels: %w", err)
}
if len(openChannels.Channels) == 0 {
@@ -1302,7 +1302,8 @@ func parseChannelPoint(ctx *cli.Context) (*lnrpc.ChannelPoint, error) {
case args.Present():
index, err := strconv.ParseUint(args.First(), 10, 32)
if err != nil {
return nil, fmt.Errorf("unable to decode output index: %v", err)
return nil, fmt.Errorf("unable to decode output "+
"index: %w", err)
}
channelPoint.OutputIndex = uint32(index)
default:
@@ -1548,7 +1549,7 @@ func listChannels(ctx *cli.Context) error {
if len(peer) > 0 {
pk, err := route.NewVertexFromStr(peer)
if err != nil {
return fmt.Errorf("invalid --peer pubkey: %v", err)
return fmt.Errorf("invalid --peer pubkey: %w", err)
}
peerKey = pk[:]
@@ -2154,12 +2155,12 @@ func parseChanPoint(s string) (*lnrpc.ChannelPoint, error) {
index, err := strconv.ParseInt(split[1], 10, 64)
if err != nil {
return nil, fmt.Errorf("unable to decode output index: %v", err)
return nil, fmt.Errorf("unable to decode output index: %w", err)
}
txid, err := chainhash.NewHashFromStr(split[0])
if err != nil {
return nil, fmt.Errorf("unable to parse hex string: %v", err)
return nil, fmt.Errorf("unable to parse hex string: %w", err)
}
return &lnrpc.ChannelPoint{
@@ -2207,7 +2208,8 @@ func updateChannelPolicy(ctx *cli.Context) error {
case args.Present():
baseFee, err = strconv.ParseInt(args.First(), 10, 64)
if err != nil {
return fmt.Errorf("unable to decode base_fee_msat: %v", err)
return fmt.Errorf("unable to decode base_fee_msat: %w",
err)
}
args = args.Tail()
default:
@@ -2224,7 +2226,7 @@ func updateChannelPolicy(ctx *cli.Context) error {
case args.Present():
feeRate, err = strconv.ParseFloat(args.First(), 64)
if err != nil {
return fmt.Errorf("unable to decode fee_rate: %v", err)
return fmt.Errorf("unable to decode fee_rate: %w", err)
}
args = args.Tail()
@@ -2265,7 +2267,7 @@ func updateChannelPolicy(ctx *cli.Context) error {
if chanPointStr != "" {
chanPoint, err = parseChanPoint(chanPointStr)
if err != nil {
return fmt.Errorf("unable to parse chan_point: %v", err)
return fmt.Errorf("unable to parse chan_point: %w", err)
}
}
@@ -2425,7 +2427,7 @@ func exportChanBackup(ctx *cli.Context) error {
if chanPointStr != "" {
chanPointRPC, err := parseChanPoint(chanPointStr)
if err != nil {
return fmt.Errorf("unable to parse chan_point: %v", err)
return fmt.Errorf("unable to parse chan_point: %w", err)
}
chanBackup, err := client.ExportChannelBackup(
@@ -2751,7 +2753,7 @@ func restoreChanBackup(ctx *cli.Context) error {
_, err = client.RestoreChannelBackups(ctxc, &req)
if err != nil {
return fmt.Errorf("unable to restore chan backups: %v", err)
return fmt.Errorf("unable to restore chan backups: %w", err)
}
return nil
+1 -1
View File
@@ -50,7 +50,7 @@ func importGraph(ctx *cli.Context) error {
jsonGraph := &lnrpc.ChannelGraph{}
err = lnrpc.ProtoJSONUnmarshalOpts.Unmarshal(jsonBytes, jsonGraph)
if err != nil {
return fmt.Errorf("error parsing JSON: %v", err)
return fmt.Errorf("error parsing JSON: %w", err)
}
res, err := client.ImportGraph(ctxc, jsonGraph)
if err != nil {
+6 -5
View File
@@ -69,7 +69,7 @@ func settleInvoice(ctx *cli.Context) error {
}
if err != nil {
return fmt.Errorf("unable to parse preimage: %v", err)
return fmt.Errorf("unable to parse preimage: %w", err)
}
invoice := &invoicesrpc.SettleInvoiceMsg{
@@ -123,7 +123,7 @@ func cancelInvoice(ctx *cli.Context) error {
}
if err != nil {
return fmt.Errorf("unable to parse preimage: %v", err)
return fmt.Errorf("unable to parse preimage: %w", err)
}
invoice := &invoicesrpc.CancelInvoiceMsg{
@@ -212,7 +212,7 @@ func addHoldInvoice(ctx *cli.Context) error {
hash, err := hex.DecodeString(args.First())
if err != nil {
return fmt.Errorf("unable to parse hash: %v", err)
return fmt.Errorf("unable to parse hash: %w", err)
}
args = args.Tail()
@@ -223,13 +223,14 @@ func addHoldInvoice(ctx *cli.Context) error {
if !ctx.IsSet("amt") && !ctx.IsSet("amt_msat") && args.Present() {
amt, err = strconv.ParseInt(args.First(), 10, 64)
if err != nil {
return fmt.Errorf("unable to decode amt argument: %v", err)
return fmt.Errorf("unable to decode amt argument: %w",
err)
}
}
descHash, err = hex.DecodeString(ctx.String("description_hash"))
if err != nil {
return fmt.Errorf("unable to parse description_hash: %v", err)
return fmt.Errorf("unable to parse description_hash: %w", err)
}
invoice := &invoicesrpc.AddHoldInvoiceRequest{
+4 -4
View File
@@ -81,7 +81,7 @@ func (e *macaroonEntry) loadMacaroon(
// Parse the macaroon data into its native struct.
mac := &macaroon.Macaroon{}
if err := mac.UnmarshalBinary(macBytes); err != nil {
return nil, fmt.Errorf("unable to decode macaroon: %v", err)
return nil, fmt.Errorf("unable to decode macaroon: %w", err)
}
return mac, nil
}
@@ -93,7 +93,7 @@ func (e *macaroonEntry) storeMacaroon(mac *macaroon.Macaroon, pw []byte) error {
// First of all, make sure we can serialize the macaroon.
macBytes, err := mac.MarshalBinary()
if err != nil {
return fmt.Errorf("unable to marshal macaroon: %v", err)
return fmt.Errorf("unable to marshal macaroon: %w", err)
}
if len(pw) == 0 {
@@ -106,14 +106,14 @@ func (e *macaroonEntry) storeMacaroon(mac *macaroon.Macaroon, pw []byte) error {
&pw, snacl.DefaultN, snacl.DefaultR, snacl.DefaultP,
)
if err != nil {
return fmt.Errorf("unable to create encryption key: %v", err)
return fmt.Errorf("unable to create encryption key: %w", err)
}
// Encrypt the macaroon data with the derived key and store it in the
// human readable format snacl:<key_base64>:<encrypted_macaroon_base64>.
encryptedMac, err := key.Encrypt(macBytes)
if err != nil {
return fmt.Errorf("unable to encrypt macaroon: %v", err)
return fmt.Errorf("unable to encrypt macaroon: %w", err)
}
keyB64 := base64.StdEncoding.EncodeToString(key.Marshal())
+5 -5
View File
@@ -99,7 +99,7 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn {
// created from the global options in the CLI context.
profile, err := getGlobalOptions(ctx, skipMacaroons)
if err != nil {
fatal(fmt.Errorf("could not load global options: %v", err))
fatal(fmt.Errorf("could not load global options: %w", err))
}
// Create a dial options array.
@@ -118,7 +118,7 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn {
// Load the specified TLS certificate.
certPool, err := profile.cert()
if err != nil {
fatal(fmt.Errorf("could not create cert pool: %v", err))
fatal(fmt.Errorf("could not create cert pool: %w", err))
}
// Build transport credentials from the certificate pool. If
@@ -164,7 +164,7 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn {
// don't need to ask for it every time.
mac, err := macEntry.loadMacaroon(readPassword)
if err != nil {
fatal(fmt.Errorf("could not load macaroon: %v", err))
fatal(fmt.Errorf("could not load macaroon: %w", err))
}
macConstraints := []macaroons.Constraint{
@@ -199,7 +199,7 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn {
// Now we append the macaroon credentials to the dial options.
cred, err := macaroons.NewMacaroonCredential(constrainedMac)
if err != nil {
fatal(fmt.Errorf("error cloning mac: %v", err))
fatal(fmt.Errorf("error cloning mac: %w", err))
}
opts = append(opts, grpc.WithPerRPCCredentials(cred))
}
@@ -228,7 +228,7 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn {
conn, err := grpc.Dial(profile.RPCServer, opts...)
if err != nil {
fatal(fmt.Errorf("unable to connect to RPC server: %v", err))
fatal(fmt.Errorf("unable to connect to RPC server: %w", err))
}
return conn
+4 -4
View File
@@ -174,7 +174,7 @@ func profileFromContext(ctx *cli.Context, store, skipMacaroons bool) (
}
mac := &macaroon.Macaroon{}
if err = mac.UnmarshalBinary(macBytes); err != nil {
return nil, fmt.Errorf("unable to decode macaroon: %v", err)
return nil, fmt.Errorf("unable to decode macaroon: %w", err)
}
var pw []byte
@@ -193,7 +193,7 @@ func profileFromContext(ctx *cli.Context, store, skipMacaroons bool) (
}
macEntry := &macaroonEntry{}
if err = macEntry.storeMacaroon(mac, pw); err != nil {
return nil, fmt.Errorf("unable to store macaroon: %v", err)
return nil, fmt.Errorf("unable to store macaroon: %w", err)
}
// We determine the name of the macaroon from the file itself but cut
@@ -241,7 +241,7 @@ func loadProfileFile(file string) (*profileFile, error) {
func saveProfileFile(file string, f *profileFile) error {
content, err := f.marshalJSON()
if err != nil {
return fmt.Errorf("could not marshal profile: %v", err)
return fmt.Errorf("could not marshal profile: %w", err)
}
return ioutil.WriteFile(file, content, 0644)
}
@@ -269,7 +269,7 @@ func (f *profileFile) marshalJSON() ([]byte, error) {
var out bytes.Buffer
err = json.Indent(&out, b, "", " ")
if err != nil {
return nil, fmt.Errorf("error indenting profile JSON: %v", err)
return nil, fmt.Errorf("error indenting profile JSON: %w", err)
}
out.WriteString("\n")
return out.Bytes(), nil
+1 -1
View File
@@ -34,7 +34,7 @@ func NewProtoOutPoint(op string) (*lnrpc.OutPoint, error) {
}
outputIndex, err := strconv.Atoi(parts[1])
if err != nil {
return nil, fmt.Errorf("invalid output index: %v", err)
return nil, fmt.Errorf("invalid output index: %w", err)
}
return &lnrpc.OutPoint{
TxidStr: txid,
+6 -5
View File
@@ -1449,7 +1449,7 @@ func leaseOutput(ctx *cli.Context) error {
outpointStr := ctx.String("outpoint")
outpoint, err := NewProtoOutPoint(outpointStr)
if err != nil {
return fmt.Errorf("error parsing outpoint: %v", err)
return fmt.Errorf("error parsing outpoint: %w", err)
}
lockIDStr := ctx.String("lockid")
@@ -1458,7 +1458,7 @@ func leaseOutput(ctx *cli.Context) error {
}
lockID, err := hex.DecodeString(lockIDStr)
if err != nil {
return fmt.Errorf("error parsing lockid: %v", err)
return fmt.Errorf("error parsing lockid: %w", err)
}
expiry := ctx.Uint64("expiry")
@@ -1534,7 +1534,7 @@ func releaseOutput(ctx *cli.Context) error {
outpoint, err := NewProtoOutPoint(outpointStr)
if err != nil {
return fmt.Errorf("error parsing outpoint: %v", err)
return fmt.Errorf("error parsing outpoint: %w", err)
}
lockID := walletrpc.LndInternalLockID[:]
@@ -1543,7 +1543,7 @@ func releaseOutput(ctx *cli.Context) error {
var err error
lockID, err = hex.DecodeString(lockIDStr)
if err != nil {
return fmt.Errorf("error parsing lockid: %v", err)
return fmt.Errorf("error parsing lockid: %w", err)
}
}
@@ -2003,7 +2003,8 @@ func importAccount(ctx *cli.Context) error {
ctx.String("master_key_fingerprint"),
)
if err != nil {
return fmt.Errorf("invalid master key fingerprint: %v", err)
return fmt.Errorf("invalid master key fingerprint: %w",
err)
}
}
+3 -3
View File
@@ -67,7 +67,7 @@ func addTower(ctx *cli.Context) error {
}
pubKey, err := hex.DecodeString(parts[0])
if err != nil {
return fmt.Errorf("invalid public key: %v", err)
return fmt.Errorf("invalid public key: %w", err)
}
address := parts[1]
@@ -160,7 +160,7 @@ func removeTower(ctx *cli.Context) error {
}
pubKey, err := hex.DecodeString(parts[0])
if err != nil {
return fmt.Errorf("invalid public key: %v", err)
return fmt.Errorf("invalid public key: %w", err)
}
var address string
if len(parts) == 2 {
@@ -264,7 +264,7 @@ func getTower(ctx *cli.Context) error {
// about.
pubKey, err := hex.DecodeString(ctx.Args().Get(0))
if err != nil {
return fmt.Errorf("invalid public key: %v", err)
return fmt.Errorf("invalid public key: %w", err)
}
client, cleanUp := getWtclient(ctx)