Commit Graph

920 Commits

Author SHA1 Message Date
positiveblue
e4e0935816
lnrpc/peers: skeleton logic for updateNodeAnnouncement
Basic logic for the endpoint:

- Get the current nodeAnn information
- Calculate modifications
- Apply modifications
- Return changes
2022-04-01 18:36:21 -07:00
Oliver Gugger
c73cf03a55
multi: add p2tr keyspend wallet support 2022-03-24 18:02:38 +01:00
Olaoluwa Osuntokun
4ecd153be2
lnrpc: add new locked balance field for WalletBalance
In this commit, we add a new field to the WalletBalance call that
permits users to account for the set of outputs that may be locked due
to a pending transaction. Without this field any time users locked
outputs for things like PSBT signing, then they disappear from the
WalletBalance call, which may cause a panic.
2022-03-17 16:36:44 -07:00
Olaoluwa Osuntokun
f13399bc49
Merge pull request #6190 from ErikEk/listunspent-deafult-values
walletrpc: add default values to listunspent
2022-03-16 16:16:45 -07:00
Oliver Gugger
7dfe4018ce
multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
bitromortac
45a2dc80c8
autopilot: implement cached ChannelGraph
Using the cached implementation of a ChannelGraph greatly speeds up the
conversion of the channel database to a SimpleGraph.
2022-03-07 11:15:47 +01:00
bitromortac
52d56a8990
lnrpc+autopilot: add graph diameter calculation
* adds a brute force computation of the diameter
* adds a more efficient calculation of the diameter
2022-03-07 11:15:47 +01:00
ErikEk
74db83bbfb walletrpc: add default values to listunspent 2022-02-17 10:05:16 +01:00
Oliver Gugger
13f187046b
multi: fix issues reported by whitespace linter 2022-02-15 16:26:08 +01:00
Oliver Gugger
895a2e497b
multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
ErikEk
ef1eff1058 lnrpc: fix the existing routing fee inaccuracy
When updating the channel routing policy, we encounter an inaccurate
precision error when calculating the routing fee. The issue stems from
the way the IEEE 754 standard works.

The solution here is to add a uint64 parameter (as mentioned in the
issue) and keep the float64 fee_rate parameter but rounding the product
of the base and fee rate.
2022-01-25 15:42:57 -08:00
Dimitris Apostolou
530a2059e5
multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
mads krogh
1e3c05399c lnd+lnrpc: add private status to pendingchannels response 2022-01-18 09:42:14 +01:00
mads krogh
42cebcfe2b lnd: remove unused graph param from createRPCOpenChannel 2022-01-18 09:42:05 +01:00
yyforyongyu
99378b22c3
rpcserver: add closing txid in WaitingCloseChannel 2022-01-07 18:21:02 +08:00
yyforyongyu
3c1c640612
rpcserver: split PendingChannels into three sections
This commit refactors the method PendingChannels for maintenance
purpose.
2022-01-07 16:38:51 +08:00
yyforyongyu
eb11d4866f
rpcserver: add remote balance for pending force close 2021-12-14 03:40:48 +08:00
Bjarne Magnussen
93e5de9306
lnrpc: refactor populating lnrpc.Transaction inside SubscribeTransaction 2021-12-10 08:26:16 +01:00
yyforyongyu
53e02fa83d
rpcserver: expose ChanStatusFlags in pending close
This commit exposes the ChanStatusFlags inside waitingCloseResp such
that the channel close type is exposed.
2021-12-08 04:50:23 +08:00
Olaoluwa Osuntokun
67e18e6089
rpc: optimize DescribeGraph by caching the response
Unfortunately, we can't use the graph cache directly here as it doesn't
include all the information we need, since it only includes the minimal
amount of information needed for path finding.

Instead, we use a simple mutex guarded cache that evicts itself after a
certain interval. The default is set small enough that most users
shouldn't really notice. We also provide a way to disable the cache, and
also disable the cache in the itests.

