Commit Graph

694 Commits

Author SHA1 Message Date
Conner Fromknecht
97d8be7f6a
rpcserver: query and set num_zombie_chans in NetworkInfo resp 2019-07-16 16:32:27 -07:00
ccdle12
a93d63f04b
lnrpc+rpcserver: Adding last_update timestamp to RoutingPolicy
lnrpc/rpc.proto: updates RoutingPolicy last_update number

rpcserver: adding LastUpdate field to marshalDbEdge

This commit adds a LastUpdate field to each RoutingPolicy, it will show
the time each RoutingPolicy was updated.

lnrpc: regenerating proto files
2019-07-11 07:44:28 +01:00
Roei Erez
404abcbd04 rpc: add channel reserve fields in RPC responses.
In this commit two fields were added to the Channl RPC result in both
open and pending states.
The fields: local_chan_reserve, remote_chan_reserve represents the
reservation the nodes are rquired to keep in both sides of the channel.
This is usefull when calculating the "real" inbound and outbound
liquidity in an accurate way.
2019-07-11 00:03:20 +03:00
Johan T. Halseth
7a5247b766
Merge pull request #3245 from breez/non_static_permissions
rpc: fix calculating RPC permissions.
2019-07-10 13:33:54 +02:00
Roei Erez
46489050ef rpc: make RPC permissions non static.
This commit fixes a but where restarting LND at the same process causes
It to fail.
The problem resides in the fact that an array of permissions is
initialized as a package variable and when creating the
RPCServer all subserver permissions are appended while checking for
duplicates.
On subsequent restart this array is left over from the previous run and
being populated again with the same permissions causing a duplicate
error.
The solution is simple, just to extract out the initial permissions to
a separate function and call it from the context is is needed.
2019-07-10 13:10:24 +03:00
Wilmer Paulino
f819002b7a
Merge pull request #1933 from yaslama/transactions-addresses
Add addresses to transactions returned by SubscribeTransactions
2019-07-10 02:34:31 -07:00
Johan T. Halseth
25375d603c
Merge pull request #3246 from tyzbit/fwdinghistory_3240
rpcserver: ForwardingHistory end_time defaults to time.Now()
2019-07-10 09:56:00 +02:00
Yaacov Akiba Slama
46a611cd90 Add DestAddresses field in transactions returned by SubscribeTransactions 2019-07-10 09:40:41 +03:00
carla
af10009c93 lnrpc: Deprecate fee field in payment struct 2019-07-09 09:58:20 -04:00
tyzbit
d9179bee91 rpcserver: ForwardingHistory end_time defaults to time.Now()
In this commit we change the default behavior
of end_time when calling ForwardingHistory.
end_time now defaults to time.Now()
2019-07-08 18:18:35 -04:00
Johan T. Halseth
8b83f03308
rpcserver+router: log terminal sendPayment error 2019-07-01 16:22:57 -07:00
Olaoluwa Osuntokun
c68f747b4f
Merge pull request #3227 from 2xic/issue_3074
lnd: reject custom fee when force closing channel
2019-06-28 13:37:21 -07:00
2xic
fcaf8c029b lnd: reject custom fee when force closing channel 2019-06-21 11:14:13 +02:00
Conner Fromknecht
59c9418eca
lnd+rpcserver: thread watchtower into subserver configs 2019-06-20 17:04:04 -07:00
Olaoluwa Osuntokun
b89b27e6ef
Merge pull request #3212 from cfromknecht/getnodeinfo-hide-chans-default
rpcserver: hide channels in getnodeinfo by default
2019-06-18 17:24:20 -07:00
Olaoluwa Osuntokun
df53c32489
Merge pull request #3139 from Roasbeef/zero-fees
rpc: update updatechanpolicy to allow zero fees
2019-06-17 18:16:38 -07:00
Conner Fromknecht
0adc45ab5a
rpcserver: wrap closure args to 80 chars 2019-06-17 11:09:27 -07:00
Conner Fromknecht
a1a3290bda
rpcserver: conditionally include channels in GetNodeInfoResponse 2019-06-17 11:08:44 -07:00
Conner Fromknecht
8ab56b2a5c
rpcserver: add missing channelbalance log 2019-06-13 19:54:20 -07:00
Olaoluwa Osuntokun
d333b2d981
lnrpc: rename non_succeeded to include_incomplete 2019-06-13 16:01:10 -07:00
Johan T. Halseth
0aec3fd230
rpcserver: filter out non-suceeded payments, include payment status
Earlier versions of ListPayments only included completed payments. We
return to this behavior by ignore all other payments if the nonSucceeded
boolean is not set in the request.
2019-06-12 08:57:47 +02:00
Olaoluwa Osuntokun
89f6db11e6
Merge pull request #3134 from valentinewallace/grpc-perf-interceptor
Add gRPC performance Prometheus exporter.
2019-06-12 06:41:14 +02:00
Olaoluwa Osuntokun
faf0dc3d81
Merge pull request #3174 from Roasbeef/raw-tx-hex-get-transactions
multi: add raw tx hex to GetTransactions response
2019-06-12 06:08:34 +02:00
Olaoluwa Osuntokun
1185c48f58
rpc: set new raw tx hex in SubscribeTransactions resp 2019-06-11 20:58:37 -07:00
Valentine Wallace
f5eeb05e0a
rpcserver+monitoring/config: enable Prometheus monitoring.
Start the Prometheus exporter in rpcserver.go if monitoring is enabled through the
build tag. Also allow users to specify what address they want the Prometheus
exporter to be listening on.
2019-06-11 11:26:09 -07:00
Joost Jager
2e920de292
routing+lnrpc: move default payment timeout out of router
This commit moves the default timeout out of router and thereby fixes a
bug that caused SendToRoute to not return the actual error, but a
timeout result instead. SendToRoute only tries a single route, so a
timeout should never happen.
2019-06-11 08:36:17 +02:00
Olaoluwa Osuntokun
414f501e2b
rpc: set new RawTxHex field in GetTransactions response 2019-06-07 07:38:02 -07:00
Wilmer Paulino
d01f88ecdc
lnrpc/walletrpc: expose pending input sweeps within UtxoSweeper over RPC 2019-06-05 12:10:33 -07:00
Joost Jager
f03533c67a
routerrpc: convert sendpayment to async
Modify the routerrpc SendPayment api to asynchronous. This allows
callers to pick up a payment after the rpc connection was lost or lnd
was restarted.
2019-06-05 12:41:53 +02:00
Joost Jager
eb700d35e1
routerrpc: extend payment request parameters
Add missing parameters to routerrpc version of SendPayment.
2019-06-05 12:41:45 +02:00
Joost Jager
19d5f8f82c
routing: move default cltv assignment out of router
This commit lifts default setting up to the rpc server level, in line
with other payment defaults.
2019-06-05 12:41:43 +02:00
Joost Jager
afd86763ac
lntypes: add ZeroHash 2019-06-05 12:41:41 +02:00
Joost Jager
68f2a04f42
routerrpc: expose mission control reset rpc 2019-06-04 10:00:17 +02:00
Olaoluwa Osuntokun
281f6daccb
rpc: update updatechanpolicy to allow zero fees
Fixes #3138.
2019-05-30 16:29:36 -07:00
Conner Fromknecht
7960849995
rpcserver: thread payreq to PaymentCreationInfo 2019-05-29 16:31:32 -07:00
Joost Jager
dff0387363
lntest: move itest into package 2019-05-28 21:43:23 +02:00
Olaoluwa Osuntokun
19fafd7a9a
Merge pull request #2761 from halseth/reliable-payments-router-state-machine
[reliable payments] router payment state machine
2019-05-27 16:46:19 -07:00
Johan T. Halseth
de1bf8a518
routing/router: persist payment state machine
This commit makes the router use the ControlTower to drive the payment
life cycle state machine, to keep track of active payments across
restarts.  This lets the router resume payments on startup, such that
their final results can be handled and stored when ready.
2019-05-27 20:18:58 +02:00
Johan T. Halseth
1788fa1566
rpcserver: print unconfirmed balance, add TODO for racy balance 2019-05-27 09:29:02 +02:00
chokoboko
51dc422721 rpcserver: add channels to GetNodeInfo response 2019-05-23 16:03:39 +03:00
Xavi Soler
f4f3cea9a6
rpcserver: include color to getinfo and topology update 2019-05-23 10:52:18 +02:00
Johan T. Halseth
15bed506b1
routing/route+multi: remove redundant TotalFees field
Instead get it on demand using method TotalFees().
2019-05-16 23:58:32 +02:00
Joost Jager
d55a8b7b29
channel+cnct: remove preimage from channel and resolution
Now that the success resolver preimage field is always populated by the
incoming contest resolver, preimage lookups earlier in the
process (channel and channel arbitrator) can mostly be removed.
2019-05-15 14:41:49 +02:00
Joost Jager
b2eb2619bf
routerrpc: connect UnmarshallRoute to existing config fields 2019-05-15 11:54:46 +02:00
Joost Jager
ba3fa94268
lnrpc+routing: Only accept a single route for SendToRoute 2019-05-15 11:54:46 +02:00
Joost Jager
0b66d56aab
routerrpc: move UnmarshallRoute to sub server 2019-05-13 12:55:56 +02:00
Joost Jager
7a5bd29a69
lnrpc+routing: remove k shortest path finding 2019-05-07 19:54:06 +02:00
Conner Fromknecht
17b2140cb5
multi: fix spelling mistakes 2019-05-04 15:35:37 -07:00
Johan T. Halseth
ee257fd0eb
multi: move Route to sub-pkg routing/route 2019-04-29 14:52:33 +02:00
Johan T. Halseth
b53899c43c
lnd: rename package main->lnd 2019-04-23 20:57:33 +02:00
ccdle12
c46457fb5b
rpcserver+lnd_test: adding check in SendCoins to prevent txs sent to pubkeys 2019-04-20 10:12:20 +08:00
Johan T. Halseth
0310d8f2b4
rpcserver: demote newaddress log to debug, log addr type 2019-04-10 09:08:36 +02:00
Olaoluwa Osuntokun
46aa8503b2
Merge pull request #2892 from wpaulino/verify-chan-backup
rpc: modify VerifyChanBackup to take either a Single or Multi
2019-04-05 14:31:37 -07:00
Wilmer Paulino
b71bb9400a
rpc: modify VerifyChanBackup to take either a Single or Multi 2019-04-05 12:51:16 -07:00
Joost Jager
cf42719c45
lnd+rpcserver: refactor TLS configuration
This commit restructures the creation of various tls related object. It
also fixes a bug where wildcard IP addresses where only instantiated for
the main RPC server and not the WalletUnlocker service.
2019-04-04 14:18:18 -07:00
Wilmer Paulino
ca01695330
rpc: expose peer's GossipSyncer sync type 2019-04-03 15:44:47 -07:00
Olaoluwa Osuntokun
ead8aed6d6
rpc: implement new VerifyChanBackup command 2019-03-28 17:54:02 -07:00
Olaoluwa Osuntokun
26f6fd7db2
contractcourt: ignore all other dispatch cases in closeObserver when recovered chan
In this commit, we modify the `closeObserver` to fast path the DLP
dispatch case if we detect that the channel has been restored. We do
this as otherwise, we may inadvertently enter one of the other cases
erroneously, causing us to now properly look up their dlp commitment
point.
2019-03-28 17:54:00 -07:00
Olaoluwa Osuntokun
019ec2df6b
rpcserver: implement the SubscribeChannelBackups RPC method 2019-03-28 17:53:35 -07:00
Olaoluwa Osuntokun
1d7e42af0a
rpc: implement new SCB related RPC calls 2019-03-28 17:53:28 -07:00
ccdle12
abfbdf6aec rpcserver: check for compatible network in SendCoins
lnd_test: adding address validation for send coins

