Commit Graph

5022 Commits

Author SHA1 Message Date
5d20c02ea8 channeldb: add new add+settle index to invoice database
In this commit, we add two new indexes to the invoice database: the add
index, and the settle index. These to indexes essentially form a time
series index on top of the existing primary index bucket. Each time an
invoice is added, we'll advance the addIndex seqno, and then create a
mapping from seqNo -> invoiceNum. Each time an invoice is settled, we'll
do the same, but within the settle index.

This change is required in order to allow callers to effectively seek
into the current invoice database in order to obtain notifications for
any invoices they may have missed out on while they were disconnected.
This will allow us to implement robust streaming invoice notifications
within lnd to ensure that clients never miss an event.
2018-07-06 12:21:56 -07:00
fc0f0d33b2 channeldb: add new AmtPaid field to the Invoice struct
In this commit, in order to allow the caller to specify the amount that
was ultimately accepted for an invoice, the SettleInvoice method has
gained a new parameter: amtPaid. SettleInvoice will now populate the
final amount paid in the database upon db commit.
2018-07-06 12:21:56 -07:00
a32f2b79da htlcswitch: modify the InvoiceDatabase interface to allow specifying final payment amt
In this commit, we modify the InvoiceDatabase slightly to allow the link
to record what the final payment about for an invoice was. It may be the
case that the invoice actually had no specified value, or that the payer
paid more than necessary. As a result, it's important that our on-disk
records properly reflect this.

To fix this issue, the SettleInvoice method now also accepts the final
amount paid.

Fixes #856.
2018-07-06 12:21:55 -07:00
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
29a27bbc3a test: ensure we always cancel active streaming notifications 2018-07-06 12:21:54 -07:00
dbf7e4525a lntest: ensure we always cancel active streaming notifications 2018-07-06 12:21:54 -07:00
92029370ec README: use HTTPS instead of HTTP 2018-07-06 14:20:51 -05:00
a0b2fadea3 Merge pull request #1458 from cfromknecht/add-addrs-to-codec
channeldb: expand codec to include net.Addr types
2018-07-03 22:50:22 -05:00
d83f4fbb85 Merge pull request #1498 from yaslama/fix-1488
Fix the ability to disable p2p listening
2018-07-03 22:40:02 -05:00
0a045f8651 Merge pull request #1482 from cfromknecht/uniform-fee-update-timeout
htlcswitch/link: correct bias in fee update backoff
2018-07-03 22:27:22 -05:00
552a371f09 Merge pull request #1475 from cfromknecht/disable-mainnet-debug-htlc
config: disable debug-htlc mode on mainnet
2018-07-03 22:26:45 -05:00
9815142922 Merge pull request #1497 from hackerrdave/invoiceregistry-comment-updates
update comment for AddInvoice
2018-07-03 22:05:24 -05:00
1778a3c38e Merge pull request #1480 from cfromknecht/fix-server-log-msgs
server: log pubkey hex in connection callbacks
2018-07-03 22:00:25 -05:00
5626fd6c9b Merge pull request #1478 from wpaulino/resolve-tor-dns-host
config: only normalize and resolve tor DNS host if it has changed
2018-07-03 21:59:49 -05:00
bc04bfdde2 Merge pull request #1471 from cfromknecht/lnwire-query-sids-corpus
[lnwire]: align behavior of query sids corpus for zero-length slices
2018-07-03 21:58:00 -05:00
184f1e41fc Merge pull request #1469 from cfromknecht/expose-lnwallet-commit-scripts
lnwallet: export commit script helper methods
2018-07-03 21:53:17 -05:00
85526dfa46 Merge pull request #1459 from wpaulino/identify-peer-failed-conn
brontide: identify remote address of failed connection
2018-07-03 21:46:03 -05:00
3c1d06d54a Merge pull request #1486 from Roasbeef/minor-forwarding-perf-improvements
htlcswitch+routing: minor forwarding perf improvements
2018-07-03 21:44:16 -05:00
5be6993a56 server: log pubkey hex in connection callbacks 2018-07-03 17:09:10 -07:00
7d116abedb config: disable debug-htlc mode on mainnet 2018-07-03 17:08:53 -07:00
61c2493b7d lnwire/query_short_chan_ids: short circuit if 0 sids
In this commit, we alter the behavior of the regular
short channel id encoding, such that it returns a nil
slice if the decoded number of elements is 0. This is
done so that it matches the behavior of the zlib
decompression, allowing us to test both in using the
same corpus.
2018-07-03 17:08:40 -07:00
8cc217b526 lnwire/lnwire_test: use nil slice when 0 sids
Modifies the behavior of the quick test for
MsgQueryShortChanIDs, such that the generated
slice of expected short chan ids is always nil
if no elements are returned. This mimics the
behavior of the zlib decompression, where
elements are appended to the slice, instead of
assigning to preallocated slice.
2018-07-03 17:08:39 -07:00
92cbfbccca lnd_test: remove itest race caused by mining extra block 2018-07-03 17:08:21 -07:00
2843df88c0 lnwallet/script_utils_test: use public commit script helpers 2018-07-03 17:07:48 -07:00
a66c488546 lnwallet/wallet: use public witness script hash helper 2018-07-03 17:07:48 -07:00
bb808a1937 lnwallet/channel: use public variant of script helpers 2018-07-03 17:07:48 -07:00
b507ea0ca3 lnwallet/script_utils: expose commit script helpers
Makes the helper methods for constructing witness script
hash and to-local outputs. This will allow watchtowers to
import and reuse this logic when sweeping outputs.
2018-07-03 17:07:48 -07:00
75d7436f7a channledb/codec: add net.Addr and []net.Addr to codec 2018-07-03 17:07:10 -07:00
4cb7953f66 channledb/addr: remove silent encoding failure for unknown types 2018-07-03 17:07:10 -07:00
c6c442f6b6 channledb/addr_test: add negative test for unknown types 2018-07-03 17:07:10 -07:00
21674c05e5 channeldb/codec: add concrete error for unknown types 2018-07-03 17:07:09 -07:00
1d5189bd25 channeldb/forwarding_log: use public Read/WriteElements 2018-07-03 17:07:09 -07:00
30ff91913d channeldb/channel: use public Read/WriteElements 2018-07-03 17:07:09 -07:00
ec029ac7fd channeldb/codec: exposes Read/WriteElements 2018-07-03 17:07:09 -07:00
c9c47b3a51 Fix the ability to disable p2p listening 2018-07-03 07:54:17 +03:00
d98507abcf update comment for AddInvoice 2018-07-02 23:20:17 -04:00
d889644f52 htlcswitch: use Batch for calls within ackSettleFail 2018-06-30 17:15:31 -05:00
3ad15c5f42 hltcswitch: use a logClosure to delay spew evaluation until log print time 2018-06-30 17:15:04 -05:00
39c1f46f85 routing: new newLogClosure to delay spew evaluation until log print time
In this commit, we update the generateSphinxPacket to use newLogClosure
to delay the spew evaluation until log print time. Before this commit,
even if we weren't on the trace logging level, the spew call would
always be evaluated.
2018-06-30 17:14:28 -05:00
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
12f74f762d htlcswitch/test_utils: use realistic link timeouts 2018-06-30 11:51:47 -07:00
10ecf2307f htlcswitch/link_test: use realistic link timeouts 2018-06-30 11:42:36 -07:00
5fa8124aa1 htlcswitch/link: correct bias in fee update backoff
This commit corrects the distribution used to
schedule a link's randomized backoff for fee
updates. Currently, our algorithm biases the
lowest value in the range, with probability
equal to lower/upper, or the ratio of the lower
bound to the upper. This distribution is skewed
more heavily as lower approaches upper.