Fixes https://github.com/lightningnetwork/lnd/issues/1232
2021-11-04 15:30:31 -07:00
Olaoluwa Osuntokun
79406696ad
rpc: optimize GetNetworkInfo by using the channel graph cache 2021-11-04 15:30:29 -07:00
Alex Bosworth
6a1283cf0b
lnrpc: log channel point in coop close warning
Use `Warnf` to include the chanpoint in the warning message instead of printing `%v` to the log
2021-10-22 13:20:55 -07:00
Wilmer Paulino
c9f6d788e2
lnrpc: add new CommitmentType for script enforced leased channels 2021-10-19 18:30:43 -07:00
Olaoluwa Osuntokun
e6c65f1cbd
Merge pull request #5346 from joostjager/custom-messages
lnrpc+peer: custom peer messages
2021-10-18 19:07:39 -07:00
Joost Jager
ade50d0b2c
lnrpc: receive custom message 2021-10-15 17:08:55 +02:00
Joost Jager
ae959b16ae
lnrpc: send custom message 2021-10-15 17:08:53 +02:00
Oliver Gugger
1541b2ef1b
multi: create and list all default internal accounts 2021-10-14 15:42:56 +02:00
Oliver Gugger
a3addcc927
multi: forward SendCoins call over RPC 2021-10-14 15:42:52 +02:00
Oliver Gugger
0e279eb15a
multi: refactor external subserver config
As a preparation for making more and more implementation details
configurable, we add a new ImplementationCfg struct that houses all the
interfaces that can be defined externally.
2021-10-08 12:08:23 +02:00
Oliver Gugger
8b7c88537c
multi: refactor SignDigestCompact into SignMessageCompact
To make it possible to use a remote lnrpc server as a signer for our
wallet, we need to change our main interface to sign the message instead
of the message's digest. Otherwise we'd need to alter the
lnrpc.SignMessage RPC to accept a digest instead of only the message
which has security implications.
2021-10-08 12:06:52 +02:00
Olaoluwa Osuntokun
d630b95c8b
Merge pull request #5777 from orbitalturtle/buf-pass-macaroon
Lnd: Listen for RPC calls on a bufconn
2021-10-07 18:50:58 -07:00
Oliver Gugger
51d19dad87
Merge pull request #5363 from guggero/psbt-no-final-tx
Allow skipping `PsbtFinalize` step during channel funding to support external broadcast
2021-10-04 12:37:51 +02:00
Oliver Gugger
692ea25295
Merge pull request #5642 from guggero/in-memory-graph
In-memory graph cache for faster pathfinding
2021-10-04 11:20:23 +02:00
Oliver Gugger
1608faf199
multi: allow skipping the PSBT finalize step
The FundingPsbtFinalize step is a safety measure that assures the final
signed funding transaction has the same TXID as was registered during
the funding flow and was used for the commitment transactions.
This step is cumbersome to use if the whole funding process is completed
external to lnd. We allow the finalize step to be skipped for such
cases. The API user/script will need to make sure things are verified
(and possibly cleaned up) properly.
2021-10-04 11:17:08 +02:00
Turtle
218fa1e43e
Rpcserver: Add GetAllPermissions function for retrieving permissions for external macaroon baking 2021-10-01 16:51:16 -05:00
Bjarne Magnussen
a5a477e311
lnd: add optional change output index to check reserved wallet balance 2021-10-01 08:21:29 +02:00
eugene
fdcd726f9a
multi: replace DefaultDustLimit with script-specific DustLimitForSize
This commit updates call-sites to use the proper dust limits for
various script types. This also updates the default dust limit used
in the funding flow to be 354 satoshis instead of 573 satoshis.
2021-09-29 13:33:10 -04:00
Oliver Gugger
d6fa912188
multi: further decouple graph
To further separate the channel graph from the channel state, we
refactor the AddrsForNode method to use the graphs's public methods
instead of directly accessing any buckets. This makes sure that we can
have the channel state cached with just its buckets while not using a
kvdb level cache for the graph.
At the same time we refactor the graph's test to also be less dependent
upon the channel state DB.
2021-09-29 17:00:03 +02:00
Andras Banki-Horvath
11cf4216e4
multi: move all channelstate operations to ChannelStateDB 2021-09-29 17:00:03 +02:00
Oliver Gugger
ddea833d31
multi: extract address source into interface
As a preparation to have the method for querying the addresses of a node
separate from the channel state, we extract that method out into its own
interface.
2021-09-29 17:00:03 +02:00
Olaoluwa Osuntokun
884cc0d191
Merge pull request #5768 from priyanshiiit/lookupInvoice
lnd: adds NOT_FOUND status code for LookupInvoice
2021-09-28 14:33:29 -07:00
Oliver Gugger
410606b082
Merge pull request #5797 from guggero/fix-nil-channel
rpcserver: fix nil issue with historical channels
2021-09-28 11:02:12 +02:00
Olaoluwa Osuntokun
7bde1662e2
multi: move breach arbiter and utxo nursery into contractcourt package
In this commit, we take an initial step towards converting the existing
breach arbiter and utxo nursery logic into contract resolvers by moving
the files as is, into the `contractcourt` pacakge.

