Commit Graph

413 Commits

Author SHA1 Message Date
Joost Jager
b09adc3219
lnrpc+routing: add edges and nodes restrictions to query routes
This commit allows the execution of QueryRoutes to be controlled using
lists of black-listed edges and nodes. Any path returned will not pass
through the edges and/or nodes on the list.
2019-03-06 15:30:57 +01:00
Olaoluwa Osuntokun
65cdb1294e
rpc: recognize the new unused prefix address types 2019-03-05 15:35:28 -08:00
Olaoluwa Osuntokun
3be894bc28
Merge pull request #2702 from MDrollette/inactive-overflow
rpcserver: prevent overflow in channel count
2019-03-05 14:56:51 -08:00
Matt Drollette
1664617874 rpcserver: prevent overflow in channel count 2019-03-01 13:06:27 -06:00
Johan T. Halseth
772930343d
rpcserver: make listchannels debug log 2019-02-27 12:38:54 -03:00
Olaoluwa Osuntokun
5d1eaaffa4
lnrpc: rename MaxHtlc to MaxHtlcMsat in lnrpc.RoutingPolicy
In this commit, we rename the new `MaxHtlc` field to `MaxHtlcMsat`. We
do this in order to adhere to the new practice to suffix each amount
related field with their proper unit.
2019-02-25 12:49:47 -03:00
Valentine Wallace
675a8b2d9e rpcserver: include max htlc in DescribeGraph response 2019-02-21 18:39:32 -08:00
Valentine Wallace
0c6c1040d8 routing/ntfns+rpcserver: include max htlc in topology notifications 2019-02-21 18:39:32 -08:00
Olaoluwa Osuntokun
88252d759b
config: add sub-server config parsing logic for the new Router service 2019-02-20 16:10:43 -08:00
Conner Fromknecht
34e36e9daa
lnrpc+rpcserver: rename ScriptPubkey to PkScript on Utxo msg 2019-02-11 13:02:25 -08:00
Joost Jager
7c30a8c493
routing: add outgoing channel restriction 2019-02-08 23:05:56 +01:00
Olaoluwa Osuntokun
9c940746a7
rpc: fix regression in SendToRouteSync payment hash parsing
A recent change in this area of the codebase refactored some code to
make way for the deprecation of the streaming multi-route `SendToRoute`
method. Along the way, it removed the parsing of the `PaymentHashString`
field for the sync `SendToRouteSync` which is meant to be used via the
REST interface. In this commit, we fix this by populating _both_
`PaymentHash` and `PaymentHashString`. This is OK, as
`extractPaymentIntent` will check both values to extract the hex-encoded
payment hash if it's specified.
2019-02-06 15:48:23 -08:00
Valentine Wallace
ff0339a186 rpcserver: implement SubscribeChannels RPC call. 2019-02-05 18:18:06 -08:00
Valentine Wallace
b0b6151cc1 rpcserver: add helper functions to format open and closed RPC channels.
`createRPCChannel` is used by the `listchannels` RPC call and will be
used by `subscribechannels` as well.
`createRPCClosedChannel` is used by the `closedchannels` RPC call and
will also be used by `subscribechannels`.

