Commit Graph

7953 Commits

Author SHA1 Message Date
Joost Jager
064e8492de
cnct+htlcswitch+invoices: move invoice parameter check out of link
This commit is the final step in making the link unaware of invoices. It
now purely offers the htlc to the invoice registry and follows
instructions from the invoice registry about how and when to respond to
the htlc.

The change also fixes a bug where upon restart, hodl htlcs were
subjected to the invoice minimum cltv delta requirement again. If the
block height has increased in the mean while, the htlc would be canceled
back.

Furthermore the invoice registry interaction is aligned between link and
contract resolvers.
2019-05-15 14:42:12 +02:00
Joost Jager
e095819385
lnd_test: add hodl parameter to createThreeHopNetwork 2019-05-15 14:42:09 +02:00
Joost Jager
bf0af12fae
lnd_test: move chain claim tests to separate files
This commit splits out several integration tests that will be modified
in a follow up commit to separate files. The current lnd_test.go file is
10k+ loc which makes it harder to handle by tools and it isn't good for
overview either.
2019-05-15 14:42:06 +02:00
Johan T. Halseth
b917820c5b
lntest/node: set up InvoicesClient for HarnessNode 2019-05-15 14:42:04 +02:00
Joost Jager
d8dac49112
cnct: add invoice registry interface
Create an interface type to be able to mock the registry in unit tests.
2019-05-15 14:42:01 +02:00
Joost Jager
1a80a1e540
witness_beacon: do not look up invoice preimages
This commit isolates preimages of forwarded htlcs from invoice
preimages. The reason to do this is to prevent the incoming contest
resolver from settling exit hop htlcs for which the invoice isn't marked
as settled.
2019-05-15 14:41:58 +02:00
Joost Jager
99e42ddde6
cnct: be stricter about matching preimages
The former tryApplyPreimage function silently ignored invalid preimages.
This could mask potential bugs. This commit makes the logic stricter and
generates an error in case an unexpected mismatch occurs.
2019-05-15 14:41:55 +02:00
Joost Jager
ec6a35d6e8
cnct: do not depend on ChainIO in incoming contest resolver
New behaviour of the chain notifier to always send the current block
immediately after registration takes away the need to make a separate
GetBestBlock call on ChainIO.
2019-05-15 14:41:52 +02:00
Joost Jager
d55a8b7b29
channel+cnct: remove preimage from channel and resolution
Now that the success resolver preimage field is always populated by the
incoming contest resolver, preimage lookups earlier in the
process (channel and channel arbitrator) can mostly be removed.
2019-05-15 14:41:49 +02:00
Joost Jager
6886a0117f
cnct: always create incoming contest resolver
One of the first things the incoming contest resolver does is checking
if the preimage is available and if it is, convert itself into a success
resolver.

This behaviour makes it unnecessary to already determine earlier in the
process whether an incoming contest or a success resolver is needed.

By having all incoming htlcs go through the incoming contest resolver,
the number of execution paths is reduced and it becomes easier to
ascertain that the implemented logic is correct.

The only functional change in this commit is that a forwarded htlc for
which is the preimage is known, is no longer settled when the htlc is
already expired. Previously a success resolver would be instantiated
directly, skipping the expiry height check.

This created a risk that the success resolver would never finish,
because an expired htlc could already have been swept by the remote
party and there is no detection of this remote spend in the success
resolver currently.

With the new change, the general direction that an expired htlc
shouldn't be settled and instead given up on is implemented more
consistently.

