Commit Graph

87 Commits

Author SHA1 Message Date
Joost Jager
1b2816006f
htlcswitch/test: align test invoice cltv expiry 2019-04-05 11:36:16 +02:00
Joost Jager
32f2b047e8
htlcswitch: hodl invoice
This commit modifies the invoice registry to handle invoices for which
the preimage is not known yet (hodl invoices). In that case, the
resolution channel passed in from links and resolvers is stored until we
either learn the preimage or want to cancel the htlc.
2019-03-15 10:09:17 +01:00
Joost Jager
1f41a2abce
htlcswitch: abtract invoice from link
This commit detaches signaling the invoice registry that an htlc was
locked in from the actually settling of the htlc.

It is a preparation for hodl invoices.
2019-03-15 10:09:15 +01:00
Joost Jager
aeb35d9898
htlcswitch/test: use real invoice registry with temp db as mock
In further commits the behaviour of invoice registry becomes more
intrinsically connected to the link. This commit prepares for that by
allowing link and registry to be tested as a single unit.
2019-03-15 10:09:12 +01:00
Joost Jager
9643b45dbc
htlcswitch/test: move preimage cache to server level
In this commit the preimage cache is instantiated on the mock server
level where it belongs. Previously it was a cache shared across all mock
servers.
2019-03-15 10:08:40 +01:00
Conner Fromknecht
f39edd8000
peer: add SendMessageLazy 2019-03-05 17:08:22 -08:00
Olaoluwa Osuntokun
cbe0bf6a22
Merge pull request #2501 from cfromknecht/batch-preimage-writes
htlcswitch: batch preimage writes/consistency fix
2019-02-21 17:00:00 -08:00
Conner Fromknecht
29f07a58cb
cnct+lnwl+hswc: use lntypes.Preimage for witness beacon 2019-02-19 17:06:00 -08:00
Conner Fromknecht
30f61b7630
multi: make AddPreimage variadic, optimistically compute key
In this commit, we modify the WitnessCache's
AddPreimage method to accept a variadic number
of preimages. This enables callers to batch
preimage writes in performance critical areas
of the codebase, e.g. the htlcswitch.

Additionally, we lift the computation of the
witnesses' keys outside of the db transaction.
This saves us from having to do hashing inside
and blocking other callers, and limits extraneous
blocking at the call site.
2019-02-19 17:05:04 -08:00
Wilmer Paulino
abdd01ed9a
ticker+htlcswitch: rename Mock -> Force 2019-02-12 16:05:24 -08:00
Joost Jager
1b87fbfab2
invoices+htlcswitch+lnrpc: cancel invoice 2019-02-06 07:29:18 +01:00
Valentine Wallace
bdd8ce14c9 switch: notify the ChannelNotifier on newly active/inactive channels. 2019-02-05 18:17:54 -08:00
Valentine Wallace
f6cffa8f4b htlcswitch/link: add ChannelPoint() to retrieve the channel outpoint.
This function will be used in the switch to retrieve the channel point for a link,
allowing the switch to retrieve individual channels from the database.
2019-02-05 18:17:54 -08:00
Joost Jager
bacd92418a
invoices: use lntypes.Hash and lntypes.Preimage
Previously chainhash.Hash was used, which converts to/from string in
reversed format. Payment hashes and preimages are supposed to be
non-reversed.
2019-02-01 09:42:29 +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
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
423dd8ab9b
lnwallet: expose relay fee on fee estimators 2018-12-18 10:50:04 +01:00
Johan T. Halseth
54a608d09d
htlcswitch+discovery mock: adhere to new lnpeer interface 2018-09-28 09:05:18 +02:00
Olaoluwa Osuntokun
19552b0dbf
htlcswitch+funding+discovery: update mock peers to add new QuitSignal method 2018-08-25 17:30:15 -07:00
Conner Fromknecht
9b52c510e9
htlcswitch/mock: remove new line to satisfy linter 2018-08-21 19:23:24 -07:00
Vadym Popov
033fd3c83d
htlcswitch: add test for integrated control tower 2018-08-21 19:23:22 -07:00
Conner Fromknecht
53b58a1eb3
htlcswitch/mock: drop messages if link is not online
In this commit, we modify the readHandler w/in
the mock peer to drop messages if it is unable
to find the target link. This has led to observed
race conditions related to removing a link and still
attempting to deliver messages. By removing this,
the readHandler shouldn't fail the test as a result.
2018-08-20 19:23:15 -07:00
Valentine Wallace
1ffc3bb82e
multi: update to latest RegisterBlockEpochNtfn interface 2018-08-10 01:08:57 -07:00
Olaoluwa Osuntokun
d3b1b9aa98
Merge pull request #1668 from cfromknecht/interface-tickers
Ticker Package
2018-08-09 20:55:25 -07:00
Wilmer Paulino
9d2eeb6304
multi: update to latest fee estimation interface 2018-08-09 17:29:52 -07:00
Conner Fromknecht
6a709526d8
htlcswitch/mock: remove mockTicker, use ticker.MockNew 2018-08-09 02:48:07 -07:00
Olaoluwa Osuntokun
53416260e3
htlcswitch: update test to account for new ChainNotifier API 2018-07-31 21:28:58 -07:00
Olaoluwa Osuntokun
3268019326
htlcswitch: update mock notifier due to recent API changes 2018-07-31 21:28:50 -07:00
Johan T. Halseth
d7b2977e8c
multi test: remove mempool bool from RegisterSpendNtfn 2018-07-22 23:09:08 +02:00
Wilmer Paulino
3ab17063ff
multi: satisfy new lnpeer interface 2018-07-19 12:32:29 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Olaoluwa Osuntokun
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
Olaoluwa Osuntokun
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
Olaoluwa Osuntokun
74ec9147b1
htlcswitch: extend the HtlcSatifiesPolicy to also accept timelock/height info
In this commit, we extend the existing HtlcSatifiesPolicy method to also
accept timelock and height information. This is required as an upcoming
commit will fix an existing bug in the forwarding logic wherein we use
the time lock policies of the incoming node rather than that of the
outgoing node.
2018-06-26 17:29:40 -07:00
Wilmer Paulino
8198466972
multi: move block epochs dependency from links to switch
In this commit, we move the block height dependency from the links in
the switch to the switch itself. This is possible due to a recent change
on the links no longer depending on the block height to update their
commitment fees.