This is used by the `listchannels` RPC call and will be used by
`subscribechannels` as well. Its purpose is to mitigate code duplication
between the two RPC calls.
2019-02-05 18:17:54 -08:00
Joost Jager
17645fefdf
lnrpc: deprecate multiple routes sendtoroute 2019-02-04 13:07:30 +01:00
Joost Jager
5a4951affd
lnrpc: extract sendtoroute unmarshall to method 2019-02-04 13:06:58 +01:00
Conner Fromknecht
c74dcbe6ff
lnrpc+rpcserver: replace ChanPoint w/ OutPoint in Utxo msg 2019-02-01 18:01:51 -08:00
Olaoluwa Osuntokun
4af857f0c6
Merge pull request #2356 from joostjager/invoices-subserver
invoices: add subscribesingleinvoice
2019-02-01 17:19:58 -08:00
Joost Jager
70c874be88
invoicesrpc: add SubscribeSingleInvoice rpc 2019-02-01 09:43:17 +01:00
Joost Jager
4c4536a488
lnrpc: move invoice marshall code to package
As a preparation for reusing the marshall code in the invoices sub
server.
2019-02-01 09:43:10 +01:00
Joost Jager
acb0162443
invoices: subscribe single invoice 2019-02-01 09:43:03 +01:00
Joost Jager
3545685177
invoicesrpc: create sub server
Sub server implementation is still empty. This is a preparatory
step for adding invoice functionality.
2019-02-01 09:42:35 +01:00
Joost Jager
55aee9c703
cnct: expose non-incubating htlcs after channel force close
In this commit we fix a reporting gap that previously existed for htlcs
that were still contested.
2019-02-01 09:36:47 +01:00
Joost Jager
5c03a0db99
lnrpc: extract setting force close info to method 2019-02-01 09:10:17 +01:00
Joost Jager
9e012ecc93
multi: move Input interface and related code
This commit is a step to split the lnwallet package. It puts the Input
interface and implementations in a separate package along with all their
dependencies from lnwallet.
2019-01-31 13:25:33 +01:00
Olaoluwa Osuntokun
4fd1f832d7
contractcourt+rpc: use new FetchChannel method instead of scanning
In this commit, we modify areas where we need to force close a channel
to use the new FetchChannel method instead of manually scanning. This
dramatically reduces the CPU usage when doing things like closing a
large number of channels within lnd.
2019-01-28 20:24:45 -08:00
Olaoluwa Osuntokun
e2285732e4
Merge pull request #2460 from halseth/max-htlc-size-pickup
Support the max_htlc field from ChannelUpdates
2019-01-22 18:54:38 -08:00
Valentine Wallace
0fd6004958
multi: partition lnwire.ChanUpdateFlag into ChannelFlags and MessageFlags
In this commit:

* we partition lnwire.ChanUpdateFlag into two (ChanUpdateChanFlags and
ChanUpdateMsgFlags), from a uint16 to a pair of uint8's

* we rename the ChannelUpdate.Flags to ChannelFlags and add an
additional MessageFlags field, which will be used to indicate the
presence of the optional field HtlcMaximumMsat within the ChannelUpdate.

* we partition ChannelEdgePolicy.Flags into message and channel flags.
This change corresponds to the partitioning of the ChannelUpdate's Flags
field into MessageFlags and ChannelFlags.

Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2019-01-22 08:42:26 +01:00
Wilmer Paulino
552b71c620
rpcserver: forward gRPC proxy requests to localhost when listening on all interfaces
This prevents certificate issues when accessing the gRPC REST proxy externally.
2019-01-21 16:07:19 -08:00
Olaoluwa Osuntokun
114f0a8918
rpc: populate new initiator field in ListChannels response 2019-01-15 16:51:35 -08:00
Olaoluwa Osuntokun
509bed614c
Merge pull request #2198 from Roasbeef/sendall-rpc
multi: add ability to sweep all coins in the the wallet to an addr to sendcoins
2019-01-15 14:49:17 -08:00
ccdle12
264293ff89 rpcserver+lnd_test: adding PendingHtlcs to UnsetteldBalance
rpcserver: summing PendingHtlcs and assigning to UnsettledBalance

lnd_test: adding tests for UnsettledBalance
2019-01-10 22:11:38 -05:00
Conner Fromknecht
eb1167cc52
Merge pull request #2418 from cfromknecht/connectpeer-logging
rpcserver: add connectpeer log, fix existing formatting
2019-01-10 13:51:48 -08:00
Olaoluwa Osuntokun
3a7b9c8367
rpc: implement new feature of sendcoins to sweep all wallet UTXOs
In this commit, we implement the new feature which allows sendcoins to
sweep all the coins in the wallet. We use the new sweep.CraftSweepAllTx
method, and also use WithCoinSelectLock to ensure that we don't trigger
any double-spend errors triggered by coin selection race conditions.
2019-01-09 15:55:26 -08:00
Olaoluwa Osuntokun
4b316d97c8
lnwallet: add new WithCoinSelectLock method to fix coin select race conditions
In this commit, we add a new method WithCoinSelectLock. This method will
allow us to fix bugs in the project atm that can arise if a channel
funding is attempted (either manually or by autopilot) while a users is
attempting to send an on-chain transaction. If this happens
concurrently, then both contexts will grab the set of UTXOs and attempt
to lock them one by one. However, since they didn't obtain an exclusive
snapshot of the UTXO set of the wallet, they may both attempt to lock
the same input.