The solution is to sample a random value in the
range upper-lower, then add this to our lower
bound. The effect is a uniformly distributed
timeout in [lower, upper).
2018-06-30 10:22:38 -07:00
9205720bea Merge pull request #1477 from Roasbeef/proper-exit-hop-cltv-fix
channeldb+htlcswitch: parse out min cltv delta from payreq rather than modifying the db
2018-06-29 18:11:19 -07:00
319b08ccc6 Merge pull request #1479 from matthewlilley/documentation
Add make instructions for Windows WSL users
2018-06-29 18:10:41 -07:00
c571b04236 Add make instructions for Windows WSL users 2018-06-30 00:48:31 +01:00
f5c82983e2 config: only normalize and resolve tor DNS host if it has changed
In the event that the default Tor DNS host wouldn't resolve, it would
prevent `lnd` from starting due to the failed lookup. This should fail
silently as it's only crucial during bootstrapping. However, if the user
has explicitly modified this, we should let them know of the error
immediately.
2018-06-29 16:25:57 -07:00
c19c872cff lnd: update invoiceRegistry to match new switch requirements 2018-06-29 16:03:51 -07:00
2196d9375e htlcswitch: obtain the min final CLTV delta directly from the InvoiceDatabase
In this commit, we modify the existing logic that would attempt to read
the min CLTV information from the invoice directly. With this route, we
avoid any sort of DB index modifications, as this information is already
stored within the payment request, which is already available to the
outside callers. By modifying the InvoiceDatabase interface, we avoid
having to make the switch aware of what the "primary" chain is.
2018-06-29 16:03:13 -07:00
c914de177b Revert "rpc: include the FinalCltvDelta when writing new invoices to disk"
This reverts commit 4e264ee88e.
2018-06-29 12:40:53 -07:00