Commit Graph

8984 Commits

Author SHA1 Message Date
Oliver Gugger
b99a457dd0
lnrpc: format rpc.proto and remove json_name fields
We now use the jsonpb marshaler to convert the RPC responses to
JSON in lncli and REST. The jsonpb has a setting to use the
original name as defined in the proto file and the explicit
json_name definition is not necessary any more.
The jsonpb setting is called OrigName and needs to be true.
2020-03-07 11:23:06 +01:00
Oliver Gugger
e435cd5fc6
lncli: use original snake_case names for JSON serializing
Because we now use printRespJSON everywhere where we print RPC
responses as JSON, we can simply instruct the jsonpb marshaler to
use the original snake_case name specified in the proto file for
the JSON field names and not the default camelCase.
2020-03-07 11:22:36 +01:00
Oliver Gugger
165769ea82
lncli: use printRespJSON for probability response 2020-03-07 11:22:35 +01:00
Conner Fromknecht
ecf7d82904
Merge pull request #4055 from cfromknecht/remove-failed-channels
peer: remove unused failedChannels channels map
2020-03-06 16:50:57 -08:00
Conner Fromknecht
e4090c3c67
peer: remove unused failedChannels channels map 2020-03-06 15:45:34 -08:00
Conner Fromknecht
089953ea97
Merge pull request #4045 from cfromknecht/list-channels-with
cmd/lncli: add --with flag to list channels
2020-03-06 12:38:34 -08:00
Oliver Gugger
092a0b4a0a
Merge pull request #4053 from turcane/master
sample-lnd.conf: remove deprecated wtclient option
2020-03-06 09:02:22 +01:00
Conner Fromknecht
11532df5f3
cmd/lncli: add --peer flag to list channels
This commit adds a flag to listchannels that filters by remote pubkey.
2020-03-05 20:44:18 -08:00
Conner Fromknecht
c2ec4a450d
Merge pull request #4040 from cfromknecht/fee-report-sid
lnrpc+rpcserver: expose short chan id on feereport
2020-03-05 20:16:11 -08:00
Ediz Turcan
a520008960
sample-lnd.conf: missing full stop added (typo) 2020-03-05 22:08:38 +01:00
Ediz Turcan
bf5ccce786
sample-lnd.conf: remove deprecated wtclient option 2020-03-05 20:33:37 +01:00
Conner Fromknecht
5c9b336a61
lnrpc+rpcserver: expose short chan id on feereport
This commit adds each channel's short chan id to the `feereport` rpc.
Without this, it can be tedious to lookup more info about a particular
channel since most rpcs only accept short chan ids and not channel
points. For instance, now one can take a channel id from `feereport` and
look it up directly via `getchaninfo` to examine the policy in more
detail.
2020-03-04 15:37:17 -08:00
Johan T. Halseth
42e65d4ae5
Merge pull request #4030 from halseth/route-cutoff-flake-fix
chancloser: unregister channel before db modification
2020-03-04 13:14:32 +01:00
Johan T. Halseth
03a0706593
chancloser: unregister channel before db modification
This fixes a race during channel closing, where the last channel state
update was still not finished when we set the channel close bit in the
database. This lead to a flake during integration tests, where the last
state update would not finish, and the channel wasn't closes
successfully.