We also ensure that calls to SendMany cannot run into this issue by
using the WithCoinSelectLock synchronization when attempting to instruct
the internal wallet to send payments.
2019-01-09 15:55:24 -08:00
Olaoluwa Osuntokun
73c9c2ee15
sweep+cnct+nursery+rpc: extract DetermineFeePerKw to func, add FeePreference
In this commit, we extract the existing determineFeePerKw method on the
RPC server into a new file in the sweep package. Along the way, we
consolidate code by introducing a new FeePreference struct, which allows
the caller to express their fee preference either in blocks to
confirmation, or a direct fee rate. This move takes a small step to
father decoupling calls in the main RPC server.
2019-01-09 15:55:17 -08:00
Olaoluwa Osuntokun
4ac54dce25
Merge pull request #2355 from joostjager/move-invoices
invoices: create package
2019-01-07 16:56:22 -08:00
Joost Jager
649408003d
lnrpc: expose network name in GetInfo
Previously only a testnet boolean was available which
made it impossible to distinguish between regtest and
mainnet.
2019-01-08 00:17:14 +01:00
Joost Jager
c1eaf60000
invoices: create package
This commit isolates the invoice registry in a separate package. It is
a preparation for the creation of an invoices sub server.
2019-01-07 23:04:05 +01:00
Conner Fromknecht
3a2bd124ae
rpcserver: add connectpeer log, fix existing formatting 2019-01-04 14:07:43 -08:00
Joost Jager
1199f17cd9
lnrpc: report invoice state
Expose the new invoice state field over rpc.
2019-01-04 07:54:14 +01:00
Joost Jager
5515713b88
channeldb: convert settled boolean to state
This commit is a preparation for the addition of new invoice
states. A database migration is not needed because we keep
the same field length and values.
2019-01-04 07:53:55 +01:00
Joost Jager
6c027e2bc9 htlcswitch: remove lnrpc dependency
This commits removes an unwanted dependency that prevents
moving parts of rpcserver to a sub server.
2019-01-03 09:07:56 +01:00
Olaoluwa Osuntokun
a9cba330e8
Merge pull request #2222 from ErikEk/invoice_show_private
Invoices with --private marked as such on LookupInvoice
2018-12-17 20:23:13 -08:00
Sev
bd8046ca5c lnrpc: add FeeMsat to ForwardingEvent 2018-12-17 20:13:02 -08:00
Olaoluwa Osuntokun
fa160f559c
multi: replace per channel sigPool with global daemon level sigPool
In this commit, we remove the per channel `sigPool` within the
`lnwallet.LightningChannel` struct. With this change, we ensure that as
the number of channels grows, the number of gouroutines idling in the
sigPool stays constant. It's the case that currently on the daemon, most
channels are likely inactive, with only a hand full actually
consistently carrying out channel updates. As a result, this change
should reduce the amount of idle CPU usage, as we have less active
goroutines in select loops.

In order to make this change, the `SigPool` itself has been publicly
exported such that outside callers can make a `SigPool` and pass it into
newly created channels. Since the sig pool now lives outside the
channel, we were also able to do away with the Stop() method on the
channel all together.

Finally, the server is the sub-system that is currently responsible for
managing the `SigPool` within lnd.
2018-12-16 15:40:14 -08:00
Johan T. Halseth
8754635de5
rpcsercer+subservercfg: populate autopilot RPC config 2018-12-13 12:33:45 +01:00
Olaoluwa Osuntokun
f55e81a2d4
Merge pull request #2319 from Roasbeef/chan-point-fix
rpcserver: ensure ChannelPoint is set in CloseChannel
2018-12-12 15:27:30 -08:00
Olaoluwa Osuntokun
dc7c59746e
rpcserver: style related changes to listunspent 2018-12-11 16:29:11 -08:00
Olaoluwa Osuntokun
530eadd11c
rpcserver: ensure ChannelPoint is set in CloseChannel
Fixes #2317.
2018-12-11 15:56:00 -08:00