The commit adds a test that checks that when a user calls sendcoins, the
receiving address is validated according to the current network. If the
address is not compatible with the current network, it will return an
error to the user.

rpcserver: adding a check for compatible network in SendCoins

This commit adds a check in SendCoins that checks whether the receiving
address is compatible with the current network.

Fixes #2677.
2019-03-28 16:42:44 -07:00
Olaoluwa Osuntokun
fff003f92e
Merge pull request #2832 from caldon/avg-out-degree-fix
rpcserver: correct avg degree in GetNetworkInfo
2019-03-27 18:11:57 -07:00
Olaoluwa Osuntokun
a069e78b74
Merge pull request #2797 from halseth/autopilot-prefattach-small-chan-penalize
[autopilot] penalize small channels in preferantial attachment heuristic
2019-03-27 18:09:31 -07:00
Johan T. Halseth
ec70965c8a
Merge pull request #2824 from wpaulino/chanid-openchannel
rpcserver: retrieve Channel ChanId from OpenChannel record
2019-03-27 15:29:46 +01:00
Johan T. Halseth
d6d66e631a
rpcserver: calculate and populate medianChanSizeSat in NetworkInfo 2019-03-27 15:06:30 +01:00
Johan T. Halseth
4d8100cc9a
Merge pull request #2640 from joostjager/cltv-limit
routing: add cltv limit
2019-03-27 10:05:02 +01:00
Ondrej Calda
7fe2f9e2a5
rpcserver: correct avg degree in GetNetworkInfo
Average degree of graph is calculated as twice the number of edges devided by number of vertices
2019-03-24 13:22:15 +01:00
Wilmer Paulino
c0977c95df
rpcserver: retrieve Channel ChanId from OpenChannel record
This is a better alternative than retrieving it from the graph as it's
possible that the channel is pruned from it doing to not having any
updates within the past two weeks.
2019-03-22 12:25:31 -07:00
Joost Jager
087de7cc4d
routerrpc: adapt to changed interfaces of routing subsystem 2019-03-21 10:25:55 +01:00
John Griffith
acb8fd4796
lnrpc: add payment cltv limit 2019-03-19 10:36:54 +01:00
Johan T. Halseth
1e2af38f5a
lnrpc+rpcserver: define and implement EstimateFee RPC 2019-03-15 23:47:13 +01:00
Joost Jager
fcdc8f0e83
lnrpc/invoices: add hold invoice rpc 2019-03-15 10:08:58 +01:00
Joost Jager
8392f6d28f
lnrpc/invoicesrpc: remove lnrpc type from add invoice 2019-03-15 10:08:52 +01:00
Joost Jager
b9cc165341
lnrpc: move add invoice logic to subserver 2019-03-15 10:08:49 +01:00
Joost Jager
2be1051fb6
zpay32: move HopHint and DefaultFinalCLTVDelta 2019-03-15 10:08:32 +01:00
Olaoluwa Osuntokun
ad8849056b
Merge pull request #2497 from joostjager/querysingleroute
lnrpc: deprecate QueryRoutes with more than one route
2019-03-12 21:15:18 -07:00
chokoboko
69d3c47d22 multi: inspect missed errors in scoped if statements 2019-03-11 13:23:21 -07:00
Joost Jager
293971cd03
routerrpc: move query routes into sub server
This commit moves the query routes backend logic from the main
rpc server into the sub server. It is another step towards splitting up
the main rpc server code.