We fix it by first unregistering the channel, making sure it is removed
fully from the link before doing the db modification.
2020-03-04 10:31:38 +01:00
Conner Fromknecht
1467cd4dd3
Merge pull request #4035 from elkanatovey/master
fix typo
2020-03-02 07:23:59 -03:00
Conner Fromknecht
e3d86780af
Merge pull request #4013 from fguisso/wtclientrpc
Remove remaining wtclientrpc flags
2020-02-27 16:19:11 -03:00
Danny Paz
ccafee40ee
README: change slack link from invite to lightning.engineering 2020-02-27 11:23:14 -03:00
elkanatovey
5ff017664c fix typo 2020-02-27 15:22:00 +02:00
Olaoluwa Osuntokun
237ef9c9ba
Merge pull request #4003 from bitromortac/listinvoices-reversed-flag
lncli: change listinvoices reversed flag to paginate-forwards
2020-02-26 11:53:44 -03:00
bitromortac
926d4ba52e lncli: change listinvoices reversed flag to paginate-forwards
This commit renames the `reversed` pagination flag to
`paginate-forwards`, which is off by default. In order to
access older invoices one can set the paginate-forwards flag,
which is more intuitive than setting the reversed flag to false.
2020-02-25 11:33:55 +01:00
Johan T. Halseth
38b521d87d
Merge pull request #3961 from carlaKC/3709-cooperativecloseinitiator
channeldb: Indicate cooperative close initator
2020-02-21 14:27:48 +01:00
carla
b3e6395635
lntest: check close initiator in basic channel itest
Update channel updates and subscription itest to check that close
initiator is appropriately set for cooperative and force closes for the
local and remote party.
2020-02-21 13:53:57 +02:00
carla
e74b6f88b7
rpcserver: display open and close initiator 2020-02-21 13:53:51 +02:00
carla
b55470e9a9
lnrpc: add open and close initiator to close summary
Add an initiator enum which allows up to display an unknown value for
channels that are not in the historical chan bucket, rather than having
and ambiguous false value also representing no-value. A both option is
added to cover the case where both parties initiated a close on chain.
2020-02-21 13:53:45 +02:00
carla
4eb3036f67
contractcourt: record force and breach close initiator 2020-02-21 13:53:43 +02:00
carla
c9915e027e
contractcourt/test: replace timeouts with constants 2020-02-21 13:34:26 +02:00
carla
11d975bd13
channeldb: save channel status on channel close
Add an optional channel status CloseChannel which will be stored on the
hitsorical channel which is persisted at channel close. This status is
used to set the close initiator for channels that do not complete the
funding flow or we abandon. In follow up commits, this status will be
used to record force and breach closes. The value is written to the
historical channel bucket for diplay over rpc.
2020-02-21 13:33:53 +02:00
carla
d3cb6ad869
channeldb: store close initiator status
This commit adds two new channel statuses which indicate the party that
initatited closing the channel. These statuses are set in conjunction
with the existing commit broadcast status so that we do not need to
migrate existing logic to handle multiple types of closes. This status
is set for locally initiated force closes in this commit because they
follow a similar pattern to cooparative closes, marking the commitment
broadcast then proceeding with tx broadcast. Remote force closes are
added in the following commit, as they are handled differently.
2020-02-21 13:33:49 +02:00
carla
8d632b8022
channeldb: add historical channel bucket lookup 2020-02-21 13:23:30 +02:00
Olaoluwa Osuntokun
94717a2088
Merge pull request #4017 from Roasbeef/walletdb-update-addr-fix
build: udpate to latest btcwallet version with rescan addr fix
2020-02-20 18:01:09 -08:00
Johan T. Halseth
214c73a9a0
Merge pull request #4026 from guggero/lint-fix
travis: remove git clone depth limitation to fix linter
2020-02-20 22:33:13 +01:00
Oliver Gugger
ac28b2c692
travis: remove git clone depth limitation to fix linter
By default, Travis-CI does `git clone --depth=50` which limits the
repo to the last 50 commits. Because we do linting against an old
commit, it cannot be found any more. We remove the limit completely
to not run into this problem again.
2020-02-20 20:59:25 +01:00
Johan T. Halseth
5d5069c477
Merge pull request #3691 from halseth/link-bandwitch-amt-aware
lnwallet: Make available balance HTLC fee aware
2020-02-20 17:56:20 +01:00
Carla Kirk-Cohen
80af2957ac
Merge pull request #3781 from carlaKC/3420-htlcForwarding
htlcswitch: add htlcNotifier
2020-02-20 14:34:21 +02:00
carla
c0a4923dc1
htlcswitch: add htlc notifier test 2020-02-19 18:13:18 +02:00
carla
71fdd755b4
htlcswitch: notify local receive settles 2020-02-19 18:06:00 +02:00
carla
6bd0de257a
htlcswitch: notify incoming link failures
This commit adds link failure notifications for failures which occur
on our incoming link. These failures may be receives which we failed or
forwards which we could not parse.
2020-02-19 18:05:49 +02:00
carla
22d370aa51
htlcswitch: notify send forward failures and settles
Add notifications for local initiated sends settles and forwarding
failures. As with link failures, local send settles and forwarding
failures are reported directly to the router so must have their own
notification handling.
2020-02-19 18:05:45 +02:00
carla
79a890fa48
htlcswitch: notify outgoing link failures for local sends
Notify link failures for our own payments. Separate handling code is
required for local payment link failures because we do not pass these
failures back through the switch (like we do for link failures for
forwards), but rather send them straight back to the router. Our own
sends have the payment ID saved in the incoming htlc ID of the packet's
incoming circuit. This change replaces that value with for the sake
of consistent notifying of sends and receives from our node.
2020-02-19 18:05:12 +02:00
carla
937062b6d3
htlcswitch: refactor handleLocalDispatch
Split handleLocalDispatch into an extra handleLocalAddHTLC function so
we can easily notify an error should one occur adding the htlc.
2020-02-19 18:04:51 +02:00
carla
fc0ee06a99
htlcswitch: add notifications for forwards
This commit adds notifications for htlcs which are forwarded through
our node. Forwards are notified when the htlc is added on our ougoing
link, settles when we send a settle message to the downstream peer.
If a failure occurs, we check whether it occurred at our node, then
notify a link or forwarding failure accordingly.

