mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
multi: wrap all errors
This commit is contained in:
parent
9a28a4c105
commit
648fb22f63
@ -648,7 +648,7 @@ func (a *Agent) openChans(availableFunds btcutil.Amount, numChans uint32,
|
|||||||
// to open channels to.
|
// to open channels to.
|
||||||
scores, err = chooseN(numChans, scores)
|
scores, err = chooseN(numChans, scores)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to make weighted choice: %v",
|
return fmt.Errorf("unable to make weighted choice: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ func (c *WeightedCombAttachment) NodeScores(g ChannelGraph, chans []LocalChannel
|
|||||||
g, chans, chanSize, nodes,
|
g, chans, chanSize, nodes,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get sub score: %v",
|
return nil, fmt.Errorf("unable to get sub score: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ func (m *Manager) queryHeuristics(nodes map[NodeID]struct{}, localState bool) (
|
|||||||
m.cfg.PilotCfg.Graph, totalChans, chanSize, nodes,
|
m.cfg.PilotCfg.Graph, totalChans, chanSize, nodes,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get sub score: %v",
|
return nil, fmt.Errorf("unable to get sub score: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ func (l *Listener) listen() {
|
|||||||
// rejectedConnErr is a helper function that prepends the remote address of the
|
// rejectedConnErr is a helper function that prepends the remote address of the
|
||||||
// failed connection attempt to the original error message.
|
// failed connection attempt to the original error message.
|
||||||
func rejectedConnErr(err error, remoteAddr string) error {
|
func rejectedConnErr(err error, remoteAddr string) error {
|
||||||
return fmt.Errorf("unable to accept connection from %v: %v", remoteAddr,
|
return fmt.Errorf("unable to accept connection from %v: %w", remoteAddr,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ func GenCertPair(org string, tlsExtraIPs, tlsExtraDomains []string,
|
|||||||
&template, &priv.PublicKey, priv,
|
&template, &priv.PublicKey, priv,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("failed to create certificate: %v",
|
return nil, nil, fmt.Errorf("failed to create certificate: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,13 +270,13 @@ func GenCertPair(org string, tlsExtraIPs, tlsExtraDomains []string,
|
|||||||
certBuf, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes},
|
certBuf, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("failed to encode certificate: %v",
|
return nil, nil, fmt.Errorf("failed to encode certificate: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
keybytes, err := x509.MarshalECPrivateKey(priv)
|
keybytes, err := x509.MarshalECPrivateKey(priv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("unable to encode privkey: %v",
|
return nil, nil, fmt.Errorf("unable to encode privkey: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
keyBuf := &bytes.Buffer{}
|
keyBuf := &bytes.Buffer{}
|
||||||
@ -284,7 +284,7 @@ func GenCertPair(org string, tlsExtraIPs, tlsExtraDomains []string,
|
|||||||
keyBuf, &pem.Block{Type: "EC PRIVATE KEY", Bytes: keybytes},
|
keyBuf, &pem.Block{Type: "EC PRIVATE KEY", Bytes: keybytes},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("failed to encode private key: %v",
|
return nil, nil, fmt.Errorf("failed to encode private key: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,8 +792,8 @@ func (b *BitcoindNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
|||||||
// proceed with fallback methods.
|
// proceed with fallback methods.
|
||||||
jsonErr, ok := err.(*btcjson.RPCError)
|
jsonErr, ok := err.(*btcjson.RPCError)
|
||||||
if !ok || jsonErr.Code != btcjson.ErrRPCNoTxInfo {
|
if !ok || jsonErr.Code != btcjson.ErrRPCNoTxInfo {
|
||||||
return nil, fmt.Errorf("unable to query for txid %v: %v",
|
return nil, fmt.Errorf("unable to query for txid "+
|
||||||
outpoint.Hash, err)
|
"%v: %w", outpoint.Hash, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,8 +886,8 @@ func (b *BtcdNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
|||||||
// proceed with fallback methods.
|
// proceed with fallback methods.
|
||||||
jsonErr, ok := err.(*btcjson.RPCError)
|
jsonErr, ok := err.(*btcjson.RPCError)
|
||||||
if !ok || jsonErr.Code != btcjson.ErrRPCNoTxInfo {
|
if !ok || jsonErr.Code != btcjson.ErrRPCNoTxInfo {
|
||||||
return nil, fmt.Errorf("unable to query for txid %v: %v",
|
return nil, fmt.Errorf("unable to query for txid %v: "+
|
||||||
outpoint.Hash, err)
|
"%w", outpoint.Hash, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,13 +483,13 @@ func GetCommonBlockAncestorHeight(chainConn ChainConn, reorgHash,
|
|||||||
for reorgHash != chainHash {
|
for reorgHash != chainHash {
|
||||||
reorgHeader, err := chainConn.GetBlockHeader(&reorgHash)
|
reorgHeader, err := chainConn.GetBlockHeader(&reorgHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("unable to get header for hash=%v: %v",
|
return 0, fmt.Errorf("unable to get header for "+
|
||||||
reorgHash, err)
|
"hash=%v: %w", reorgHash, err)
|
||||||
}
|
}
|
||||||
chainHeader, err := chainConn.GetBlockHeader(&chainHash)
|
chainHeader, err := chainConn.GetBlockHeader(&chainHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("unable to get header for hash=%v: %v",
|
return 0, fmt.Errorf("unable to get header for "+
|
||||||
chainHash, err)
|
"hash=%v: %w", chainHash, err)
|
||||||
}
|
}
|
||||||
reorgHash = reorgHeader.PrevBlock
|
reorgHash = reorgHeader.PrevBlock
|
||||||
chainHash = chainHeader.PrevBlock
|
chainHash = chainHeader.PrevBlock
|
||||||
@ -497,8 +497,8 @@ func GetCommonBlockAncestorHeight(chainConn ChainConn, reorgHash,
|
|||||||
|
|
||||||
verboseHeader, err := chainConn.GetBlockHeaderVerbose(&chainHash)
|
verboseHeader, err := chainConn.GetBlockHeaderVerbose(&chainHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("unable to get verbose header for hash=%v: %v",
|
return 0, fmt.Errorf("unable to get verbose header for "+
|
||||||
chainHash, err)
|
"hash=%v: %w", chainHash, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return verboseHeader.Height, nil
|
return verboseHeader.Height, nil
|
||||||
@ -719,7 +719,7 @@ func ConfDetailsFromTxIndex(chainConn TxIndexConn, r ConfRequest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nil, TxNotFoundIndex,
|
return nil, TxNotFoundIndex,
|
||||||
fmt.Errorf("unable to query for txid %v: %v",
|
fmt.Errorf("unable to query for txid %v: %w",
|
||||||
r.TxID, err)
|
r.TxID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,13 +728,13 @@ func ConfDetailsFromTxIndex(chainConn TxIndexConn, r ConfRequest,
|
|||||||
rawTx, err := hex.DecodeString(rawTxRes.Hex)
|
rawTx, err := hex.DecodeString(rawTxRes.Hex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, TxNotFoundIndex,
|
return nil, TxNotFoundIndex,
|
||||||
fmt.Errorf("unable to deserialize tx %v: %v",
|
fmt.Errorf("unable to deserialize tx %v: %w",
|
||||||
r.TxID, err)
|
r.TxID, err)
|
||||||
}
|
}
|
||||||
var tx wire.MsgTx
|
var tx wire.MsgTx
|
||||||
if err := tx.Deserialize(bytes.NewReader(rawTx)); err != nil {
|
if err := tx.Deserialize(bytes.NewReader(rawTx)); err != nil {
|
||||||
return nil, TxNotFoundIndex,
|
return nil, TxNotFoundIndex,
|
||||||
fmt.Errorf("unable to deserialize tx %v: %v",
|
fmt.Errorf("unable to deserialize tx %v: %w",
|
||||||
r.TxID, err)
|
r.TxID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,13 +759,14 @@ func ConfDetailsFromTxIndex(chainConn TxIndexConn, r ConfRequest,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, TxNotFoundIndex,
|
return nil, TxNotFoundIndex,
|
||||||
fmt.Errorf("unable to get block hash %v for "+
|
fmt.Errorf("unable to get block hash %v for "+
|
||||||
"historical dispatch: %v", rawTxRes.BlockHash, err)
|
"historical dispatch: %w", rawTxRes.BlockHash,
|
||||||
|
err)
|
||||||
}
|
}
|
||||||
block, err := chainConn.GetBlock(blockHash)
|
block, err := chainConn.GetBlock(blockHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, TxNotFoundIndex,
|
return nil, TxNotFoundIndex,
|
||||||
fmt.Errorf("unable to get block with hash %v for "+
|
fmt.Errorf("unable to get block with hash %v for "+
|
||||||
"historical dispatch: %v", blockHash, err)
|
"historical dispatch: %w", blockHash, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the modern chain (the only one we really care about for LN), the
|
// In the modern chain (the only one we really care about for LN), the
|
||||||
|
@ -582,8 +582,8 @@ func (n *NeutrinoNotifier) historicalConfDetails(confRequest chainntnfs.ConfRequ
|
|||||||
// can compute the current block hash.
|
// can compute the current block hash.
|
||||||
blockHash, err := n.p2pNode.GetBlockHash(int64(scanHeight))
|
blockHash, err := n.p2pNode.GetBlockHash(int64(scanHeight))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get header for height=%v: %v",
|
return nil, fmt.Errorf("unable to get header for "+
|
||||||
scanHeight, err)
|
"height=%v: %w", scanHeight, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// With the hash computed, we can now fetch the basic filter for this
|
// With the hash computed, we can now fetch the basic filter for this
|
||||||
@ -600,8 +600,8 @@ func (n *NeutrinoNotifier) historicalConfDetails(confRequest chainntnfs.ConfRequ
|
|||||||
neutrino.MaxBatchSize(int64(scanHeight-startHeight+1)),
|
neutrino.MaxBatchSize(int64(scanHeight-startHeight+1)),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to retrieve regular filter for "+
|
return nil, fmt.Errorf("unable to retrieve regular "+
|
||||||
"height=%v: %v", scanHeight, err)
|
"filter for height=%v: %w", scanHeight, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the case that the filter exists, we'll attempt to see if
|
// In the case that the filter exists, we'll attempt to see if
|
||||||
|
@ -763,11 +763,11 @@ func NewChainControl(walletConfig lnwallet.Config,
|
|||||||
|
|
||||||
lnWallet, err := lnwallet.NewLightningWallet(walletConfig)
|
lnWallet, err := lnwallet.NewLightningWallet(walletConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ccCleanup, fmt.Errorf("unable to create wallet: %v",
|
return nil, ccCleanup, fmt.Errorf("unable to create wallet: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
if err := lnWallet.Startup(); err != nil {
|
if err := lnWallet.Startup(); err != nil {
|
||||||
return nil, ccCleanup, fmt.Errorf("unable to create wallet: %v",
|
return nil, ccCleanup, fmt.Errorf("unable to create wallet: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,8 @@ func WriteElement(w io.Writer, element interface{}) error {
|
|||||||
|
|
||||||
if e.PubKey != nil {
|
if e.PubKey != nil {
|
||||||
if err := binary.Write(w, byteOrder, true); err != nil {
|
if err := binary.Write(w, byteOrder, true); err != nil {
|
||||||
return fmt.Errorf("error writing serialized element: %s", err)
|
return fmt.Errorf("error writing serialized "+
|
||||||
|
"element: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return WriteElement(w, e.PubKey)
|
return WriteElement(w, e.PubKey)
|
||||||
|
@ -643,7 +643,7 @@ func (c *ChannelStateDB) fetchNodeChannels(chainBucket kvdb.RBucket) (
|
|||||||
oChannel, err := fetchOpenChannel(chanBucket, &outPoint)
|
oChannel, err := fetchOpenChannel(chanBucket, &outPoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to read channel data for "+
|
return fmt.Errorf("unable to read channel data for "+
|
||||||
"chan_point=%v: %v", outPoint, err)
|
"chan_point=%v: %w", outPoint, err)
|
||||||
}
|
}
|
||||||
oChannel.Db = c
|
oChannel.Db = c
|
||||||
|
|
||||||
|
@ -83,7 +83,8 @@ func WriteElement(w io.Writer, element interface{}) error {
|
|||||||
|
|
||||||
if e.PubKey != nil {
|
if e.PubKey != nil {
|
||||||
if err := binary.Write(w, byteOrder, true); err != nil {
|
if err := binary.Write(w, byteOrder, true); err != nil {
|
||||||
return fmt.Errorf("error writing serialized element: %s", err)
|
return fmt.Errorf("error writing serialized "+
|
||||||
|
"element: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return WriteElement(w, e.PubKey)
|
return WriteElement(w, e.PubKey)
|
||||||
|
@ -81,7 +81,8 @@ func WriteElement(w io.Writer, element interface{}) error {
|
|||||||
|
|
||||||
if e.PubKey != nil {
|
if e.PubKey != nil {
|
||||||
if err := binary.Write(w, byteOrder, true); err != nil {
|
if err := binary.Write(w, byteOrder, true); err != nil {
|
||||||
return fmt.Errorf("error writing serialized element: %s", err)
|
return fmt.Errorf("error writing serialized "+
|
||||||
|
"element: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return WriteElement(w, e.PubKey)
|
return WriteElement(w, e.PubKey)
|
||||||
|
@ -93,7 +93,7 @@ func findOpenChannels(openChanBucket kvdb.RBucket) ([]*OpenChannel, error) {
|
|||||||
// open channels as they don't have any revocation logs and
|
// open channels as they don't have any revocation logs and
|
||||||
// their current commitments reflect the initial balances.
|
// their current commitments reflect the initial balances.
|
||||||
if err := FetchChanCommitments(chanBucket, c); err != nil {
|
if err := FetchChanCommitments(chanBucket, c); err != nil {
|
||||||
return fmt.Errorf("unable to fetch chan commits: %v",
|
return fmt.Errorf("unable to fetch chan commits: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ func findHistoricalChannels(historicalBucket kvdb.RBucket) ([]*OpenChannel,
|
|||||||
// Try to fetch channel info in old format.
|
// Try to fetch channel info in old format.
|
||||||
err = fetchChanInfoCompatible(chanBucket, c, true)
|
err = fetchChanInfoCompatible(chanBucket, c, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%s: fetch chan info got: %v",
|
return fmt.Errorf("%s: fetch chan info got: %w",
|
||||||
c.FundingOutpoint, err)
|
c.FundingOutpoint, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ func writeRevocationLogs(openChanBucket kvdb.RwBucket,
|
|||||||
logEntrykey := mig24.MakeLogKey(entry.commitHeight)
|
logEntrykey := mig24.MakeLogKey(entry.commitHeight)
|
||||||
err = logBucket.Put(logEntrykey[:], b.Bytes())
|
err = logBucket.Put(logEntrykey[:], b.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("putRevocationLog err: %v",
|
return fmt.Errorf("putRevocationLog err: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ func WriteElement(w io.Writer, element interface{}) error {
|
|||||||
|
|
||||||
if e.PubKey != nil {
|
if e.PubKey != nil {
|
||||||
if err := binary.Write(w, byteOrder, true); err != nil {
|
if err := binary.Write(w, byteOrder, true); err != nil {
|
||||||
return fmt.Errorf("error writing serialized element: %s", err)
|
return fmt.Errorf("error writing serialized element: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return WriteElement(w, e.PubKey)
|
return WriteElement(w, e.PubKey)
|
||||||
|
@ -1140,7 +1140,7 @@ func deserializeChanEdgePolicy(r io.Reader,
|
|||||||
|
|
||||||
node, err := fetchLightningNode(nodes, pub[:])
|
node, err := fetchLightningNode(nodes, pub[:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to fetch node: %x, %v",
|
return nil, fmt.Errorf("unable to fetch node: %x, %w",
|
||||||
pub[:], err)
|
pub[:], err)
|
||||||
}
|
}
|
||||||
edge.Node = &node
|
edge.Node = &node
|
||||||
|
@ -516,7 +516,7 @@ func MigratePruneEdgeUpdateIndex(tx kvdb.RwTx) error {
|
|||||||
// well.
|
// well.
|
||||||
edgeIndex, err := edges.CreateBucketIfNotExists(edgeIndexBucket)
|
edgeIndex, err := edges.CreateBucketIfNotExists(edgeIndexBucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error creating edge index bucket: %s", err)
|
return fmt.Errorf("error creating edge index bucket: %w", err)
|
||||||
}
|
}
|
||||||
if edgeIndex == nil {
|
if edgeIndex == nil {
|
||||||
return fmt.Errorf("unable to create/fetch edge index " +
|
return fmt.Errorf("unable to create/fetch edge index " +
|
||||||
@ -546,7 +546,7 @@ func MigratePruneEdgeUpdateIndex(tx kvdb.RwTx) error {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to gather existing edge policies: %v",
|
return fmt.Errorf("unable to gather existing edge policies: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +560,7 @@ func MigratePruneEdgeUpdateIndex(tx kvdb.RwTx) error {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to gather existing edge updates: %v",
|
return fmt.Errorf("unable to gather existing edge updates: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ func encodeAmount(msat lnwire.MilliSatoshi) (string, error) {
|
|||||||
// Should always be expressible in pico BTC.
|
// Should always be expressible in pico BTC.
|
||||||
pico, err := fromMSat['p'](msat)
|
pico, err := fromMSat['p'](msat)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("unable to express %d msat as pBTC: %v",
|
return "", fmt.Errorf("unable to express %d msat as pBTC: %w",
|
||||||
msat, err)
|
msat, err)
|
||||||
}
|
}
|
||||||
shortened := strconv.FormatUint(pico, 10) + "p"
|
shortened := strconv.FormatUint(pico, 10) + "p"
|
||||||
|
@ -229,7 +229,7 @@ func (p *PaymentControl) InitPayment(paymentHash lntypes.Hash,
|
|||||||
return bucket.Delete(paymentFailInfoKey)
|
return bucket.Delete(paymentFailInfoKey)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("unable to init payment: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return updateErr
|
return updateErr
|
||||||
|
@ -615,7 +615,7 @@ func (d *DB) QueryPayments(query PaymentsQuery) (PaymentsResponse, error) {
|
|||||||
err = indexes.ForEach(countFn)
|
err = indexes.ForEach(countFn)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error counting payments: %v",
|
return fmt.Errorf("error counting payments: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ func printMacaroon(ctx *cli.Context) error {
|
|||||||
case args.Present():
|
case args.Present():
|
||||||
macBytes, err = hex.DecodeString(args.First())
|
macBytes, err = hex.DecodeString(args.First())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to hex decode macaroon: %v",
|
return fmt.Errorf("unable to hex decode macaroon: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ func openChannelPsbt(rpcCtx context.Context, ctx *cli.Context,
|
|||||||
// Recv blocks until a message or error arrives.
|
// Recv blocks until a message or error arrives.
|
||||||
resp, err := stream.Recv()
|
resp, err := stream.Recv()
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
srvErr <- fmt.Errorf("lnd shutting down: %v",
|
srvErr <- fmt.Errorf("lnd shutting down: %w",
|
||||||
err)
|
err)
|
||||||
return
|
return
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
@ -685,7 +685,7 @@ func openChannelPsbt(rpcCtx context.Context, ctx *cli.Context,
|
|||||||
}
|
}
|
||||||
fundedPsbt, err := decodePsbt(inputPsbt)
|
fundedPsbt, err := decodePsbt(inputPsbt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("psbt decode failed: %v",
|
return fmt.Errorf("psbt decode failed: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
verifyMsg := &lnrpc.FundingTransitionMsg{
|
verifyMsg := &lnrpc.FundingTransitionMsg{
|
||||||
@ -873,14 +873,14 @@ func batchOpenChannel(ctx *cli.Context) error {
|
|||||||
for idx, jsonChannel := range jsonChannels {
|
for idx, jsonChannel := range jsonChannels {
|
||||||
pubKeyBytes, err := hex.DecodeString(jsonChannel.NodePubkey)
|
pubKeyBytes, err := hex.DecodeString(jsonChannel.NodePubkey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing node pubkey hex: %v",
|
return fmt.Errorf("error parsing node pubkey hex: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
pendingChanBytes, err := hex.DecodeString(
|
pendingChanBytes, err := hex.DecodeString(
|
||||||
jsonChannel.PendingChanID,
|
jsonChannel.PendingChanID,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing pending chan ID: %v",
|
return fmt.Errorf("error parsing pending chan ID: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,13 +525,13 @@ func sendPaymentRequest(ctx *cli.Context,
|
|||||||
|
|
||||||
recordID, err := strconv.ParseUint(kv[0], 10, 64)
|
recordID, err := strconv.ParseUint(kv[0], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid data format: %v",
|
return fmt.Errorf("invalid data format: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
hexValue, err := hex.DecodeString(kv[1])
|
hexValue, err := hex.DecodeString(kv[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid data format: %v",
|
return fmt.Errorf("invalid data format: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1514,7 +1514,7 @@ func forwardingHistory(ctx *cli.Context) error {
|
|||||||
case args.Present():
|
case args.Present():
|
||||||
i, err := strconv.ParseInt(args.First(), 10, 64)
|
i, err := strconv.ParseInt(args.First(), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to decode index_offset: %v",
|
return fmt.Errorf("unable to decode index_offset: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
indexOffset = uint32(i)
|
indexOffset = uint32(i)
|
||||||
@ -1527,7 +1527,7 @@ func forwardingHistory(ctx *cli.Context) error {
|
|||||||
case args.Present():
|
case args.Present():
|
||||||
m, err := strconv.ParseInt(args.First(), 10, 64)
|
m, err := strconv.ParseInt(args.First(), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to decode max_events: %v",
|
return fmt.Errorf("unable to decode max_events: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
maxEvents = uint32(m)
|
maxEvents = uint32(m)
|
||||||
@ -1616,7 +1616,7 @@ func buildRoute(ctx *cli.Context) error {
|
|||||||
for _, k := range hops {
|
for _, k := range hops {
|
||||||
pubkey, err := route.NewVertexFromStr(k)
|
pubkey, err := route.NewVertexFromStr(k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing %v: %v", k, err)
|
return fmt.Errorf("error parsing %v: %w", k, err)
|
||||||
}
|
}
|
||||||
rpcHops = append(rpcHops, pubkey[:])
|
rpcHops = append(rpcHops, pubkey[:])
|
||||||
}
|
}
|
||||||
@ -1757,7 +1757,7 @@ func deletePayments(ctx *cli.Context) error {
|
|||||||
case singlePayment:
|
case singlePayment:
|
||||||
paymentHash, err = hex.DecodeString(ctx.String("payment_hash"))
|
paymentHash, err = hex.DecodeString(ctx.String("payment_hash"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error decoding payment_hash: %v",
|
return fmt.Errorf("error decoding payment_hash: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1766,7 +1766,7 @@ func deletePayments(ctx *cli.Context) error {
|
|||||||
FailedHtlcsOnly: failedHTLCsOnly,
|
FailedHtlcsOnly: failedHTLCsOnly,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error deleting single payment: %v",
|
return fmt.Errorf("error deleting single payment: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ func profileAdd(ctx *cli.Context) error {
|
|||||||
// All done, store the updated profile file.
|
// All done, store the updated profile file.
|
||||||
f.Profiles = append(f.Profiles, profile)
|
f.Profiles = append(f.Profiles, profile)
|
||||||
if err = saveProfileFile(defaultProfileFile, f); err != nil {
|
if err = saveProfileFile(defaultProfileFile, f); err != nil {
|
||||||
return fmt.Errorf("error writing profile file %s: %v",
|
return fmt.Errorf("error writing profile file %s: %w",
|
||||||
defaultProfileFile, err)
|
defaultProfileFile, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ func profileAddMacaroon(ctx *cli.Context) error {
|
|||||||
selectedProfile.Macaroons.Jar, macEntry,
|
selectedProfile.Macaroons.Jar, macEntry,
|
||||||
)
|
)
|
||||||
if err = saveProfileFile(defaultProfileFile, f); err != nil {
|
if err = saveProfileFile(defaultProfileFile, f); err != nil {
|
||||||
return fmt.Errorf("error writing profile file %s: %v",
|
return fmt.Errorf("error writing profile file %s: %w",
|
||||||
defaultProfileFile, err)
|
defaultProfileFile, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1811,7 +1811,7 @@ func getChanInfo(ctx *cli.Context) error {
|
|||||||
case ctx.Args().Present():
|
case ctx.Args().Present():
|
||||||
chanID, err = strconv.ParseUint(ctx.Args().First(), 10, 64)
|
chanID, err = strconv.ParseUint(ctx.Args().First(), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing chan_id: %s", err)
|
return fmt.Errorf("error parsing chan_id: %w", err)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("chan_id argument missing")
|
return fmt.Errorf("chan_id argument missing")
|
||||||
|
@ -67,7 +67,7 @@ func (e *macaroonEntry) loadMacaroon(
|
|||||||
|
|
||||||
macBytes, err = decryptMacaroon(parts[1], parts[2], pw)
|
macBytes, err = decryptMacaroon(parts[1], parts[2], pw)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to decrypt macaroon: %v",
|
return nil, fmt.Errorf("unable to decrypt macaroon: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -142,7 +142,7 @@ func decryptMacaroon(keyB64, dataB64 string, pw []byte) ([]byte, error) {
|
|||||||
key := &snacl.SecretKey{}
|
key := &snacl.SecretKey{}
|
||||||
err = key.Unmarshal(keyData)
|
err = key.Unmarshal(keyData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not unmarshal encryption key: %v",
|
return nil, fmt.Errorf("could not unmarshal encryption key: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ func decryptMacaroon(keyB64, dataB64 string, pw []byte) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
macBytes, err := key.Decrypt(encryptedMac)
|
macBytes, err := key.Decrypt(encryptedMac)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not decrypt macaroon data: %v",
|
return nil, fmt.Errorf("could not decrypt macaroon data: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
return macBytes, nil
|
return macBytes, nil
|
||||||
|
@ -224,7 +224,7 @@ func loadProfileFile(file string) (*profileFile, error) {
|
|||||||
|
|
||||||
content, err := ioutil.ReadFile(file)
|
content, err := ioutil.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not load profile file %s: %v",
|
return nil, fmt.Errorf("could not load profile file %s: %w",
|
||||||
file, err)
|
file, err)
|
||||||
}
|
}
|
||||||
f := &profileFile{}
|
f := &profileFile{}
|
||||||
@ -262,7 +262,7 @@ func (f *profileFile) unmarshalJSON(content []byte) error {
|
|||||||
func (f *profileFile) marshalJSON() ([]byte, error) {
|
func (f *profileFile) marshalJSON() ([]byte, error) {
|
||||||
b, err := json.Marshal(f)
|
b, err := json.Marshal(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error JSON marshalling profile: %v",
|
return nil, fmt.Errorf("error JSON marshalling profile: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1235,8 +1235,8 @@ func fundPsbt(ctx *cli.Context) error {
|
|||||||
// entry must be present.
|
// entry must be present.
|
||||||
jsonMap := []byte(ctx.String("outputs"))
|
jsonMap := []byte(ctx.String("outputs"))
|
||||||
if err := json.Unmarshal(jsonMap, &amountToAddr); err != nil {
|
if err := json.Unmarshal(jsonMap, &amountToAddr); err != nil {
|
||||||
return fmt.Errorf("error parsing outputs JSON: %v",
|
return fmt.Errorf("error parsing outputs "+
|
||||||
err)
|
"JSON: %w", err)
|
||||||
}
|
}
|
||||||
tpl.Outputs = amountToAddr
|
tpl.Outputs = amountToAddr
|
||||||
}
|
}
|
||||||
|
@ -568,7 +568,7 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
|
|||||||
)
|
)
|
||||||
cleanUpTasks = append(cleanUpTasks, pccCleanup)
|
cleanUpTasks = append(cleanUpTasks, pccCleanup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("unable to create partial chain control: %v",
|
err := fmt.Errorf("unable to create partial chain control: %w",
|
||||||
err)
|
err)
|
||||||
d.logger.Error(err)
|
d.logger.Error(err)
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
@ -1073,7 +1073,7 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cleanUp()
|
cleanUp()
|
||||||
|
|
||||||
err := fmt.Errorf("unable to open %s database: %v",
|
err := fmt.Errorf("unable to open %s database: %w",
|
||||||
lncfg.NSTowerClientDB, err)
|
lncfg.NSTowerClientDB, err)
|
||||||
d.logger.Error(err)
|
d.logger.Error(err)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
@ -1088,7 +1088,7 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cleanUp()
|
cleanUp()
|
||||||
|
|
||||||
err := fmt.Errorf("unable to open %s database: %v",
|
err := fmt.Errorf("unable to open %s database: %w",
|
||||||
lncfg.NSTowerServerDB, err)
|
lncfg.NSTowerServerDB, err)
|
||||||
d.logger.Error(err)
|
d.logger.Error(err)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
@ -1303,7 +1303,7 @@ func importWatchOnlyAccounts(wallet *wallet.Wallet,
|
|||||||
addrSchema,
|
addrSchema,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not import account %v: %v",
|
return fmt.Errorf("could not import account %v: %w",
|
||||||
name, err)
|
name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -931,7 +931,7 @@ func (b *BreachArbitrator) cleanupBreach(chanPoint *wire.OutPoint) error {
|
|||||||
// info from the database.
|
// info from the database.
|
||||||
err = b.cfg.Store.Remove(chanPoint)
|
err = b.cfg.Store.Remove(chanPoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to remove retribution from db: %v",
|
return fmt.Errorf("unable to remove retribution from db: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1647,7 +1647,7 @@ func (d *AuthenticatedGossiper) retransmitStaleAnns(now time.Time) error {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil && err != channeldb.ErrGraphNoEdgesFound {
|
if err != nil && err != channeldb.ErrGraphNoEdgesFound {
|
||||||
return fmt.Errorf("unable to retrieve outgoing channels: %v",
|
return fmt.Errorf("unable to retrieve outgoing channels: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1873,7 +1873,7 @@ func (d *AuthenticatedGossiper) processRejectedEdge(
|
|||||||
// to the database.
|
// to the database.
|
||||||
err = d.cfg.Router.AddProof(chanAnnMsg.ShortChannelID, proof)
|
err = d.cfg.Router.AddProof(chanAnnMsg.ShortChannelID, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("unable add proof to shortChanID=%v: %v",
|
err := fmt.Errorf("unable add proof to shortChanID=%v: %w",
|
||||||
chanAnnMsg.ShortChannelID, err)
|
chanAnnMsg.ShortChannelID, err)
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1910,7 +1910,7 @@ func (d *AuthenticatedGossiper) addNode(msg *lnwire.NodeAnnouncement,
|
|||||||
op ...batch.SchedulerOption) error {
|
op ...batch.SchedulerOption) error {
|
||||||
|
|
||||||
if err := routing.ValidateNodeAnn(msg); err != nil {
|
if err := routing.ValidateNodeAnn(msg); err != nil {
|
||||||
return fmt.Errorf("unable to validate node announcement: %v",
|
return fmt.Errorf("unable to validate node announcement: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ func NewMessageStore(db kvdb.Backend) (*MessageStore, error) {
|
|||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to create required buckets: %v",
|
return nil, fmt.Errorf("unable to create required buckets: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1252,7 +1252,7 @@ func (g *GossipSyncer) replyShortChanIDs(query *lnwire.QueryShortChanIDs) error
|
|||||||
query.ChainHash, query.ShortChanIDs,
|
query.ChainHash, query.ShortChanIDs,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to fetch chan anns for %v..., %v",
|
return fmt.Errorf("unable to fetch chan anns for %v..., %w",
|
||||||
query.ShortChanIDs[0].ToUint64(), err)
|
query.ShortChanIDs[0].ToUint64(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
|
|||||||
fv := lnwire.NewFeatureVector(raw, lnwire.Features)
|
fv := lnwire.NewFeatureVector(raw, lnwire.Features)
|
||||||
err := ValidateDeps(fv)
|
err := ValidateDeps(fv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid feature set %v: %v",
|
return nil, fmt.Errorf("invalid feature set %v: %w",
|
||||||
set, err)
|
set, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ func (b *Batcher) BatchFund(ctx context.Context,
|
|||||||
"chan ID")
|
"chan ID")
|
||||||
}
|
}
|
||||||
} else if _, err := rand.Read(pendingChanID[:]); err != nil {
|
} else if _, err := rand.Read(pendingChanID[:]); err != nil {
|
||||||
return nil, fmt.Errorf("error making temp chan ID: %v",
|
return nil, fmt.Errorf("error making temp chan ID: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ func (b *Batcher) BatchFund(ctx context.Context,
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error parsing channel %d: %v",
|
return nil, fmt.Errorf("error parsing channel %d: %w",
|
||||||
idx, err)
|
idx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,7 +1123,7 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
|
|||||||
case markedOpen:
|
case markedOpen:
|
||||||
err := f.sendChannelReady(channel, lnChannel)
|
err := f.sendChannelReady(channel, lnChannel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed sending channelReady: %v",
|
return fmt.Errorf("failed sending channelReady: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1137,7 +1137,7 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
|
|||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error setting channel state to"+
|
return fmt.Errorf("error setting channel state to"+
|
||||||
" channelReadySent: %v", err)
|
" channelReadySent: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Channel(%v) with ShortChanID %v: successfully "+
|
log.Debugf("Channel(%v) with ShortChanID %v: successfully "+
|
||||||
@ -1207,7 +1207,7 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
|
|||||||
// shutdown.
|
// shutdown.
|
||||||
err = f.deleteChannelOpeningState(&channel.FundingOutpoint)
|
err = f.deleteChannelOpeningState(&channel.FundingOutpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error deleting channel state: %v",
|
return fmt.Errorf("error deleting channel state: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2757,7 +2757,7 @@ func (f *Manager) fundingTimeout(c *channeldb.OpenChannel,
|
|||||||
if err := c.CloseChannel(
|
if err := c.CloseChannel(
|
||||||
closeInfo, channeldb.ChanStatusLocalCloseInitiator,
|
closeInfo, channeldb.ChanStatusLocalCloseInitiator,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return fmt.Errorf("failed closing channel %v: %v",
|
return fmt.Errorf("failed closing channel %v: %w",
|
||||||
c.FundingOutpoint, err)
|
c.FundingOutpoint, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4784,7 +4784,7 @@ func (f *Manager) handleInitFundingMsg(msg *InitFundingMsg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := msg.Peer.SendMessage(true, &fundingOpen); err != nil {
|
if err := msg.Peer.SendMessage(true, &fundingOpen); err != nil {
|
||||||
e := fmt.Errorf("unable to send funding request message: %v",
|
e := fmt.Errorf("unable to send funding request message: %w",
|
||||||
err)
|
err)
|
||||||
log.Errorf(e.Error())
|
log.Errorf(e.Error())
|
||||||
|
|
||||||
|
@ -587,7 +587,7 @@ func DeserializePartialSignature(scalarBytes []byte) (*musig2.PartialSignature,
|
|||||||
|
|
||||||
sig := &musig2.PartialSignature{}
|
sig := &musig2.PartialSignature{}
|
||||||
if err := sig.Decode(bytes.NewReader(scalarBytes)); err != nil {
|
if err := sig.Decode(bytes.NewReader(scalarBytes)); err != nil {
|
||||||
return nil, fmt.Errorf("error decoding partial signature: %v",
|
return nil, fmt.Errorf("error decoding partial signature: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ func (cmd *compacter) execute() (int64, int64, error) {
|
|||||||
Timeout: cmd.dbTimeout,
|
Timeout: cmd.dbTimeout,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, fmt.Errorf("error opening source database: %v",
|
return 0, 0, fmt.Errorf("error opening source database: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -105,7 +105,7 @@ func (cmd *compacter) execute() (int64, int64, error) {
|
|||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, fmt.Errorf("error opening destination database: "+
|
return 0, 0, fmt.Errorf("error opening destination database: "+
|
||||||
"%v", err)
|
"%w", err)
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := dst.Close(); err != nil {
|
if err := dst.Close(); err != nil {
|
||||||
@ -122,7 +122,7 @@ func (cmd *compacter) execute() (int64, int64, error) {
|
|||||||
fi, err = os.Stat(cmd.dstPath)
|
fi, err = os.Stat(cmd.dstPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, fmt.Errorf("error determining destination "+
|
return 0, 0, fmt.Errorf("error determining destination "+
|
||||||
"database size: %v", err)
|
"database size: %w", err)
|
||||||
} else if fi.Size() == 0 {
|
} else if fi.Size() == 0 {
|
||||||
return 0, 0, fmt.Errorf("zero db size")
|
return 0, 0, fmt.Errorf("zero db size")
|
||||||
}
|
}
|
||||||
|
2
lnd.go
2
lnd.go
@ -91,7 +91,7 @@ func AdminAuthOptions(cfg *Config, skipMacaroons bool) ([]grpc.DialOption,
|
|||||||
|
|
||||||
mac := &macaroon.Macaroon{}
|
mac := &macaroon.Macaroon{}
|
||||||
if err = mac.UnmarshalBinary(macBytes); err != nil {
|
if err = mac.UnmarshalBinary(macBytes); err != nil {
|
||||||
return nil, fmt.Errorf("unable to decode macaroon: %v",
|
return nil, fmt.Errorf("unable to decode macaroon: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ func (s *Server) ImportGraph(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := graphDB.AddLightningNode(node); err != nil {
|
if err := graphDB.AddLightningNode(node); err != nil {
|
||||||
return nil, fmt.Errorf("unable to add node %v: %v",
|
return nil, fmt.Errorf("unable to add node %v: %w",
|
||||||
rpcNode.PubKey, err)
|
rpcNode.PubKey, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ func (s *Server) ImportGraph(ctx context.Context,
|
|||||||
edge.ChannelPoint = *channelPoint
|
edge.ChannelPoint = *channelPoint
|
||||||
|
|
||||||
if err := graphDB.AddChannelEdge(edge); err != nil {
|
if err := graphDB.AddChannelEdge(edge); err != nil {
|
||||||
return nil, fmt.Errorf("unable to add edge %v: %v",
|
return nil, fmt.Errorf("unable to add edge %v: %w",
|
||||||
rpcEdge.ChanPoint, err)
|
rpcEdge.ChanPoint, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1140,7 +1140,7 @@ func toPairSnapshot(pairResult *PairHistory) (*routing.MissionControlPairSnapsho
|
|||||||
pairResult.History.FailTime,
|
pairResult.History.FailTime,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%v invalid failure: %v", pairPrefix,
|
return nil, fmt.Errorf("%v invalid failure: %w", pairPrefix,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1150,7 +1150,7 @@ func toPairSnapshot(pairResult *PairHistory) (*routing.MissionControlPairSnapsho
|
|||||||
pairResult.History.SuccessTime,
|
pairResult.History.SuccessTime,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%v invalid success: %v", pairPrefix,
|
return nil, fmt.Errorf("%v invalid success: %w", pairPrefix,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,14 +710,14 @@ func (s *Server) VerifyMessage(_ context.Context,
|
|||||||
// for Schnorr signatures.
|
// for Schnorr signatures.
|
||||||
pubkey, err := schnorr.ParsePubKey(in.Pubkey)
|
pubkey, err := schnorr.ParsePubKey(in.Pubkey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to parse pubkey: %v",
|
return nil, fmt.Errorf("unable to parse pubkey: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sigParsed, err := schnorr.ParseSignature(in.Signature)
|
sigParsed, err := schnorr.ParseSignature(in.Signature)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't parse Schnorr "+
|
return nil, fmt.Errorf("can't parse Schnorr "+
|
||||||
"signature: %v", err)
|
"signature: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var digest []byte
|
var digest []byte
|
||||||
@ -746,7 +746,7 @@ func (s *Server) VerifyMessage(_ context.Context,
|
|||||||
}
|
}
|
||||||
sig, err := wireSig.ToSignature()
|
sig, err := wireSig.ToSignature()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to convert from wire format: %v",
|
return nil, fmt.Errorf("failed to convert from wire format: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,7 +874,7 @@ func (s *Server) MuSig2CombineKeys(_ context.Context,
|
|||||||
// Are there any tweaks to apply to the combined public key?
|
// Are there any tweaks to apply to the combined public key?
|
||||||
tweaks, err := UnmarshalTweaks(in.Tweaks, in.TaprootTweak)
|
tweaks, err := UnmarshalTweaks(in.Tweaks, in.TaprootTweak)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error unmarshaling tweak options: %v",
|
return nil, fmt.Errorf("error unmarshaling tweak options: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1014,7 +1014,7 @@ func (s *Server) MuSig2CreateSession(_ context.Context,
|
|||||||
// Are there any tweaks to apply to the combined public key?
|
// Are there any tweaks to apply to the combined public key?
|
||||||
tweaks, err := UnmarshalTweaks(in.Tweaks, in.TaprootTweak)
|
tweaks, err := UnmarshalTweaks(in.Tweaks, in.TaprootTweak)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error unmarshaling tweak options: %v",
|
return nil, fmt.Errorf("error unmarshaling tweak options: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1139,7 +1139,7 @@ func (s *Server) MuSig2CombineSig(_ context.Context,
|
|||||||
in.OtherPartialSignatures,
|
in.OtherPartialSignatures,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error parsing partial signatures: %v",
|
return nil, fmt.Errorf("error parsing partial signatures: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1038,7 +1038,7 @@ func (w *WalletKit) BumpFee(ctx context.Context,
|
|||||||
// with an unconfirmed transaction.
|
// with an unconfirmed transaction.
|
||||||
_, currentHeight, err := w.cfg.Chain.GetBestBlock()
|
_, currentHeight, err := w.cfg.Chain.GetBestBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to retrieve current height: %v",
|
return nil, fmt.Errorf("unable to retrieve current height: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2607,7 +2607,7 @@ func (w *WalletKit) ImportTapscript(_ context.Context,
|
|||||||
taprootScope := waddrmgr.KeyScopeBIP0086
|
taprootScope := waddrmgr.KeyScopeBIP0086
|
||||||
addr, err := w.cfg.Wallet.ImportTaprootScript(taprootScope, tapscript)
|
addr, err := w.cfg.Wallet.ImportTaprootScript(taprootScope, tapscript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error importing script into wallet: %v",
|
return nil, fmt.Errorf("error importing script into wallet: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,8 @@ func (c *WatchtowerClient) AddTower(ctx context.Context,
|
|||||||
c.cfg.Resolver,
|
c.cfg.Resolver,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid address %v: %v", req.Address, err)
|
return nil, fmt.Errorf("invalid address %v: %w", req.Address,
|
||||||
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
towerAddr := &lnwire.NetAddress{
|
towerAddr := &lnwire.NetAddress{
|
||||||
|
@ -192,7 +192,7 @@ func newBackend(miner string, netParams *chaincfg.Params, extraArgs []string,
|
|||||||
client, err := rpcclient.New(&rpcCfg, nil)
|
client, err := rpcclient.New(&rpcCfg, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = cleanUp()
|
_ = cleanUp()
|
||||||
return nil, nil, fmt.Errorf("unable to create rpc client: %v",
|
return nil, nil, fmt.Errorf("unable to create rpc client: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,14 +294,14 @@ func (hn *HarnessNode) ReadMacaroon(macPath string, timeout time.Duration) (
|
|||||||
err := wait.NoError(func() error {
|
err := wait.NoError(func() error {
|
||||||
macBytes, err := ioutil.ReadFile(macPath)
|
macBytes, err := ioutil.ReadFile(macPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error reading macaroon file: %v",
|
return fmt.Errorf("error reading macaroon file: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
newMac := &macaroon.Macaroon{}
|
newMac := &macaroon.Macaroon{}
|
||||||
if err = newMac.UnmarshalBinary(macBytes); err != nil {
|
if err = newMac.UnmarshalBinary(macBytes); err != nil {
|
||||||
return fmt.Errorf("error unmarshalling macaroon "+
|
return fmt.Errorf("error unmarshalling macaroon "+
|
||||||
"file: %v", err)
|
"file: %w", err)
|
||||||
}
|
}
|
||||||
mac = newMac
|
mac = newMac
|
||||||
|
|
||||||
@ -619,7 +619,7 @@ func (hn *HarnessNode) cleanup() error {
|
|||||||
if hn.Cfg.backupDBDir != "" {
|
if hn.Cfg.backupDBDir != "" {
|
||||||
err := os.RemoveAll(hn.Cfg.backupDBDir)
|
err := os.RemoveAll(hn.Cfg.backupDBDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to remove backup dir: %v",
|
return fmt.Errorf("unable to remove backup dir: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ func signSegWitV0(in *psbt.PInput, tx *wire.MsgTx,
|
|||||||
in.SighashType, privKey,
|
in.SighashType, privKey,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error signing input %d: %v", idx, err)
|
return fmt.Errorf("error signing input %d: %w", idx, err)
|
||||||
}
|
}
|
||||||
in.PartialSigs = append(in.PartialSigs, &psbt.PartialSig{
|
in.PartialSigs = append(in.PartialSigs, &psbt.PartialSig{
|
||||||
PubKey: pubKeyBytes,
|
PubKey: pubKeyBytes,
|
||||||
@ -472,7 +472,7 @@ func signSegWitV1KeySpend(in *psbt.PInput, tx *wire.MsgTx,
|
|||||||
privKey,
|
privKey,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error signing taproot input %d: %v", idx,
|
return fmt.Errorf("error signing taproot input %d: %w", idx,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ func signSegWitV1ScriptSpend(in *psbt.PInput, tx *wire.MsgTx,
|
|||||||
in.WitnessUtxo.PkScript, leaf, in.SighashType, privKey,
|
in.WitnessUtxo.PkScript, leaf, in.SighashType, privKey,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error signing taproot script input %d: %v",
|
return fmt.Errorf("error signing taproot script input %d: %w",
|
||||||
idx, err)
|
idx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ func (i *PsbtIntent) FundingParams() (btcutil.Address, int64, *psbt.Packet,
|
|||||||
// Encode the address in the human-readable bech32 format.
|
// Encode the address in the human-readable bech32 format.
|
||||||
addr, err := script.Address(i.netParams)
|
addr, err := script.Address(i.netParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, nil, fmt.Errorf("unable to encode address: %v",
|
return nil, 0, nil, fmt.Errorf("unable to encode address: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ func (i *PsbtIntent) FundingParams() (btcutil.Address, int64, *psbt.Packet,
|
|||||||
packet, err = psbt.New(nil, nil, 2, 0, nil)
|
packet, err = psbt.New(nil, nil, 2, 0, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, nil, fmt.Errorf("unable to create "+
|
return nil, 0, nil, fmt.Errorf("unable to create "+
|
||||||
"PSBT: %v", err)
|
"PSBT: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
packet.UnsignedTx.TxOut = append(packet.UnsignedTx.TxOut, out)
|
packet.UnsignedTx.TxOut = append(packet.UnsignedTx.TxOut, out)
|
||||||
|
@ -533,12 +533,12 @@ func (r *RPCKeyRing) SignMessageSchnorr(keyLoc keychain.KeyLocator,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
considerShutdown(err)
|
considerShutdown(err)
|
||||||
return nil, fmt.Errorf("error signing message in remote "+
|
return nil, fmt.Errorf("error signing message in remote "+
|
||||||
"signer instance: %v", err)
|
"signer instance: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sigParsed, err := schnorr.ParseSignature(resp.Signature)
|
sigParsed, err := schnorr.ParseSignature(resp.Signature)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't parse schnorr signature: %v",
|
return nil, fmt.Errorf("can't parse schnorr signature: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
return sigParsed, nil
|
return sigParsed, nil
|
||||||
@ -634,7 +634,7 @@ func (r *RPCKeyRing) ComputeInputScript(tx *wire.MsgTx,
|
|||||||
// input.
|
// input.
|
||||||
sig, err := r.remoteSign(tx, signDesc, witnessProgram)
|
sig, err := r.remoteSign(tx, signDesc, witnessProgram)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error signing with remote instance: %v",
|
return nil, fmt.Errorf("error signing with remote instance: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,7 +740,7 @@ func (r *RPCKeyRing) MuSig2CreateSession(bipVersion input.MuSig2Version,
|
|||||||
resp.TaprootInternalKey,
|
resp.TaprootInternalKey,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error parsing internal key: %v",
|
return nil, fmt.Errorf("error parsing internal key: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1261,7 +1261,7 @@ func connectRPC(hostPort, tlsCertPath, macaroonPath string,
|
|||||||
|
|
||||||
certBytes, err := ioutil.ReadFile(tlsCertPath)
|
certBytes, err := ioutil.ReadFile(tlsCertPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error reading TLS cert file %v: %v",
|
return nil, fmt.Errorf("error reading TLS cert file %v: %w",
|
||||||
tlsCertPath, err)
|
tlsCertPath, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1273,7 +1273,7 @@ func connectRPC(hostPort, tlsCertPath, macaroonPath string,
|
|||||||
|
|
||||||
macBytes, err := ioutil.ReadFile(macaroonPath)
|
macBytes, err := ioutil.ReadFile(macaroonPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error reading macaroon file %v: %v",
|
return nil, fmt.Errorf("error reading macaroon file %v: %w",
|
||||||
macaroonPath, err)
|
macaroonPath, err)
|
||||||
}
|
}
|
||||||
mac := &macaroon.Macaroon{}
|
mac := &macaroon.Macaroon{}
|
||||||
@ -1297,7 +1297,7 @@ func connectRPC(hostPort, tlsCertPath, macaroonPath string,
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
conn, err := grpc.DialContext(ctxt, hostPort, opts...)
|
conn, err := grpc.DialContext(ctxt, hostPort, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to connect to RPC server: %v",
|
return nil, fmt.Errorf("unable to connect to RPC server: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3352,7 +3352,7 @@ func (p *Brontide) handleInitMsg(msg *lnwire.Init) error {
|
|||||||
// those presented in the local features fields.
|
// those presented in the local features fields.
|
||||||
err := msg.Features.Merge(msg.GlobalFeatures)
|
err := msg.Features.Merge(msg.GlobalFeatures)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to merge legacy global features: %v",
|
return fmt.Errorf("unable to merge legacy global features: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func newMissionControlStore(db kvdb.Backend, maxRecords int,
|
|||||||
err := kvdb.Update(db, func(tx kvdb.RwTx) error {
|
err := kvdb.Update(db, func(tx kvdb.RwTx) error {
|
||||||
resultsBucket, err := tx.CreateTopLevelBucket(resultsKey)
|
resultsBucket, err := tx.CreateTopLevelBucket(resultsKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot create results bucket: %v",
|
return fmt.Errorf("cannot create results bucket: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ func NewMessageInterceptionRequest(ctx context.Context,
|
|||||||
case proto.Message:
|
case proto.Message:
|
||||||
req.ProtoSerialized, err = proto.Marshal(t)
|
req.ProtoSerialized, err = proto.Marshal(t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot marshal proto msg: %v",
|
return nil, fmt.Errorf("cannot marshal proto msg: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
req.ProtoTypeName = string(proto.MessageName(t))
|
req.ProtoTypeName = string(proto.MessageName(t))
|
||||||
|
10
rpcserver.go
10
rpcserver.go
@ -1919,7 +1919,7 @@ func newPsbtAssembler(req *lnrpc.OpenChannelRequest, normalizedMinConfs int32,
|
|||||||
bytes.NewReader(psbtShim.BasePsbt), false,
|
bytes.NewReader(psbtShim.BasePsbt), false,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error parsing base PSBT: %v",
|
return nil, fmt.Errorf("error parsing base PSBT: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2144,7 +2144,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
|||||||
in.CloseAddress, r.cfg.ActiveNetParams.Params,
|
in.CloseAddress, r.cfg.ActiveNetParams.Params,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error parsing upfront shutdown: %v",
|
return nil, fmt.Errorf("error parsing upfront shutdown: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6513,7 +6513,7 @@ func (r *rpcServer) StopDaemon(_ context.Context,
|
|||||||
// otherwise some funds wouldn't be picked up.
|
// otherwise some funds wouldn't be picked up.
|
||||||
isRecoveryMode, progress, err := r.server.cc.Wallet.GetRecoveryInfo()
|
isRecoveryMode, progress, err := r.server.cc.Wallet.GetRecoveryInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get wallet recovery info: %v",
|
return nil, fmt.Errorf("unable to get wallet recovery info: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
if isRecoveryMode && progress < 1 {
|
if isRecoveryMode && progress < 1 {
|
||||||
@ -7211,7 +7211,7 @@ func (r *rpcServer) ForwardingHistory(ctx context.Context,
|
|||||||
}
|
}
|
||||||
timeSlice, err := r.server.miscDB.ForwardingLog().Query(eventQuery)
|
timeSlice, err := r.server.miscDB.ForwardingLog().Query(eventQuery)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to query forwarding log: %v",
|
return nil, fmt.Errorf("unable to query forwarding log: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8013,7 +8013,7 @@ func (r *rpcServer) FundingStateStep(ctx context.Context,
|
|||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error parsing psbt: %v",
|
return nil, fmt.Errorf("error parsing psbt: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,7 +882,7 @@ func (u *UnlockerService) ChangePassword(ctx context.Context,
|
|||||||
|
|
||||||
err = macaroonService.Close()
|
err = macaroonService.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not close macaroon service: %v",
|
return nil, fmt.Errorf("could not close macaroon service: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ func (n *sessionNegotiator) tryAddress(sessionKey keychain.SingleKeyECDH,
|
|||||||
|
|
||||||
err = n.cfg.DB.CreateClientSession(dbClientSession)
|
err = n.cfg.DB.CreateClientSession(dbClientSession)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to persist ClientSession: %v",
|
return fmt.Errorf("unable to persist ClientSession: %w",
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ func (q *sessionQueue) nextStateUpdate() (*wtwire.StateUpdate, bool,
|
|||||||
hint, encBlob, err := task.craftSessionPayload(q.cfg.Signer)
|
hint, encBlob, err := task.craftSessionPayload(q.cfg.Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO(conner): mark will not send
|
// TODO(conner): mark will not send
|
||||||
err := fmt.Errorf("unable to craft session payload: %v",
|
err := fmt.Errorf("unable to craft session payload: %w",
|
||||||
err)
|
err)
|
||||||
return nil, false, wtdb.BackupID{}, err
|
return nil, false, wtdb.BackupID{}, err
|
||||||
}
|
}
|
||||||
@ -665,7 +665,7 @@ func (q *sessionQueue) sendStateUpdate(conn wtserver.Peer,
|
|||||||
switch {
|
switch {
|
||||||
case err == wtdb.ErrUnallocatedLastApplied:
|
case err == wtdb.ErrUnallocatedLastApplied:
|
||||||
// TODO(conner): borked watchtower
|
// TODO(conner): borked watchtower
|
||||||
err = fmt.Errorf("unable to ack seqnum=%d: %v",
|
err = fmt.Errorf("unable to ack seqnum=%d: %w",
|
||||||
stateUpdate.SeqNum, err)
|
stateUpdate.SeqNum, err)
|
||||||
q.log.Errorf("SessionQueue(%v) failed to ack update: %v",
|
q.log.Errorf("SessionQueue(%v) failed to ack update: %v",
|
||||||
q.ID(), err)
|
q.ID(), err)
|
||||||
@ -673,14 +673,14 @@ func (q *sessionQueue) sendStateUpdate(conn wtserver.Peer,
|
|||||||
|
|
||||||
case err == wtdb.ErrLastAppliedReversion:
|
case err == wtdb.ErrLastAppliedReversion:
|
||||||
// TODO(conner): borked watchtower
|
// TODO(conner): borked watchtower
|
||||||
err = fmt.Errorf("unable to ack seqnum=%d: %v",
|
err = fmt.Errorf("unable to ack seqnum=%d: %w",
|
||||||
stateUpdate.SeqNum, err)
|
stateUpdate.SeqNum, err)
|
||||||
q.log.Errorf("SessionQueue(%s) failed to ack update: %v",
|
q.log.Errorf("SessionQueue(%s) failed to ack update: %v",
|
||||||
q.ID(), err)
|
q.ID(), err)
|
||||||
return err
|
return err
|
||||||
|
|
||||||
case err != nil:
|
case err != nil:
|
||||||
err = fmt.Errorf("unable to ack seqnum=%d: %v",
|
err = fmt.Errorf("unable to ack seqnum=%d: %w",
|
||||||
stateUpdate.SeqNum, err)
|
stateUpdate.SeqNum, err)
|
||||||
q.log.Errorf("SessionQueue(%s) failed to ack update: %v",
|
q.log.Errorf("SessionQueue(%s) failed to ack update: %v",
|
||||||
q.ID(), err)
|
q.ID(), err)
|
||||||
|
@ -136,7 +136,7 @@ func encodeAmount(msat lnwire.MilliSatoshi) (string, error) {
|
|||||||
// Should always be expressible in pico BTC.
|
// Should always be expressible in pico BTC.
|
||||||
pico, err := fromMSat['p'](msat)
|
pico, err := fromMSat['p'](msat)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("unable to express %d msat as pBTC: %v",
|
return "", fmt.Errorf("unable to express %d msat as pBTC: %w",
|
||||||
msat, err)
|
msat, err)
|
||||||
}
|
}
|
||||||
shortened := strconv.FormatUint(pico, 10) + "p"
|
shortened := strconv.FormatUint(pico, 10) + "p"
|
||||||
|
Loading…
Reference in New Issue
Block a user