Commit Graph

243 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
edbdcddea1
lnrpc: extend invoice subscriptions to allow callers to receive backlog notifications
In this commit, we extend the current SubscribeInvoice streaming RPC
call. We add two new values to the InvoiceSubscription message:
add_index and settle_index. These fields have also been added to the
current Invoice message. Each time a new invoice is added, the add index
will be incremented. Each time a new invoice is settled the settle index
will be incremented. The new field on the InvoiceSubscription message
allow callers to specify the last add index and the last settle index
they know of. With this new addition, callers will now be able to
reliably receive notifications for new received payments.

Care has been taken to ensure that these changes are backwards
compatible. If callers don't specify either of the new fields, then they
won't receive any notification backlog at all.

Fixes #862.
2018-07-06 12:21:55 -07:00
Joost Jager
52392d836c lnrpc: add ClosedChannels call 2018-06-13 08:48:33 +02:00
Wilmer Paulino
df6d75a054
lnrpc: use a protobuf oneof for the different types of fee limits 2018-06-12 18:14:46 -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
Olaoluwa Osuntokun
9f183dc08f
lnrpc: switch REST endpoint for SendToRoute to /v1/channels/transactions/route 2018-06-06 20:45:53 -07:00
t4sk
d6ca581cbc lnrpc: add new final_cltv_delta param to QueryRoutes 2018-06-06 20:45:01 -07:00
t4sk
dac62e812c lnrpc: add SendToRoute command 2018-06-06 20:45:00 -07:00
Wilmer Paulino
e73b457e1f
lnrpc: add new ChangePassword RPC to WalletUnlocker 2018-05-31 17:23:56 -07:00
Conner Fromknecht
0ae62c3720
lnrpc: add RecoveryWindow to InitWalletRequest 2018-04-26 16:03:27 -07:00
Johan T. Halseth
8b670d783a
lnrpc: add WaitingCloseChannel to PendingChannelResponse 2018-04-25 09:37:25 +02:00
Wilmer Paulino
1713394eb3
lnrpc: add private field to addinvoice request
In this commit, we add a `private` field to the `AddInvoice` RPC's
request to denote whether the invoice being created should include
routing hints for private channels to assist the payer in reaching the
destination.
2018-04-20 04:01:37 -04:00
Wilmer Paulino
6394c2fbb5
lnrpc: add route hints proto field to invoices 2018-04-20 04:01:35 -04:00
t4sk
31feeca51a lnrpc: extend Route to include millisatoshis 2018-04-19 09:15:21 +08:00
practicalswift
663c396235 multi: fix a-vs-an typos 2018-04-17 19:02:04 -07: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
Vadym Popov
66224e6bf8
lnrpc: add new pending_open_balance param to ChannelBalanceResponse
Changes in gRPC `channelbalance` service response message
of adding `pending_open_balance` parameter with sum of
channels open pending balances denominated in satoshis
2018-04-01 02:38:04 +03:00
Johan T. Halseth
00ed95b414
lnrpc: add remote_csv_delay to OpenChannelRequest 2018-03-22 14:53:41 +01:00
Olaoluwa Osuntokun
6d07b865d6
Merge pull request #847 from stevenroose/typo-funding
rpc: Fix typo in OpenChannelRequest
2018-03-20 15:55:30 -07:00
Steven Roose
9516d8da52 rpc: Fix typo in OpenChannelRequest 2018-03-19 19:11:47 +01:00
Wilmer Paulino
95997b9c6c
lnrpc: add flags to specify retrieving different channels 2018-03-19 11:19:02 -04:00
Olaoluwa Osuntokun
97b7eb226d
lnrpc: update photo comments to fix api.lightning.community tool 2018-03-08 17:06:34 -08:00
Olaoluwa Osuntokun
525cca02e2
lnrpc: remove the PUBKEY_HASH adds type, WalletBalance is segwit by default 2018-03-06 16:04:04 -05:00
Olaoluwa Osuntokun
36f214f48c
lnrpc: add ForwardingHistory for querying payment circuit time series
In this commit, we add a new method to the RPC service:
ForwardingHistory. This method will allow callers to query for the
completed payment circuits in a particular time slice, skip a series of
events, and also paginate within a time slice.
2018-03-06 13:56:12 -05:00
Olaoluwa Osuntokun
7f953bf0b9
lnrpc: revamp the WalletUnlocker service to have a two-stage init
In this commit, we revamp the WalletUnlocker service to now have a
two-stage init process.

The first (optional) is for the user instantiating a new lnd instance to
call the GenSeed method with an optional aezeed passphrase. The response
to this will be a freshly generated aezeed mnemonic along with the
original enciphered seed.