Note that this change also adds forward event notifications for sends
which are initiated by our node because the handling code for adding
a htlc which originates from our node is the same as that for handling
forwards. Htlcs for our locally initiated sends have our internal pid
set in the incoming htlcs id field, so we extract this value and notify
with a zero htlc id to be consistent with receives (which have zero
outgoing circuits). Subsequent settles or failures are not noitfied
for local sends in this commit, and will be handled in a follow up.
2020-02-19 18:03:22 +02:00
carla
b70080a267
htlcswitch: failAddPacket with full packet information
This commit sets more fields on the htlcPacket created to fail adding
a htlc packet to the switch for notification purposes. This new data is
copied by value from the original packet. The packet is then failed
back to the peer that forwarded us the packet, which is handled by
handledownstream packet. The values added to the packet are not used
in the handling of a failed packet.
2020-02-19 17:51:53 +02:00
carla
abf780bf03
multi: add htlcNotifier interface to switch and link
In this commit, a htlcNotifier interface is added to allow for easy
unit testing. Instances of the HtlcNotifier are added to the server,
switch and link.
2020-02-19 17:50:28 +02:00
carla
2074820d85
htlcswitch: add htlcnotifier
This commit adds a HTLCNotifier to htlcswitch which HTLC events
will be piped through to provide clients with subscriptions to
HTLC level events.

The event types added are forward events (which occur for sends
from and forwards through our node), forward failues (when a
send or forward fails down the line), settles for forwards or
receives to our node and link failures which occur when a htlc
is failed at our node (which may occur for a send, receive or
foreward).
2020-02-19 17:50:19 +02:00
Johan T. Halseth
3e5f2e437d
lnwallet/channel: add TODO 2020-02-19 12:27:42 +01:00
Johan T. Halseth
e398544b8b
lnwallet/channel: take remote commitment view into availableBalance calculation
Since our HTLC must also be added to the remote commitment, we do the
balance caluclation also from the remote chain perspective and report
our minimum balance from the two commit views as our available balance.
2020-02-19 12:27:42 +01:00
Johan T. Halseth
f94464d987
lnwallet: take remote initiator's balance into account
When we send non-dust HTLCs as the non-initiator, the remote party will
have to pay the extra commitment fee. To account for this we figure out
if they can afford paying this fee, if not we report that we only have
balance available for dust HTLCs, since these HTLCs won't increase the
commitment fee.
2020-02-19 12:27:42 +01:00
Johan T. Halseth
9ff79ae595
lnwallet/channel: account for HTLC fee when reporting available balance 2020-02-19 12:27:42 +01:00
Johan T. Halseth
5e89d5b6c2
link+lnwallet: move bandwidth channel reserve validation into channel
Since we want to handle the edge case where paying the HTLC fee would
take the initiator below the reserve, we move the subtraction of the
reserve into availableBalance where this calculation will be performed.
2020-02-19 12:27:42 +01:00
Johan T. Halseth
58dec10680
lnwallet/channel: break up availableBalance 2020-02-19 12:27:41 +01:00