This commit is primarily move only, though we had to massage some
interfaces and config names along the way to make things compile and the
tests run properly.
2021-09-27 19:10:31 -07:00
Oliver Gugger
e067dc73b7
rpcserver: fix nil issue with historical channels [skip ci]
Fixes #5796.
Some historical channels might not have the forwarding packages
recorded. And since the error might be silenced, the historical channel
might be nil.
2021-09-27 22:26:03 +02:00
yyforyongyu
16f97e6f41
rpcserver: return total num of fwdPkgs in PendingChannels
This commit adds a new field, NumForwardingPackages, in the
PendingChannels RPC response to specify how many forwarding packages the
channel has.
2021-09-23 13:23:13 +08:00
github2k20
2e4318b0ad rpcserver: adds NOT_FOUND status code for LookupInvoice 2021-09-22 14:01:11 +05:30
Oliver Gugger
efe5f6ae90
multi: add RPC middleware interception
With the middleware handler in place, we now need to add a new gRPC
interceptor to the interceptor chain that will send messages to the
registered middlewares for each event that could be of interest to them.
2021-09-20 17:04:29 +02:00
Oliver Gugger
96ea4bf05e
rpcserver+macaroons: extract RawMacaroonFromContext
We'll re-use the code for extracting a macaroon from a request context
later on so we extract it into its own exported function.
2021-09-20 13:05:33 +02:00
ErikEk
46e9481e6c routing: invalid channels updatechanpolicy call 2021-09-15 10:20:49 +02:00
Turtle
72a46b8673
rpcserver: Add flag to BakeMacaroonRequest for allowing external permissions 2021-09-14 16:27:01 -05:00
Turtle
d10a682fa9
macaroons+rpcserver: Add new RPC call for checking macaroon permissions 2021-09-14 16:26:28 -05:00
yyforyongyu
286ca35bf4
rpcserver: check server is started in ExportAllChannelBackups 2021-09-14 07:34:10 +08:00
Bjarne Magnussen
7f53656753
lnd: add DeletePayment to the RPC
The RPC DeletePayment allows deleteing  single payment from its ID. When calling with `FailedHtlcsOnly` set in the request only failed HTLCs of this payment will be deleted.
2021-09-13 12:50:40 +02:00
ErikEk
195e57025b lncli: remove error logs 2021-09-06 19:12:43 +02:00
Andras Banki-Horvath
c5c956bbef
lnrpc: add BatchOpenChannel RPC 2021-09-02 12:13:47 +02:00
Oliver Gugger
37d0d651c4
rpcserver: extract abandonChan method
We'll want to re-use the abandon channel functionality for the batch
funding, as a cleanup in case the funding is aborted before publishing
any transaction.
2021-09-02 12:13:46 +02:00
Olaoluwa Osuntokun
5a9f499dd5
rpc: add new commitment_type field to OpenChannelRequest
This field will be examined later down the stack along with the set of
feature bits to determine if explicit channel commitment type
negotiation is possible or not.
2021-08-30 19:17:28 -07:00
Olaoluwa Osuntokun
00d275d9f0
lnrpc+rpc: expose last ping message received by peer over ListPeers resp 2021-08-25 16:47:17 -07:00
Joost Jager
3f775778c3
channeldb+routing: add tx parameter
Adds an optional tx parameter to ForAllOutgoingChannels and FetchChannel
so that data can be queried within the context of an existing database
transaction.
2021-08-24 13:43:24 +02:00
eugene
d0191cb5ed
rpcserver: validate FinalCltvDelta and CltvLimit for REST
Missed this check in PR #5293.
2021-08-11 15:37:53 -04:00
Oliver Gugger
06a693f10e
lnrpc+rpcserver: add new fully resolved chan update event
This commit adds the new channel update event for a channel that is now
fully resolved to the event subscription RPC.
2021-08-09 13:55:34 +02:00
Oliver Gugger
9138c8abac
multi: rename local and remote chan DBs
As a preparation to not have a local and remote version of the database
around anymore, we rename the variables into what their actual function
is. In case of the RPC server we even directly use the channel graph
instead of the DB instance. This should allow us to extract the channel
graph into its own, separate database (perhaps with better access
characteristics) in the future.
2021-08-04 14:55:50 +02:00
Oliver Gugger
dd749fe580
lnrpc: update grpc-gateway library to v2 2021-07-27 13:09:59 +02:00
Olaoluwa Osuntokun
6a97e6432d
Merge pull request #5419 from LN-Zap/upstream/fix-no-payment-address
lnd: only set payment address if not empty in PaymentRequest
2021-06-24 15:46:41 -07:00
Olaoluwa Osuntokun
1287328678
Merge pull request #5335 from guggero/abandonchannel-no-dev
RPC/CLI: Allow abandonchannel to be used in regular build
2021-06-23 16:05:34 -07:00
Bjarne Magnussen
4d0601c648
lnd: only set payment address if not empty in PaymentRequest 2021-06-22 11:18:29 +02:00
Olaoluwa Osuntokun
9362f5d279
Merge pull request #5364 from guggero/prevent-stop-on-rescan
rpcserver: prevent shutdown during wallet recovery
2021-06-18 14:11:30 -07:00
Olaoluwa Osuntokun
2706f1972f
Merge pull request #5358 from ErikEk/lnrpc-log-connections-to-transaction-subscription-stream
rpcserver: log connections to transaction subscription stream
2021-06-18 14:09:57 -07:00
Olaoluwa Osuntokun
da94cbf1ec
Merge pull request #5200 from champo/send_all_min_confs
sweep,rpc: honor minConfs paramater when SendAll is set
2021-06-18 14:08:45 -07:00
Oliver Gugger
ce9ccd3f14
rpcserver: prevent shutdown during wallet recovery
If the wallet recovery chain rescan was aborted before it finished, the
user would need to remember to use a positive recovery_window value the
next time they unlock the wallet for the rescan to continue. Because
forgetting to do so could lead to an incomplete wallet state (and
therefore potential missing funds) we rather don't allow shutting down
lnd through the RPC while a rescan is in progress.
This won't prevent any user from manually signaling Ctrl+C to kill lnd.
But that user might also check the log and see there's still something
going on that's preventing lnd from shutting down.
2021-06-07 13:15:10 +02:00
ErikEk
70901dc157 rpcserver: log connections to transaction subscription stream 2021-06-05 23:09:29 +02:00
Oliver Gugger
2e9dd0bcf2
lnrpc+rpcserver: allow abandonchannel to be used in regular build
An often requested feature is to use the abandonchannel API in regular
builds and not only dev builds to get rid of stuck channels that had
their funding transaction invalidated.
The initial reason for putting the call behind the build flag was a
safety concern to make sure nobody uses this on active channels by
accident.
2021-05-26 22:51:41 +02:00
Oliver Gugger
3f2d4f108d
rpcserver: check router state only if it is validating
Fixes #5325.
Corrects a problem introduced in #5281 that caused the synced_to_chain
flag in the GetInfo call to never become true when the router subsystem
is running in Neutrino mode (channel validation turned off).
2021-05-25 09:45:48 +02:00
Oliver Gugger
3a5a03fa49
rpcserver: add nil check to policy ordering
Fixes #5301.
This was introduced with #5295. Since either policies can be nil, we
need to always check that first.
2021-05-18 21:17:09 +02:00
Conner Fromknecht
5305854c2b
Merge pull request #5295 from wpaulino/getnodeinfo-policy-order
rpc: fix policy order for GetNodeInfo
2021-05-14 12:16:47 -07:00
Olaoluwa Osuntokun
7ab5906093
Merge pull request #5245 from bhandras/kvdb_module
kvdb: make kvdb a top level submodule to allow dependency in other projects
2021-05-13 15:59:20 -07:00
eugene
a70d0bef34
multi: validate payment params at RPC layer
With this patch, we'll fail out earlier in the cycle in case of
some wonky parameters, and not leave zombie payments in the router
which currently are not cleaned up.
2021-05-13 17:17:52 -04:00
Wilmer Paulino
b01437d24e
rpc: fix policy order for GetNodeInfo
GetNodeInfo retrieves the policies for every edge the node belongs to.
When these policies are retrieved from the database, they're returned
in the following order: the first policy is the outgoing policy from the
node, and the second is the incoming policy to the node. This ordering
is not consistent with the ordering we have within our other RPCs like
GetChanInfo and DescribeGraph, where policies are sorted based on the
smaller public key of the nodes within an edge.