In addition to this, a unit test is added to verify rpc parameter
parsing.
2019-03-11 09:56:16 +01:00
Joost Jager
c62c9d64da
routing: add source parameter to query routes
This commit allows execution of QueryRoutes from any source node.
Previously this was restricted to only the self node.
2019-03-06 15:31:03 +01:00
Joost Jager
7719bc432f
routing: take Vertex types as path finding source and target nodes
Currently public keys are represented either as a 33-byte array (Vertex) or as a
btcec.PublicKey struct. The latter isn't useable as index into maps and
cannot be used easily in compares. Therefore the 33-byte array
representation is used predominantly throughout the code base.

This commit converts the argument types of source and target nodes for
path finding to Vertex. Path finding executes no crypto operations and
using Vertex simplifies the code.

Additionally, it prepares for the path finding source parameter to be
exposed over rpc in a follow up commit without requiring conversion back
and forth between Vertex and btcec.PublicKey.
2019-03-06 15:31:00 +01:00
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
Otto Suess
c7c85ffd97
lnrpc: add read onchain permissions to invoice.macaroon 2019-02-07 18:17:49 +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
AdamISZ
9bb2a26948
Add listunspent RPC call
Returns a brief json summary of each utxo found by calling
ListUnspentWitness in the wallet. The two arguments are the
minimum and maximum number of conrfirmations (0=include
unconfirmed)
2018-12-11 15:26:38 +01:00
Johan T. Halseth
71444e74ac
Merge pull request #2033 from gitlikeagirl/ckc-hashinsendresponse
lnrpc: Add payment hash to SendResponse
2018-12-11 09:54:52 +01:00
Joost Jager
b2cb760c65
routing: check for empty hops list
This commit fixes a crash that could be triggered by sending an empty
hop list to the SendToRoute rpc.
2018-12-10 11:27:07 +01:00
Olaoluwa Osuntokun
363b9926b7
rpc: extend the admin macaroon with signer capabilities
In this commit, we extend the admin macaroon with signer capabilities in
order to allow it to be used with the new signer sub-server. As a
result, users will need to clear out their old macaroons in order to
have the new improved admin macaroon generated. In the future, we may
want to restructure the way the admin macaroon functions: rather than
white listing each of these entities and operations, we can instead add
a catch all capability. This capability will instead allow access to any
call, as each new call would be modified to permit this capabilities and
no others.
2018-12-06 16:25:41 -08:00
carla
b2adfca67e lnd: Add payment hash to SendResponse 2018-12-05 08:57:44 +02:00
Olaoluwa Osuntokun
b4e4f40125
Merge pull request #2128 from mrfelton/fix/queryroutes-default-num-routes
queryroutes: set queryroutes numRoutes param default to 10
2018-12-03 20:12:44 -08:00
Olaoluwa Osuntokun
1fd3aac925
multi: switch from bolt packge to bbolt package for all imports 2018-11-29 20:33:49 -08:00
Olaoluwa Osuntokun
a8ac3cfe7d
lnd+rpc: fix linter errors 2018-11-28 20:57:10 -08:00
Olaoluwa Osuntokun
ff47ade13b
lnd+rpc: modify rpcServer to fully manaage listeners and gRPC, handle sub-servers
In this commit, we modify the existing rpcServer to fully manage the
macaroons, gRPC server, and also seek out and create all sub-servers.
With this change, the RPC server gains more responsibility, as it
becomes the "root" server in the hierarchy of gRPC sub-servers.