This commit prepares for fixing edges cases related to hodl
invoice on-chain resolution.
2019-05-15 14:41:47 +02:00
Joost Jager
863bf2f91b
Merge pull request #1662 from joostjager/raw
lnrpc: better payment failure reporting
2019-05-15 14:38:52 +02:00
Joost Jager
c97592692c
routerrpc: add SendToRoute with structured failure message 2019-05-15 11:54:46 +02:00
Joost Jager
b2eb2619bf
routerrpc: connect UnmarshallRoute to existing config fields 2019-05-15 11:54:46 +02:00
Joost Jager
ba3fa94268
lnrpc+routing: Only accept a single route for SendToRoute 2019-05-15 11:54:46 +02:00
Neevai Esinly
9b516b7930 Added NETWORK environment variable to btcd and ltcd services 2019-05-15 11:35:03 +03:00
Conner Fromknecht
4d26e90ef3
routing/router: nil path pubkeys before spewing 2019-05-14 20:32:58 -07:00
Conner Fromknecht
f79a9d97a9
Merge pull request #3068 from AdamISZ/commentfixes1
Typo corrections in various comments
2019-05-14 17:02:44 -07:00
Johan T. Halseth
c706b9549a
Merge pull request #3019 from sangaman/subscribe-single-invoice-rhashstr
invoicesrpc: SubscribeSingleInvoice check RHashStr
2019-05-14 14:28:31 +02:00
Joost Jager
0b66d56aab
routerrpc: move UnmarshallRoute to sub server 2019-05-13 12:55:56 +02:00
Daniel McNally
c9afa6469f
invoicesrpc: SubcribeSingleInvoiceRequest fix
This fixes a bug where the RHashStr field on the PaymentHash request for
SubscribeSingleInvoice was being ignored. This replaces the PaymentHash
message for the SubscribeSingleInvoice request with a new message called
SubscribeSingleInvoiceRequest that contains only the RHash field.
2019-05-10 22:02:58 -04:00
Olaoluwa Osuntokun
f8c824fb1d
Merge pull request #3054 from joostjager/remove-k-shortest
lnrpc+routing: remove k shortest path finding
2019-05-10 15:51:01 -07:00
Olaoluwa Osuntokun
29a60f39e2
Merge pull request #2716 from halseth/getutxo-cancel-interface-change
Cancel long-running Neutrino GetUTXO calls on quit
2019-05-10 15:45:57 -07:00
AdamISZ
6e054886d8 Typo corrections in various comments 2019-05-10 17:15:54 +02:00
michael1011
bb28d3a4af
added conf_target and sat_per_byte to closeallchannels 2019-05-10 15:03:22 +02:00
Olaoluwa Osuntokun
fb1819bf7f
Merge pull request #3064 from halseth/route-serialization
[Reliable payments] add routing.Route (de)serialization + test
2019-05-09 16:46:14 -07:00
Olaoluwa Osuntokun
c4319dafd8
Merge pull request #3065 from halseth/non-nil-curve-pubkey
[reliable payments] channeldb/graph: don't nil curve of returned PubKey
2019-05-09 16:41:49 -07:00
Geoff Taylor
b3d3ba8612
Root Dockerfile now builds subservers
Root Dockerfile now builds subservers required for Loop functionality.
2019-05-09 15:16:36 +01:00
Johan T. Halseth
f589c86963
lnwallet/wallet: add missing error handling 2019-05-09 14:44:53 +02:00
Johan T. Halseth
183adf6e61
chainntnfs/neutrino: provide n.quit as neutrino QuitChan option
This will make sure a long-running rescan can be canceled in the case
the notifier is shutting down.
2019-05-09 14:44:53 +02:00
Johan T. Halseth
6110182371
lnwallet/btcwallet: provide cancel chan as neutrino QuitChan option
This will make sure a long-running rescan can be canceled in case
Neutrino is the backend.
2019-05-09 14:44:52 +02:00
Johan T. Halseth
10070ecab7
lnwallet: make BlockChainIO.GetUTXO take cancel chan
Use quit channels as cancel chan for call to GetUTXO.
2019-05-09 14:44:47 +02:00
Johan T. Halseth
beb5d14ed9
lnwallet/btcwallet: add compile time check for BlockChainIO interface 2019-05-09 14:44:41 +02:00
Johan T. Halseth
21c989ffcc
channeldb/graph: don't nil curve of returned PubKey
Nilling the key would cause signature verification to crash if the
returned key was used.