We fix this by maintaining the same order as our other RPCs.
2021-05-12 18:24:38 -07:00
Conner Fromknecht
2be874f340
lnrpc: add IsAmp to Invoice 2021-05-10 16:55:17 -07:00
Conner Fromknecht
6a7d3c4b5e
lnrpc+rpcserver: thread GenAmpInvoiceFeatures to invoicesrpc 2021-05-10 16:55:17 -07:00
Oliver Gugger
ea4ef204a0
rpcserver: add router synced to synced_to_chain flag
The router has a lot of work to do for each block. So it might be
possible that it isn't yet up to date with the most recent block,
even if the wallet is. This can happen in environments with high CPU
load (such as parallel itests). Since the `synced_to_chain` flag in
the response of this call is used by many wallets (and also our
itests) to make sure everything's up to date, we add the router's
state to it. So the flag will only toggle to true once the router was
also able to catch up.
2021-05-10 16:46:28 +02:00
Andras Banki-Horvath
14c851c8fc
kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
Andras Banki-Horvath
dd14947154
lint: silence depreciation warnings 2021-05-04 17:33:14 +02:00
Johan T. Halseth
f07c9d002c
routing: use Identifier in place of PaymentHash
Since we want to support AMP payment using a different unique payment
identifier (AMP payments don't go to one specific hash), we change the
nomenclature to be Identifier instead of PaymentHash.
2021-04-27 09:47:23 +02:00
Olaoluwa Osuntokun
bfcaf02f04
Merge pull request #4905 from LN-Zap/feat/spend-unconfirmed-estimate
Support spend_unconfirmed in EstimateFee and FundPsbt
2021-04-26 15:48:11 -07:00
Tom Kirkpatrick
2f80283ec2
rpc: minConfs and spendUnconfirmed for EstimateFee 2021-04-22 20:35:51 +02:00
Tom Kirkpatrick
03b55446b5
refactor: use camel case for minConfs 2021-04-22 20:35:00 +02:00
whythat
1adeb41a9d rpcserver+lnrpc: make Subscribe RPCs context aware
This commit makes all the Subscribe RCP's context aware so that they
stop executing when the request context is cancelled.
2021-04-22 07:49:29 +02:00
Olaoluwa Osuntokun
7b589e5811
routing: add strict zombie pruning as a config level param
In this commit, we add strict zombie pruning as a config level param.
This allow us to add the option for those that want a tighter graph, and
not change the default composition of the channel graph for most users
over night.

In addition, we expand the test case slightly by testing that the self
node won't be pruned, but also that if there's a node with only a single
known stale edge, then both variants will prune that edge.
2021-04-21 13:56:27 -05:00
Juan Pablo Civile
09c4ff509d sweep,rpc: honor minConfs paramater when SendAll is set 2021-04-12 15:58:43 -03:00
Pierre Rochard
99cba51849 rpcserver+lnrpc: make graph node addresses consistent
This commit adds a []*lnrpc.NodeAddress typed node_addresses field
on the NodeUpdate message of SubscribeChannelGraph to mirror the
addresses field in the LightningNode message of DescribeGraph.

Fixes https://github.com/lightningnetwork/lnd/issues/4084
2021-04-09 11:29:22 -05:00
GameXG
f980bc38f1 fix #5179 extractPaymentIntent null pointer
payIntent.paymentAddr has not been initialized.
2021-04-07 10:41:31 +08:00
Wilmer Paulino
cb3e179eaf
rpc: break down wallet balance by accounts 2021-04-05 15:41:12 -07:00
Wilmer Paulino
a7211b34c3
rpc: expose account parameter for several wallet RPCs 2021-04-05 15:41:07 -07:00
Wilmer Paulino
f91e7cde59
lnwallet: expose optional account filter for several WalletController methods 2021-04-05 15:41:06 -07:00
Wilmer Paulino
f38bf4d7fa
lnwallet: expose required account parameter for WalletController methods 2021-04-05 15:41:05 -07:00
yyforyongyu
9d0d88ac21
lnrpc+lncli: deprecate sat_per_byte and add sat_per_vbyte
This commit deprecates/replaces the old field `sat_per_byte` with
`sat_per_vbyte`. While the old field suggests sat per byte, it’s
actually using sat per virtual byte. We use the Hidden param to hide all
the deprecated flags. These flags won't show up in help menu onwards,
while stay valid that can be passed from cli. Thus bash scripts
referencing these fields won't be broken.
2021-03-26 17:16:40 +08:00
Olaoluwa Osuntokun
b4b7f29724
Merge pull request #5102 from yyforyongyu/fix-send-cli
lncli+lnrpc: add payment address to sendpayment
2021-03-24 18:02:53 -07:00
Alex Bosworth
61f79d890c
rpcserver: revert target conf to previous behavior
Previously the rpcserver would not use the remote conf target as its local conf target and this behavior is desirable.
2021-03-19 18:43:07 -07:00
Hampus Sjöberg
ada1bc701c signal: handle shutdown properly
This addresses issues related to the mobile lnd builds, where
calling `stopDaemon` and subsequently calling LndMobile's `Start`
results in crash.
2021-03-18 12:54:25 +01:00