In addition to creating each sub-server, it will also merge the set of
macaroon permissions for each sub-server, with the permissions of the
rest of the RPC infra. As a result, each sub-server is able to
independently specify what it needs w.r.t macaroon permissions and have
that taken care of by the RPC server. In order to achieve this, we need
to unify the creation of the RPC interceptors, and also fully manage the
gRPC server ourselves.

Some examples with various build configs:
```
⛰i  make build
 Building debug lnd and lncli.
go build -v -tags="dev" -o lnd-debug -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty" github.com/lightningnetwork/lnd
go build -v -tags="dev" -o lncli-debug -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty" github.com/lightningnetwork/lnd/cmd/lncli

⛰i  ./lnd-debug --debuglevel=debug --signrpc.signermacaroonpath=~/sign.macaroon
unknown flag `signrpc.signermacaroonpath'
unknown flag `signrpc.signermacaroonpath'

⛰i  make build tags=signerrpc
 Building debug lnd and lncli.
go build -v -tags="dev signerrpc" -o lnd-debug -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty" github.com/lightningnetwork/lnd
go build -v -tags="dev signerrpc" -o lncli-debug -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty" github.com/lightningnetwork/lnd/cmd/lncli

⛰i  ./lnd-debug --debuglevel=debug --signrpc.signermacaroonpath=~/sign.macaroon
2018-10-22 17:31:01.132 [INF] LTND: Version: 0.5.0-beta commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty, build=development, logging=default
2018-10-22 17:31:01.133 [INF] LTND: Active chain: Bitcoin (network=simnet)
2018-10-22 17:31:01.140 [INF] CHDB: Checking for schema update: latest_version=6, db_version=6
2018-10-22 17:31:01.236 [INF] LTND: Primary chain is set to: bitcoin
2018-10-22 17:31:02.391 [INF] LNWL: Opened wallet
2018-10-22 17:31:03.315 [INF] LNWL: The wallet has been unlocked without a time limit
2018-10-22 17:31:03.315 [INF] LTND: LightningWallet opened
2018-10-22 17:31:03.319 [INF] LNWL: Catching up block hashes to height 3060, this will take a while...
2018-10-22 17:31:03.320 [INF] HSWC: Restoring in-memory circuit state from disk
2018-10-22 17:31:03.320 [INF] LNWL: Done catching up block hashes
2018-10-22 17:31:03.320 [INF] HSWC: Payment circuits loaded: num_pending=0, num_open=0
2018-10-22 17:31:03.322 [DBG] LTND: Populating dependencies for sub RPC server: Signrpc
```

As for the config, an example is:
```
[signrpc]
signrpc.signermacaroonpath=~/signer.macaroon
```
2018-11-28 20:57:06 -08:00
ErikEk
6884fe40db Set private setting for invoice 2018-11-26 09:05:37 +01:00
Olaoluwa Osuntokun
a1c39af313
rpc: properly set output index in OpenChannelSync resp
Fixes #2219
2018-11-25 21:13:00 -06:00
Tom Kirkpatrick
b3c78d7110
queryroutes: set queryroutes numRoutes param default to 10
Fix an inconsistency between the gRPC/CLI queryroutes implementations.
Ensure that the numRoutes param always defaults to 10.
2018-11-17 13:35:59 +01:00
Johan T. Halseth
776059bdab
Merge pull request #2155 from joostjager/return-tx
lnwallet: update to new SendOutputs signature
2018-11-13 16:39:54 +01:00
Joost Jager
e14678030c
lnwallet: update to new SendOutputs signature 2018-11-10 07:57:19 +01:00
Xavi Soler
5fad3d1fbe rpcserver: show inactive channels in GetInfo 2018-11-05 09:10:32 +01:00
Joost Jager
28ae028535
lnrpc: accept pubkey in hop message
By passing a pubkey into SendToRoute, it becomes unnecessary for lnd to
query the channel graph to retrieve the hop pubkey. This allows routes
over private channels that are not present in the graph.
2018-11-01 08:59:53 +01:00
Joost Jager
e55a678eda
lnrpc: extract hop unmarshall code 2018-10-29 13:21:52 +01:00
Wilmer Paulino
e87d61b7f7
rpc: ensure we don't leak unadvertised nodes within invoice routing hints
In this commit, we ensure that we don't include routing hints for
unadvertised nodes at the time of invoice creation. Otherwise, this
would lead us to leak these unadvertised nodes to anyone who can get
their hands on the invoice being created. To prevent this, we'll now
look at the network graph and ensure that the node in unadvertised if
all of their edges are unadvertised and only extend to us.
2018-10-24 19:20:01 -07:00
Olaoluwa Osuntokun
1b0d8e8f13
Merge pull request #2059 from wpaulino/openchannel-unconfirmed-funds
rpc: prevent spending unconfirmed funds within OpenChannel by default
2018-10-23 19:58:43 -07:00
Olaoluwa Osuntokun
fbd91feace
Merge pull request #1888 from joostjager/routestruct
lnrpc+routing: fix unmarshallRoute and simplify route structure
2018-10-23 17:07:23 -07:00
Wilmer Paulino
3ac2e8486e
rpc: prevent spending unconfirmed funds within OpenChannel by default
In this commit, we address a slight regression in the defaults provided
by the OpenChannel RPC with regards to spending unconfirmed outputs to
fund funding transactions. We now add a new boolean parameter to
OpenChannelRequest: SpendUnconfirmed. If set, we'll use this to
indicate to the server that the funding transaction of the channel to be
created can spend the wallet's unconfirmed outputs to fund it. This
addition is needed because otherwise, if the caller doesn't specify a
MinConfs parameter to the request, then a default of 0 will be used,
which is not ideal.
2018-10-18 16:49:24 -07:00
Olaoluwa Osuntokun
4c0ca37174
Merge pull request #1389 from Bluetegu/noprivate-describegraph-1037
Add --noprivate flag to describegraph rpc to filter out private channels
2018-10-16 20:01:35 -07:00
Joost Jager
18d38d1d11
lnrpc: fix unsafe stream send 2018-10-15 21:13:37 +02:00
Joost Jager
a779004a18
lnrpc+routing: fix issues with missing data in unmarshallRoute
In this commit the dependency of unmarshallRoute on edge policies being
available is removed. Edge policies may be unknown and reported as nil.
SendToRoute does not need the policies, but it does need pubkeys of the
route hops. In this commit, unmarshallRoute is modified so that it
takes the pubkeys from edgeInfo instead of channelEdgePolicy.