A test to exercise the behavior is added.
2019-05-09 10:49:58 +02:00
Johan T. Halseth
89fd43ebcb
channeldb: add Route (de)serialization + test
We will store the routes used during payment attempts, so we need
serialization code.
2019-05-09 09:59:43 +02:00
Joost Jager
7a5bd29a69
lnrpc+routing: remove k shortest path finding 2019-05-07 19:54:06 +02:00
Johan T. Halseth
c4415f0400
Merge pull request #3044 from cfromknecht/spelling-fixes
multi: fix spelling mistakes
2019-05-07 08:50:36 +02:00
Olaoluwa Osuntokun
8307ac89a4
Merge pull request #3050 from cfromknecht/break-router-rescans
routing/router: break rescans on router quit
2019-05-06 16:21:35 -07:00
Olaoluwa Osuntokun
1d7d498d01
Merge pull request #3049 from cfromknecht/break-sync-send-server-quit
peer: break sendMessage on server quit
2019-05-06 16:15:04 -07:00
Conner Fromknecht
3f59e31248
routing/router: break rescans on router quit
This commit reevaluates the router's quit channel between each block
during the initial call to syncGraphWithChain, which, in the worst case,
may have to scan several thousand blocks on startup if the node has not
been active for some time. Without this, attempting to stop the daemon
will not exit until the rescan has completed, which for certain backends
could be several hours.
2019-05-06 15:04:40 -07:00
Conner Fromknecht
a11a8693ae
peer: break sendMessage on server quit
This commit modifies sendMessage to break on the server's quit channel,
which allows synchronous callers of SendMessage or SendLazyMessage to
receive an error during server shutdown which can be independent of a
particular peer's shutdown.

As of https://github.com/lightningnetwork/lnd/pull/2916, all replies
made by gossip syncers were modified to be synchronous. In certain
cases, This would prevent the syncers from shutting down promptly, as
they would try to offload a batch a of messages that could not be
aborted. Now, an error will be propagated back to the caller, allowing
them to detect the error condition, and reevaluate their own quit
signals, releasing any waitgrouped goroutines and permitting a quick
shutdown.
2019-05-06 14:56:52 -07:00
Olaoluwa Osuntokun
b31510102a
build: update release.sh to account for new lnd package 2019-05-06 12:18:44 -07:00
Olaoluwa Osuntokun
aeda418ea8
Merge pull request #3045 from erkarl/fix/litecoin-simnet-config
config: fix litecoin simnet mode
2019-05-06 11:38:04 -07:00
Karl Ranna
d941220762 config: fix litecoin simnet mode
This commit fixes a bug where it was impossible to run lnd in litecoin's
simnet mode because of code duplication. As a result `numNets > 1`
conditional was always true when running lnd with `cfg.Litecoin.SimNet`
flag.
2019-05-05 18:35:20 +03:00
Conner Fromknecht
17b2140cb5
multi: fix spelling mistakes 2019-05-04 15:35:37 -07:00
Olaoluwa Osuntokun
7f08c097fb
build: bump version to 0.6.1-beta 2019-05-03 17:04:27 -07:00
Olaoluwa Osuntokun
a8fa4094ba
Merge pull request #3027 from Roasbeef/new-onion-structs
router+build: update to the latest version of lightning-onion
2019-05-03 13:30:41 -07:00
Olaoluwa Osuntokun
649991c46f
Merge pull request #2887 from joostjager/asym-broadcast-delta
config: lower outgoing htlc broadcast delta
2019-05-03 13:28:31 -07:00
Olaoluwa Osuntokun
44eb2320c7
Merge pull request #3038 from wpaulino/tor-version-check
tor: use string comparison to check min supported version
2019-05-03 13:12:44 -07:00
Wilmer Paulino
4eb9ff2abf
tor: use string comparison to check min supported version
The current method would not allow version strings like 0.4.0.5 since it
would check every number of the version string individually.
2019-05-03 11:26:59 -07:00
Joost Jager
f5f6a52ed8
htlcswitch: check channel policy for local htlcs 2019-05-03 12:22:36 +02:00