The second step will be the actual wallet initaliztion. By separating
this step from seed generation, UI's will be able to ensure that the
user has written down the seed, before proceeding and committing the
seed to the internal wallet. The new method InitWallet accepts a wallet
passphrase, the aezeed mnemonic, and the optional passphrase.
2018-03-05 11:07:01 -05:00
Jason Dufair
84551c616f lnwallet/lnrpc: Expose sync status to gRPC interface
This commit adds wallet_best_block_timestamp to the gRPC interface.
This is done in order to allow clients to calculate progress while
lnd syncs to the blockchain. wallet_best_block_timestamp is exposed
via the GetInfo() rpc call. Additionally, IsSynced() returns the
WalletBestBlockTimestamp as the second value in the tuple
that is returned, providing additional detail when querying about the
status of the sync. The BtcWallet interface has also been updated
accordingly.

This commit was created to support the issue to
[Add progress bar for chain sync] (lightninglabs/lightning-app#10) in
lightning-app
2018-02-20 19:00:06 -08:00
MeshCollider
4ed5ba0d26 multi: Remove peer_id from RPC commands 2018-02-19 17:48:39 -08:00
practicalswift
b8e1351cf3 multi: fix some recently introduced typos 2018-02-18 15:27:29 -08:00
Olaoluwa Osuntokun
eddca9bf92
lnrpc: add new num_routes param to QueryRoutes 2018-02-12 16:28:45 -08:00
Daniel McNally
8543497dcc multi: fixing it's/its typos in comments 2018-02-06 19:13:07 -08:00
practicalswift
a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
Wilmer Paulino
1fefae780f
lnrpc: use funding_txid_str as the main endpoint for CloseChannel 2018-01-27 22:00:31 -05:00
Wilmer Paulino
2cfd705a06
lnrpc: add oneof funding txid to ChannelPoint
This commit allows us to get/set the funding txid of a ChannelPoint
either as raw bytes or a string.
2018-01-27 21:59:54 -05:00
Andrew Naoum
0f161c5033 channeldb+lnrpc: store the payment pre-image not rhash
Fixes #481.

Prior to this commit, payments stored in the channel DB only kept a
record of the payment hash. This is a problem as the preimage is what
serves as proof of payment and a user should be able to look up this
value in the future (not just immediately after payment).

Instead of storing both the payment hash and the preimage, we store the
preimage only since the hash can be derrived from this using a SHA256.

In the RPC listpayments command, we now give the preimage in addition to
the payment hash.
2018-01-27 18:36:33 -08:00
Johan T. Halseth
08ae9fe510 lnrpc: change REST post path of PolicyUpdate from /fees to /chanpolicy 2018-01-27 14:48:28 -08:00
Wilmer Paulino
8ed52dcf64
lnrpc: avoid lookupinvoice endpoint collision
This commit changes the listinvoices and lookupinvoice endpoints to
avoid collisions when making requests.

We can still retrieve a list of pending invoices with `listinvoices` by
appending the parameter `pending_only=true` to the request URL.
2018-01-26 01:08:12 -05:00
Olaoluwa Osuntokun
5b4b6f9c0e
lnrpc: add final_cltv_delta as a SendRequest parameter 2018-01-22 19:19:41 -08:00
Johan T. Halseth
e27f524309
lnrpc: add min_htlc_msat to OpenChanneRequest 2018-01-12 22:56:35 +01:00
Johan T. Halseth
551326586c
lnrpc: rename UpdateFee -> UpdateChannelPolicy
This commit renames the UpdateFee RPC call together
with associated types to UpdateChannelPolicy. In addition
to fees, now also timelock delta can be specified using
this call.
2018-01-12 22:56:33 +01:00
Olaoluwa Osuntokun
6f408004e2
lnrpc+rpc: remove SetAlias method
In this commit we remove the SetAlias method as it’s being removed in
favor of instead using a static configuration parameter.
2018-01-10 15:16:46 -08:00
Olaoluwa Osuntokun
fa6354b223
lnrpc: remove blocks_till_open field from PendingChannelsResponse
In this commit, we remove the blocks_till_open from
PendingChannelsResponse as in its current state, the values that are
assigned to this field don’t accurately reflect the naming. This has
caused a good bit of confusion amongst users lately. As a result, we’re
temporarily removing this field until we have proper incremental
notifications within the chain notifier.
2018-01-08 19:50:17 -08:00
Wilmer Paulino
a61b6428e8
lnrpc: add protof definitions for uris to getinfo 2018-01-07 00:50:30 -05:00
Olaoluwa Osuntokun
7421584341
lnrpc: making PendingChannels req/resp naming scheme consistent
In this commit we rename the lnrpc.PendingChannelRequest and
lnrpc.PendingChannelResponse to
lnrpc.PendingChannelsRequest/lnrpc.PendingChannelsResponse. We do this
as we strive to ensure that the naming scheme across the RPC interface
is consistent.
2018-01-04 14:20:31 -06:00
Johan T. Halseth
464f57d3a5 lnrpc: update godoc for 'private' flag 2017-12-17 18:35:34 -08:00
nsa
17c98473d9 lnrpc: add --private arg to OpenChanRequest 2017-12-17 18:35:34 -08:00
Micah Lerner
9e4da6566a proto: Add destination addresses to lnrpc definitions 2017-12-08 15:11:23 -08:00
Olaoluwa Osuntokun
0ebf55a9f6 lnrpc: add local CSV value ListChannels response 2017-12-05 17:45:58 -08:00
Nalin Bhardwaj
a234e01c07
lnrpc+proto: Modify WalletBalance to include detailed balance info 2017-12-04 05:34:39 +05:30
Olaoluwa Osuntokun
81283e8b5a
lnrpc: make BlocksTillOpen an int32 2017-12-02 18:36:15 -08:00
Olaoluwa Osuntokun
7caf3ceb49
lnrpc: add new color field to LightningNode 2017-12-02 18:35:55 -08:00
Olaoluwa Osuntokun
385023f0b7
cmd/lncli: add new --target_conf and --sat_per_byte args for relevant commands
In this commit, we expose the new fee control features to the relevant
commands on the command line. This will allow users to have a greater
degree of control of the fees they pay when: sending coins on chain,
opening a channel, or closing a channel.
2017-11-23 23:10:14 -06:00
Conner Fromknecht
1f34f117ff
lnrpc: adds PendingHTLCs to ForceClosedChannels 2017-11-15 18:04:44 -08:00
Olaoluwa Osuntokun
de7e339281
lnrpc: add cltv_expiry to Invoice and PayReq protos 2017-10-22 18:36:53 -07:00
Johan T. Halseth
1f34bd815d lnrpc: add WalletUnlocker service.
This commit adds the service WalletUnlocker, which is to be used
for creating a wallet password at first time startup, and unlocking
the wallet. The service exposes the RPC methods CreateWallet and
UnlockWallet.
2017-10-19 19:17:35 -07:00
Johan T. Halseth
9d31b6c4fd
lnrpc: add BOLT-11 fields.
This commit adds fields that are supported by the BOLT-11 invoice
format to the Invoice and PayReq protos. These fields are
timestamp, expiry, fallback address, description and
description hash.
2017-09-27 12:26:05 +02:00
Olaoluwa Osuntokun
6e6b5ac9af
lnrpc: remove the revocation_delay field from the HTLC proto
This commit removes the revocation_delay field from the HTLC proto as
we no longer need this field since the switch to 2-layer HTLC’s. The
2-layer HTLC construction no longer has the CSV delay directly in the
HTLC script itself.
2017-09-12 18:03:17 +02:00
Olaoluwa Osuntokun
129a0e10de
lnrpc: add two new RPC's, UpdateFees and FeeReport
This commit adds to new RPC’s to the Lightning service: UpdateFees and
FeeReport. Additionally, we also update to the latest version of protc,
golang protobuf, and the gRPC gateway.
2017-08-22 00:53:41 -07:00
Olaoluwa Osuntokun
c14eaa7b6c
lnrpc: add expiry field to the Hop proto within a Route 2017-08-02 21:13:51 -07:00
Olaoluwa Osuntokun
43b40c2ba2
lnrpc: remove num_confs as a parameter within OpenChannelRequest
This commit removes the num_confs parameter within the
OpenChannelRequest struct as it’s no longer applicable with the new
funding workflow. In the new funding workflow, it’s the responder that
decides how many confirmations are required.
2017-07-30 17:51:44 -07:00
Olaoluwa Osuntokun
58d3fd9dd8
lnrpc: WalletBalance now returns satoshis instead o fBTC 2017-07-04 15:50:33 -07:00
Andrey Samokhvalov
6861df0e23 rpcserver: add additional 'error' field in payment response
In order to not close the payment stream on payment error the additional
field have been added in payment response. Now error from stream Recv()
function means that something has happend inside the client and we unable
to process any payment farther, and error inside the payment response
means, that something wrong has happend with payment itself.
2017-05-31 11:06:08 -07:00
Olaoluwa Osuntokun
4728826aa7
lnrpc: add fee, weight, and fee-per-kw for commit txns in channels 2017-05-16 19:13:31 -07:00
Philip Hayes
3b84db1f25 rpc: add signature to VerifyMessage response 2017-05-12 14:21:19 -07:00
Philip Hayes
2249215260 rpc: add SignMessage and VerifyMessage interface
This commit allows users to sign messages with their node's private key
with the SignMessage interface. The signatures are zbase32 encoded for
human readability/paste-ability.  Others users can verify that a message
was signed by another node in their channel database with the
VerifyMessage interface.
2017-05-12 14:21:19 -07:00
halseth
aa4e166539 lnrpc+rpc+lnd: add new Stop command for gracefully shutting down lnd
This commit adds simple non-blocking stop command to lncli, with an
appropriate proto update and implementation within the rpcserver.  When
invoked the interrupt handler routine in signal.go with begin the graceful
shutdown of lnd.
2017-05-11 14:55:56 -07:00
afederigo
cf4da784f0 rpc: add disconnect peer service and req/res messages
Issue: 139

This commit contains rpc service and messages for disconnecting
remote peers identified dy public key
2017-05-05 14:24:25 -07:00
Olaoluwa Osuntokun
9e4e423de1
lnrpc: augment the PendingChannels RPC to include details of closed channels
This commit adds some additional fields to the PendingChannels RPC s.t
users will be able to use the RPC to gain a complete view w.r.t where
all the funds within the daemon are, and how soon they can be
retrieved.

The following information is now returned:
   * all channels pending open
   * all channels pending cooperative close
   * all channels pending force close
2017-05-04 17:39:12 -07:00
Olaoluwa Osuntokun
71514ceb14
lnrpc: add chains field to GetInfoResponse to display active chains 2017-05-02 19:58:04 -07:00
bryanvu
9ffac9eae1 lnwire: update NodeAnnouncement to handle multiple addresses
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue #131 .
2017-03-29 12:03:43 -07:00
Olaoluwa Osuntokun
04a6c2f7f6
lnrpc: convert QueryRoute to QueryRoutes
This commit converts the previous QueryRoute command to a new command:
QueryRoutes. This command is identical to QueryRoute other than the
fact that it’s able to return multiple routes rather than a single
route.
2017-03-21 12:20:47 -07:00
Thomas Preindl
862722d6fe lnrpc: switch Transaction.Amount from double (BTC) to int64 (sat) 2017-03-16 12:39:40 -07:00
Olaoluwa Osuntokun
94fa55cca3
lnrpc: add new SubscribeChannelGraph RPC call
This commit adds a new streaming RPC call the exposes the newly added
routing layer TopologyChange notifications within the gRPC service.
2017-03-14 20:07:39 -07:00
Olaoluwa Osuntokun
1dfda91415
lnrpc: add field denoting if channel peer is online in ListChannels
This commit adds a new field to the ListChannels RPC command which
indicates if the peer is currently online or not. This is useful as
UI’s will be able to use this information to communicate the
availability of each channel to an end user.
2017-03-08 14:46:24 -08:00
Olaoluwa Osuntokun
3a851d8bc6
lnrpc: re-compile protos with protoc v3.0.2 add json_name option
This commit modifies the protobuf file and most of the auto-generated
files to be generated by protoc version v3.0.2. Additionally, this
fixes a minor cosmetic regression within the `lncli` command line tool
which caused the JSON responses to be rendered in `camelCase` rather
than `snake_case`. We fix this by specifying the `json_name` for each
relevant RPC response.
2017-02-27 21:04:42 -06:00
bryanvu
508138f8c8 lnrpc: add output_index field to PendingUpdate message
Because we want to persist the state of the channel once the funding
transaction has been broadcast rather than once it has been fully
opened, we need to report the funding transaction ID to the UI or tests
when the transaction is pending, rather than after it has been
confirmed.
2017-02-24 11:37:33 -08:00
bryanvu
b21bd351e8 fundingmanager: change funding messages to use server.sendToPeer
Previously, during the channel funding process, peers sent wire
messages using peer.queueMsg. By switching to server.sendToPeer, the
fundingManager is more resilient to network connection issues or system
restarts during the funding process. With server.sendToPeer, if a peer
gets disconnected, the daemon can attempt to reconnect and continue the
process using the peer’s public key ID.
2017-02-21 19:21:19 -08:00
Olaoluwa Osuntokun
ef6ddcf788
lnrpc: include payment preimage in SendPayment response 2017-02-21 01:43:45 -08:00
Olaoluwa Osuntokun
3988473d45
lnrpc: add ping time to peer to the ListPeers response 2017-01-25 18:16:37 -08:00
Olaoluwa Osuntokun
faae0b3bf2
lnrpc: add new RPC to decode payment requests 2017-01-17 13:25:03 -08:00
Olaoluwa Osuntokun
765d9fd5e9
lnrpc: return route taken in SendPayment response 2017-01-16 20:37:15 -08:00
Olaoluwa Osuntokun
d79530e25d
lnrpc: add encoded payment requests to the ListInvoices response
This commit modifies the ListInvoice RPC to also return the encoded
payment request in the response. With this change it’ll be possible to
always obtain the encoded payment for any invoice, rather than only
being able to obtain it directly after the creation of an invoice.
2017-01-12 18:51:49 -08:00
Olaoluwa Osuntokun
a1d584f1b2
lnrpc: recompile protos 2017-01-09 19:01:10 -08:00
Olaoluwa Osuntokun
ca84c620ea
lnrpc: return encoded payReq in AddInvoice, accept payReq's in SendPayment 2017-01-02 15:31:44 -08:00
Olaoluwa Osuntokun
480fd8d03f
lnrpc: rename r_hash to payment_hash in Payment message 2016-12-30 16:38:54 -08:00
Olaoluwa Osuntokun
f9f840feb6
lnrpc: recompile protos 2016-12-27 16:44:45 -08:00
BitfuryLightning
eb4d0e035e channeldb: save outgoing payments
Add structure for outgoing payments. Saving payment in DB
after successful payment send. Add RPC call for listing
all payments.
2016-12-27 16:16:23 -08:00
Olaoluwa Osuntokun
a011a3f414
lnrpc: add testnet bool to GetInfo RPC, remove lightning_id 2016-12-12 15:56:54 -08:00
bryanvu
2bf5794645 lnrpc: added rpc support for querying a channel's satoshis sent/received
Added total_satoshis_sent and total_satoshis_received fields to the
ListChannels RPC call.
2016-11-22 14:57:03 -06:00
Olaoluwa Osuntokun
39262c66d6
lnrpc: add current block height and a 'synced 'bit to GetInfo response 2016-11-14 15:54:53 -08:00
Olaoluwa Osuntokun
df74d8981d
lnrpc: display creation date and settle date for Invoices 2016-11-12 18:09:36 -08:00
Olaoluwa Osuntokun
64396a69c3
lnrpc: add synchronous versions of SendPayment and OpenChannel
This commit adds synchronous version of the RPC’s to send payments over
channels and open new channels. The previous async versions of these
RPC calls have been removed from the REST interface.

Additionally for these two RPC calls any field which accepted byte
slices now also accept a variant of the field which is a hex-encoded
string.

The OpenChannelSync RPC is intended to be used along with either the
ListChannels or PendingChannels RPC to poll for a channels existence or
non-existence as a signal that the channel is finally open.
2016-11-10 17:33:34 -08:00
Olaoluwa Osuntokun
de1a3e1436
lnrpc: convert all instances of lightning_id to regular compressed pubkeys
This commit modifies a few of the RPC call which previously took a
lightning_id as their paramter to instead take a compressed public key
field. With this change must of the code within the daemon can be
simplified as we only use public keys everywhere throuhgout the daemon.

Signed-off-by: Olaoluwa Osuntokun <laolu32@gmail.com>
2016-10-27 19:41:51 -07:00
Olaoluwa Osuntokun
bde47f6ebb
lnrpc: returns the node's pubkey instead of lighting_id in ListPeers 2016-10-26 14:31:48 -07:00
Olaoluwa Osuntokun
566cd86a1d
lnrpc: add cursory REST support to the RPC server
This commit adds a REST interface to the existing gRPC server by
employing a simple http proxy auto-generated from the existing protobuf
files. Currently full-support for any streaming RPC’s are currently
untested. In addition to auto-generating a REST proxy server, a
swagger.json is also generated which allows for gRPC-like native
objects with higher-level clients, and also for auto-generated
documentation.

Due to limitations with accepting raw byte strings as parameters, some
RPC’s have been modified to take both raw-bytes and string arguments.
Additionally a new RPC has been added ‘NewWitnessAddress’ since the
proxy doesn’t currently support enum-based arguments.

Currently the proxy server is embedded within the daemon as an active
HTTP server, however we may want to package the proxy server as a
separate binary in the future. Similarly, we may want to add additional
configuration information which controls the optional inclusion of the
REST proxy.

Atm, just like the current gRPC interface, the REST API is fully
unauthenticated. Before moving to an initial alpha release after making
the necessary changes to meet the spec drafted in Milan, authentication
of the RPC interfaces will be addressed.
2016-10-15 14:39:00 -07:00