In addition to this, the route structure is simplified. No more connection
to the database at that point. Fees are determined based on incoming and
outgoing amounts.
2018-10-13 22:59:23 +02:00
Conner Fromknecht
2e489fcf24
rpcserver: replace DebugBuild cmp w/ IsDevBuild in AbandonChannel 2018-10-05 13:04:45 +09:00
Conner Fromknecht
0903fe3183
main+lnd: display build.Version() for commit hash 2018-10-05 13:04:45 +09:00
bluetegu
d942bb58c3 Add support for IncludeUnannounced property of ChannelGraphRequest in
DescribeGraph rpc server method.
2018-10-04 14:54:35 -04:00
Olaoluwa Osuntokun
4b1334ad49
rpc: populate additional information in AbandonChannel close summary
In this commit, we extend the AbandonChannel RPC method to store as much
information as possible within the CloseSummary. Most importantly, we
store the current and next (if available) revocation of the remote party
along with the channel config for the local party. With this
information, we have enough data to be able to generate a custom signer
for a new commitment state, or to prove that the channel was indeed
ours if needed.
2018-09-28 16:43:17 -07:00
Wilmer Paulino
bdcc847a44
rpc: remove NewWitnessAddress RPC
In this commit, we remove the unnecessary NewWitnessAddress RPC. We do
this as, at the moment, we only expose the wallet to generate witness
addresses. Now that the RPC has been removed, its REST endpoint has been
assigned to the NewAddress RPC, which should be the de facto way of
having the wallet generate any type of supported address.

Fixes #1986.
2018-09-28 02:52:09 -07:00
Roei Erez
6bc01384d6 udpate code to include the value_sat and value_msat fields in payments 2018-09-27 08:58:18 +03:00
Joost Jager
ab67b9a4de
rpcserver+lnrpc+lncli: add AbandonChannel rpc call
Using AbandonChannel, a channel can be abandoned. This means
removing all state without any on-chain or off-chain action.
A close summary is the only thing that is stored in the db after
abandoning.

A specific close type Abandoned is added. Abandoned channels
can be retrieved via the ClosedChannels RPC.
2018-09-18 12:20:27 -07:00
Oliver Gugger
10b976187d
rpcserver: handle unconfirmed TX properly when listing all transactions 2018-09-15 11:29:32 +02:00
Wilmer Paulino
012d4f5c8c
rpcserver: include new proto fields in ListInvoices rpc 2018-09-12 22:11:59 -07:00
Johan T. Halseth
d742529bb2
rpcserver: set AmtPaidMsat when creating RPC invoice 2018-09-07 14:13:48 +02:00
Roei Erez
f0201fbb32 amount paid should be in satoshies as other fields used for amount 2018-09-05 11:41:48 +03:00
Wilmer Paulino
2906629ae5
rpcserver: implement pagination support for listing invoices
Co-authored-by: Andrey Savitskiy <taketa@users.noreply.github.com>
Co-authored-by: Valentine Wallace <valentine.m.wallace@gmail.com>
2018-08-21 18:00:08 -07:00
Wilmer Paulino
a3cec7e036
rpcserver: set minConfs field in openChanReq 2018-08-16 20:19:29 -07:00
Wilmer Paulino
5c414bb1d0
multi: make OpenChannel take in openChanReq 2018-08-16 20:19:26 -07:00
Wilmer Paulino
29efb02968
rpcserver: enforce fee floor for fee rates input by the user
In a previous commit, we modified our fee rates to be sat/kw internally
as it was possible that the estimated fee rate was not enough to
properly broadcast the transaction. To remedy this, we decided to add a
fee floor, but this would only be enforced when querying the fee
estimator. In this commit, we attempt to do the same thing, but for fee
rates input manually by the user.
2018-08-13 14:39:08 -07:00
Joost Jager
3e7473f4f0 routing: backward searching 2018-08-09 20:23:40 -07:00
Joost Jager
6c918a1806 channeldb: store unknown policies in database
The commit ensures that for every channel, there will always
be two entries in the edges bucket. If the policy from one or
both ends of the channel is unknown, it is marked as such.

