Commit Graph

376 Commits

Author SHA1 Message Date
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
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