We'll now only have the switch be alerted of new blocks coming in and
links will retrieve the height from it atomically.
2018-06-13 17:41:21 -07:00
Conner Fromknecht
4dace6c941
htlcswitch/multi: update tests for lnpeer.Peer iface 2018-06-08 16:29:49 -07:00
maurycy
3be08e69cf multi: 64bit aligment of atomic vars on arm/x86-32 2018-06-04 20:02:34 -07:00
Johan T. Halseth
4dfb4547a0
htlcswitch: remove unused Disconnect from Peer interface 2018-05-25 06:58:24 +02:00
Olaoluwa Osuntokun
b73eef12b3
Merge pull request #945 from jimpo/decayedlog
Move DecayedLog from lightning-onion to htlcswitch.
2018-05-10 20:06:53 -07:00
Conner Fromknecht
1dace1fed4
htlcswitch/mock: impl UpdateShortChanID w/ error 2018-05-09 16:07:25 -07:00
Olaoluwa Osuntokun
72f48b6abe
htlcswitch+server: ensure we always send an update w/ a TempChannelFailure
In this commit, we ensure that any time we send a TempChannelFailure
that's destined for a multi-hop source sender, then we'll always package
the latest channel update along with it.
2018-05-08 13:00:28 -04:00
Jim Posen
5d0d7a8511 htlcswitch: Move DecayedLog definition from sphinx package.
This moves over the implementation deleted in
https://github.com/lightningnetwork/lightning-onion/pull/22 to
structure package dependencies better.
2018-05-02 00:22:24 -07:00
Olaoluwa Osuntokun
ec8e3b626d
htlcswitch: update unit tests to account for recent API changes 2018-04-06 14:52:00 -07:00
Olaoluwa Osuntokun
f53a99e18e
htlcswitch: modify the SendMessage method on the Peer interface to optionally block
In this commit, add a new argument to the SendMessage method to allow
callers to request that the method block until the message has been sent
on the socket to the remote peer.
2018-04-04 17:36:44 -07:00
Conner Fromknecht
cee221f8cc
htlcswitch/mock: add Reextract NOP to mockObfuscator 2018-03-13 16:33:28 -07:00
Conner Fromknecht
1b7afc6da5
htlcswitch/mock: add mock fwding log to initSwitchWithDB 2018-03-09 21:08:44 -08:00
Conner Fromknecht
3048dfd4be
htlcswitch/mock: adds Encode/Decode to mock obfuscator 2018-03-09 21:08:43 -08:00
Conner Fromknecht
06fb524a3b
htlcswitch/mock: update mock obfuscator and iterators w/ new sphinx API 2018-03-08 21:12:04 -05:00
Olaoluwa Osuntokun
4b20e805fe
multi: update packages due to recent SignDescriptor and WalletController changes 2018-03-06 16:04:03 -05:00
Olaoluwa Osuntokun
473dfd115b
htlcswitch: add set of tests for the forwarding log 2018-03-06 13:56:11 -05:00