This allows efficient lookup of incoming edges. This is
required for backwards payment path finding.
2018-08-09 20:23:40 -07:00
Wilmer Paulino
336f1c156e
rpcserver: convert sat/vbyte fee rates input by the user to sat/kw
In this commit, we explicitly convert sat/vbyte fee rates input by the
user to sat/kw. We do this as users are typically more accustomed to
sat/vbyte fee rates, rather than sat/kw.
2018-08-09 17:29:53 -07:00
Conner Fromknecht
cf2c371042
multi: fix linting errors 2018-08-02 18:20:50 -07:00
Conner Fromknecht
1ded697e8d
multi: sort import paths with gofmt 2018-08-02 18:20:49 -07:00
Olaoluwa Osuntokun
07defe5f93
rpc+peer: use pkScripts for close ntfns 2018-07-31 21:28:52 -07:00
Stefan Menzel
e776a06cfb rpc: disallow a negative invoice amount in AddInvoice 2018-07-25 20:11:46 -07:00
Olaoluwa Osuntokun
e0baa49690
Merge pull request #1387 from wpaulino/send-disable-chan-update
multi: send a channel update with disabled flag set on channel close
2018-07-23 17:46:37 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Wilmer Paulino
ee10b0a76c
rpcserver: set recently added disabled field to routing policies 2018-07-11 17:07:01 -07:00
Olaoluwa Osuntokun
904342b9e8
rpc: populate response of AddInvoice w/ add index of new invoice 2018-07-06 12:22:02 -07:00
Olaoluwa Osuntokun
892a413be3
rpc: update SubscribeInvoices to send backlog ntfns, also send add ntfns 2018-07-06 12:21:59 -07:00
Olaoluwa Osuntokun
e4c5840472
rpc: ensure new invoice fields are populated in RPC responses 2018-07-06 12:21:58 -07:00
Olaoluwa Osuntokun
b3bb65ea43
rpc: restore proper debug HTLC usage
In this commit, we fix a slight regression that happened when the
sendtoroute RPC call was implemented. As a result of the refactoring,
the debughtlc mode silently broke. In this commit, we fix this by
checking against the zero hash, rather than the length of the payment
hash, as since we use a fixed sized byte slice, it will always be zero.
2018-06-30 17:13:19 -05:00
Olaoluwa Osuntokun
c19c872cff
lnd: update invoiceRegistry to match new switch requirements 2018-06-29 16:03:51 -07:00
Olaoluwa Osuntokun
c914de177b Revert "rpc: include the FinalCltvDelta when writing new invoices to disk"
This reverts commit 4e264ee88e765b9cd15369a02378091c6520a1e6.
2018-06-29 12:40:53 -07:00
Olaoluwa Osuntokun
ff771968b6
Merge pull request #1392 from cfromknecht/signal-package
Signal/Interrupt package
2018-06-28 19:08:51 -07:00
Conner Fromknecht
5144df645b
rpcserver: request shutdown from signal package 2018-06-28 16:17:02 -07:00
Olaoluwa Osuntokun
4e264ee88e
rpc: include the FinalCltvDelta when writing new invoices to disk 2018-06-26 19:50:05 -07:00
Olaoluwa Osuntokun
d82ef41245
rpc: sort closed channels in order of ascending height 2018-06-14 17:14:39 -07:00
Olaoluwa Osuntokun
4a0d7b0244
Merge pull request #1374 from wpaulino/zero-amount-invoice-error
rpcserver: return err when paying 0 amt invoice and amt is not specified
2018-06-13 18:56:04 -07:00
Joost Jager
f80ea51f69 rpcserver: add ClosedChannels call 2018-06-13 08:48:01 +02:00
Wilmer Paulino
63f079d1a4
rpcserver: add fee limit support for routing related RPCs 2018-06-12 18:14:49 -07:00
Sebastian Delgado
6746609ec6
Add constant and percentage-based fee limits to payments
- Extend SendRequest and QueryRoutesRequest protos
- newRoute function takes fee limit and cuts off routes that exceed it
- queryRoutes, payInvoice and sendPayment commands take the feeLimit inputs and pass them down to newRoute
- When no feeLimit is included, don't enforce any feeLimits at all (by setting feeLimit to maxValue)
2018-06-12 18:14:43 -07:00
Wilmer Paulino
f27e0baf7c
rpcserver: return err when paying 0 amt invoice and amt is not specified 2018-06-11 16:33:01 -07:00
Olaoluwa Osuntokun
15f812b10f
lnwire: don't attempt to decode an empty/nil signature 2018-06-08 13:25:56 -07:00
Olaoluwa Osuntokun
bc9eca32ab
rpc: refactor logic for SendPayment+SendToRoute
In this commit, we modify the logic for the two primary payment related
RPCs to reduce duplication, indentation, and consolidate logic. As a
result, we'll now accept rpcPaymentIntents, turn those into regular
paymentIntents (convert from proto) before finally dispatching via
unified function.
2018-06-06 20:45:56 -07:00
t4sk
982f53e6f2 rpc: modify QueryRoutes to take final_cltv_delta 2018-06-06 20:45:01 -07:00
t4sk
6ddd7b4d0d rpcserver: add SendToRoute methods
rpcserver: add SendToRoute handler
2018-06-06 20:45:00 -07:00
Wilmer Paulino
077b1fffcc
Revert "rpcserver: flip inbound bool for display, fix internally later"
This reverts commit 5126e431355ea074404064b91c57732e96d0a1e6 since the
underlying issue has now been fixed.
2018-06-06 16:30:41 -07:00
Olaoluwa Osuntokun
d98d4523e1
Merge pull request #1159 from wpaulino/onion-service-support
multi: add onion services support
2018-06-04 21:46:51 -07:00
Wilmer Paulino
d6d0c26252
rpcserver: add support to connect to onion addresses
In this commit, we now allow connections to onion addresses due to
recently adding support to properly parse them.

Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
2018-06-04 20:41:42 -07:00
Olaoluwa Osuntokun
4d37508417
rpc: ensure we don't attempt to create a routing hint with a nil edge
In this commit, we fix an existing panic bug related to the recently
added routing hints feature. If it's the case that the remote node
didn't send us their edge, then when we go to compare the public keys to
see if they match, we may attempt to deref an nil pointer.

In order to fix this, we'll instead check the edgeInfo, which is
guaranteed to also exist if the channel was found in the database. As a
defensive step, before we go to actually aces the struct, we'll check
that's it's non-nil and proceed if it is nil.
2018-06-04 17:21:42 -07:00
Wilmer Paulino
e363766394
multi: increase max funding and payment amount 60x under Litecoin 2018-05-25 00:11:20 -04:00
Johan T. Halseth
5cef2bacde
rpcserver: add TODO for removing coop closes from "pending close" channels 2018-05-24 10:29:20 +02:00
Oliver Gugger
3eff9804ee macaroons: add technical documentation, fix comments 2018-05-18 10:13:25 +02:00
Conner Fromknecht
f963f91a3c
multi: use mutex-guarded ShortChanID() on OpenChannel 2018-05-09 16:06:49 -07:00
Johan T. Halseth
409ab08c36
rpcserver: remove send to settledContracts 2018-05-02 08:43:30 +02:00
Olaoluwa Osuntokun
c54a91f44d
rpc: modify SignMessage+VerifyMessage to bind msg to LN context
In this commit, we modify the SignMessage+VerifyMessage slightly in
order to bind the message we're signing to our specific context. We do
this by pre-pending the ascii text "Lightning Signed Message:" to the
msg before we run it through dsha256. Adding this prefix binds the
message to our context in order to avoid accidentally signing a sighash
or the like.
2018-04-25 19:45:32 -07:00
Johan T. Halseth
97977c8a06
rpcserver: add channels waiting for commitment confirmation to pending channels response 2018-04-25 09:37:25 +02:00
Wilmer Paulino
a34b2d7de2
rpcserver: add missing continue if link wasn't retrieved
In this commit, we avoid hitting a possible panic in the case that we
were unable to retrieve the link of a channel from the HTLC switch while
determining which channels should be used as routing hints for an
invoice.
2018-04-21 11:31:50 -04:00
Wilmer Paulino
4e90691bf3
rpcserver: include routing hints when sending payments 2018-04-20 19:45:01 -04:00
Wilmer Paulino
d1a717ba88
rpcserver: add ability to populate routing hints when creating an invoice 2018-04-20 19:45:00 -04:00
Wilmer Paulino
1b137bf14c
rpcserver: populate the routing hints of an invoice when decoding it 2018-04-20 04:01:36 -04:00
t4sk
49510d775f rpcserver: include millisatoshis in marshallRoute 2018-04-19 09:15:21 +08:00
Olaoluwa Osuntokun
d63b923f5e
Revert "rpcserver: remove uneccessary signal to breacharbiter at force close"
This reverts commit 0f90c950daaec7843e305f32d10e36411fb0b47f.

We actually still need to notify the BRAR of a force close, as
otherwise, it doesn't have a signal to exit due to a local force close
event.
2018-04-17 19:05:40 -07:00
practicalswift
663c396235 multi: fix a-vs-an typos 2018-04-17 19:02:04 -07:00
Olaoluwa Osuntokun
21b6c62bf9
Merge pull request #1020 from mecampbellsoup/add-version-to-getnetworkinfo-rpc
Add version field to GetInfo RPC endpoint
2018-04-17 18:41:18 -07:00
Johan T. Halseth
daeeca0bc3
rpcserver: make copy of htlc rhash before returning in listchannels
This commit fixes a bug where all the HTLC rhash slices in a
ListChannelsResponse would be tied to the loop variable, making them all
take the hash of the last HTLC in the list. This commit fixes it by
making a copy of the slice.
2018-04-15 11:36:20 +02:00
mecampbellsoup
bd398540c1 Add version field to GetInfo RPC endpoint
This is inspired by the Bitcoin RPC `getnetworkinfo` endpoint which also
includes version information:
https://bitcoin.org/en/developer-reference#getnetworkinfo
2018-04-10 09:27:44 -04:00
Olaoluwa Osuntokun
3fa2e08665
test: update testUpdateChannelPolicy to ensure Bob's link uses the proper policies
In this commit, we update the testUpdateChannelPolicy to exercise the
recent set of changes within the switch. If one applies this test to a
fresh branch (without those new changes) it should fail. This is due to
the fact that before, Bob would attempt to apply the constraints of the
incoming link (which we updated) instead of the outgoing link. With the
recent set of changes, the test now properly passes.
2018-04-06 14:52:01 -07:00
Olaoluwa Osuntokun
e30881a14c
Merge pull request #1033 from stevenroose/close-offline
rpcserver: Clarify failure closing offline channel
2018-04-06 12:20:30 -07:00
Steven Roose
445924b7a9 rpcserver: Clarify failure closing offline channel 2018-04-06 10:42:14 +02:00
Vadym Popov
29f1fda60d
rpcserver: include a pending_open_balance in channelbalance response
Changes in `ChannelBalance` rpcserver method implementation to
add `pending_open_balance` counted according state of opened channel
2018-04-01 02:40:50 +03:00
Olaoluwa Osuntokun
6be6b48e09
Merge pull request #840 from halseth/openchannel-csv-delay
Add CSV delay flag to openchannel
2018-03-31 16:05:08 -07:00
Olaoluwa Osuntokun
c5c23eb833
Merge pull request #974 from Roasbeef/invoice-expiry-fix
zpay32+rpc: ensure we can encode an expiry of math.MaxUint64, limit to 1 year in seconds
2018-03-30 13:12:53 -07:00
Olaoluwa Osuntokun
447a031435
peer: reject remote closes with active HTLCs
In this commit, we follow up to the prior commit by ensuring we won't
accept a co-op close request for a chennel with active HTLCs. When
creating a chanCloser for the first time, we'll check the set of HTLC's
and reject a request (by sending a wire error) if the target channel
still as active HTLC's.
2018-03-30 13:06:57 -07:00
Olaoluwa Osuntokun
ecbeca5f29
rpc: disallow attempting a co-op close of a channel with active HTLCs
In this commit, we fix a bug that at times could cause any dangling
HTLC's to be sent to miner's fees if a user attempted to close out a
channel cooperatively that still had pending HTLC's. We'll first prevent
this at the RPC level by rejecting any attempts to trigger a co-op
channel closure while a channel still have dangling HTLC's.
2018-03-30 12:51:01 -07:00
Olaoluwa Osuntokun
ef4512d1d8
rpc: limit the larger invoice expiry to 1 year
This is a follow up to the prior commit. In order to add an additional
layer of defense, we'll reject any expiry greater than 1 year.
2018-03-29 16:25:11 -07:00
Olaoluwa Osuntokun
90a13aedcf
Merge pull request #954 from halseth/remove-breacharbiter-signal
[mini] rpcserver: remove uneccessary signal to breacharbiter at force close
2018-03-28 15:21:42 -07:00
Johan T. Halseth
0f90c950da
rpcserver: remove uneccessary signal to breacharbiter at force close
This signal is no longer needed, as the breacharbiter is given
the UnilateralClosure chain event.
2018-03-28 08:10:19 +02:00
Nalin Bhardwaj
bca87535b3
rpcserver: fix GetInfo testnet detection
Fixes bug with Litecoin testnet detection.
2018-03-24 15:01:12 +05:30
Johan T. Halseth
938aefb573
rpcserver: pass incoming RemoteCsvDelay to server.OpenChannel 2018-03-22 14:54:00 +01:00
Olaoluwa Osuntokun
7d14ed7a06
Merge pull request #904 from Roasbeef/invoice-macaroon
rpc+lnd: add new invoice-only macaroon
2018-03-21 15:27:31 -07:00
Olaoluwa Osuntokun
0155bcfd5c
Merge pull request #881 from Roasbeef/autopilot-target-chan-size
funding+pilot: increase min channel size, allow specifying chan size range for autopilot
2018-03-21 15:11:25 -07:00
Olaoluwa Osuntokun
a07579c541
rpc: modify the entity of invoice related RPC's to target the invoice entity
In this commit, we modify the existing invoice RPC macaroon permissions
to target a more specific entity: “invoices”. As a result of this
commit, once node operators update, they’ll need to regenerate their
readonly.macaroon as it now needs this additional entity encoded within
it.
2018-03-21 15:08:54 -07:00
Olaoluwa Osuntokun
6a294e7489
rpc: extend writePermissions and readPermissions with the invoice entity
In the prior commit, we added a new set of permissions and also a new
entity: “invoices”. We’ll add this set of entities to the read and
write permissions accordingly as well to ensure that the existing
macaroons have access to all the items that the invoice.macaroon does.
2018-03-21 15:08:53 -07:00
Olaoluwa Osuntokun
6c6285344b
rpc: add new invoicePermissions bakery.Op slice for an invoice only macaroon
In this commit, we add a new invoicePermissions slice. This contains
all the permission that a holder of an invoice.macaroon is able to
access, and no others. We also include read and write access to
addresses as this may be useful from the PoV of a merchant or exchange.
2018-03-21 15:08:50 -07:00
Wilmer Paulino
85b03780f3
rpcserver: determine which channels to return based on passed params 2018-03-19 11:19:04 -04:00
Olaoluwa Osuntokun
8127685462
funding+rpc: raise min channel size to 20k satoshis
In this commit, we raise the min channel size to 20k satoshis. This
will be evaluated before we check for dusty commitments. The goal of
this is to ensure ample room for fees at current, and future fee
levels.
2018-03-18 17:10:25 -07:00
Conner Fromknecht
bb16f9d29a
rpcserver: use primary chain default CLTV for add invoice 2018-03-14 16:57:43 -07:00
Olaoluwa Osuntokun
800eea931f
build+multi: switch from bolt to bbolt
In this commit, we switch from boltbd/bolt to coreos/bbolt as the
former is no longer being actively maintained.
2018-03-10 19:01:13 -08:00
Conner Fromknecht
935c757102
rpcserver: allow unsafe-disconects 2018-03-09 21:18:15 -08:00
Olaoluwa Osuntokun
b41222b316
rpc: update RPC server to disallow p2pkh adds, assume segwit for ConfirmedBalance 2018-03-06 16:04:04 -05:00
Olaoluwa Osuntokun
02852cdc3b
rpc: implement new ForwardingHistory command 2018-03-06 13:56:12 -05:00
Olaoluwa Osuntokun
06c1030999
rpc: populate new day, week, and month fee sums in FeeReport 2018-03-06 13:56:12 -05:00
vegardengen
a1fb22eb8d rpc: properly populate fee field in listpayments 2018-03-06 13:21:03 -05:00
Olaoluwa Osuntokun
f7ec490f44
Merge pull request #762 from halseth/fee-estimator
Add types for representing fee rates
2018-02-26 17:22:50 -08:00
Olaoluwa Osuntokun
7f04d927a0
rpc: fix queryroutes bug that assumed precise number of returned routes
In this commit, we fix a bug in the query routes RPC that could at
times lead to a panic. This would happen if the number of returned
routes was less than the number of expected routes. To remedy this,
we’ll return the minimum of the number of requested routes, and the
number of routes actually returned.
2018-02-26 16:31:50 -08:00
Johan T. Halseth
ba3f3e1942
rpcserver: express fee rates using types 2018-02-26 22:42:27 +01:00