Commit Graph

9281 Commits

Author SHA1 Message Date
Conner Fromknecht
3f4dc0decd lnwallet/channel: increase htlc validation strictness
This commit adds an additional santity check that rejects zero-value
HTLCs, preventing them from being added to the channel state even if the
channel config's minhtlc value is zero.
2020-04-02 18:03:06 -07:00
Conner Fromknecht
b0c3072ff7 lnwallet/channel_test: assert commit sorting of commit diff htlcs
This commit adds a test to exercise that HTLC signatures are sent in the
correct order, i.e. they match the sorting of the HTLC outputs on the
commitment after applying BOLT 3's BIP69+CLTV sort.
2020-04-02 17:51:02 -07:00
Conner Fromknecht
3ea3b1d0b5 lnwallet/channel: tie-break HTLCs by cltv when locating
This commit fixes #4118 by properly sorting the HTLC signatures sent
over the wire to match the BOLT3 BIP69+CLTV sorting of the commitment
outputs.

To do so, we expose the slice of cltv deltas for HTLCs on the unsigned
commitment after applying the commitment sorting. This will be used to
locate the proper output index, as the CLTV serves as a tie breaker
between HTLCs that otherwise have the same payment hash and amount.

Note that #3412 fixed the issue partially by ensuring the commitment was
constructed properly (and the second-level prev outpoint's txid was
correct), but failed to address that the HTLC signatures were still sent
out in the incorrect order. With this, we pass the test case introduce
in the next commit.
2020-04-02 17:51:02 -07:00
Conner Fromknecht
294e13eefc lnwallet/commitment: split our/theirBalance comment 2020-04-02 17:51:02 -07:00
Conner Fromknecht
97761833d2 lnwallet/channel: populate htlc indexes from disk commit
We currently write each HTLCs OutputIndex to disk, but we don't use it
when restoring. The restoration is modified to use these directly, since
we will have lost access to the sorting of CLTVs after the initial
signing process.
2020-04-02 17:50:59 -07:00
Olaoluwa Osuntokun
c14d99f05d Merge pull request #4133 from wpaulino/send-gossip-on-peer-conn
peer: send local node announcement upon establishing peer connections
2020-04-02 17:02:04 -07:00
Wilmer Paulino
40f97e6c47 peer: send local node announcement upon establishing peer connections
We'll only do so when we have at least one confirmed advertised channel
with the remote peer. This ensures that our node announcement can
propagate throughout the network even for nodes that were offline when
we initially broadcast it.
2020-04-02 10:04:45 -07:00
Olaoluwa Osuntokun
77df8e3a43 Merge pull request #4130 from cfromknecht/open-channel-refactor
rpcserver: align OpenChannel + OpenChannelSync request parsing
2020-03-31 18:05:00 -07:00
Conner Fromknecht
0b49783650 Merge pull request #4124 from halseth/travis-lint-concurrency
travis+lint+make: limit lint concurrency only on travis
2020-03-31 16:09:50 -07:00
Joost Jager
afaabdae88 Merge pull request #4128 from joostjager/default-routerrpc
routerrpc+lncli: enable subserver by default and switch over lncli sendpayment
2020-03-31 23:30:25 +02:00
Joost Jager
6b649eeb10 lncli: remove unused type chain 2020-03-31 22:05:00 +02:00
Joost Jager
3191b949f5 lnrpc: deprecate SendPayment
There is an alternative in routerrpc now. It doesn't support REST yet,
but the main rpc SendPayment with its bidirectional streaming isn't
usable via REST either.

SendPaymentSync still serves REST users and cannot be deprecated yet.
2020-03-31 21:41:34 +02:00
Joost Jager
37849194f4 lncli: add trackpayment command 2020-03-31 21:41:32 +02:00
Joost Jager
acefb64207 routerrpc: remove payment-level route field
With multi-part payments, a payment-level route field does not make
sense anymore.
2020-03-31 21:41:30 +02:00
Joost Jager
dead6a772a lncli: use routerrpc for payments 2020-03-31 21:41:28 +02:00
Joost Jager
f060da3971 lncli: move payment commands to separate file 2020-03-31 21:41:26 +02:00
Joost Jager
767c4f2298 routerrpc: remove reflection-based initialization 2020-03-31 21:41:24 +02:00
Joost Jager
ffa7bed7f0 build+routerrpc+lncli: remove routerrpc conditional compilation 2020-03-31 21:41:22 +02:00
Joost Jager
e11a3b24d8 lnrpc/routerrpc: rename RoutingConfig file 2020-03-31 21:41:20 +02:00
Joost Jager
bc7ee9a7d0 routerrpc: fix empty payment request bug 2020-03-31 21:41:18 +02:00
Joost Jager
7ba5bf69e0 Merge pull request #4129 from joostjager/pending-close-type
lnrpc: expose commitment type on pending open and waiting close channels
2020-03-31 21:40:24 +02:00
Conner Fromknecht
66d02504f9 rpcserver: align OpenChannel+OpenChannelSync req parsing
This commit consolidates our request parsing for OpenChannel and
OpenChannelSync which removes a good deal of code duplication.
2020-03-31 11:24:13 -07:00
Joost Jager
baffe156db lnrpc: expose commitment type on pending open and waiting close channels 2020-03-31 19:35:52 +02:00
Joost Jager
41573004a3 lnrpc: extract rpcCommitmentType 2020-03-31 19:35:50 +02:00
Conner Fromknecht
c1f9c56e5b rpcserver: add self-node check in OpenChannelSync 2020-03-31 10:21:29 -07:00
Conner Fromknecht
303d441d4d rpcserver: ensure OpenChannel+OpenChannelSync parse NodePubkey 2020-03-31 10:21:29 -07:00
Conner Fromknecht
1823840ed6 rpcserver: add missing channel limit check to OpenChannelSync 2020-03-31 10:21:29 -07:00
Conner Fromknecht
5660a26b60 rpcserver: add wallet sync check to OpenChannel 2020-03-31 10:21:24 -07:00
Wilmer Paulino
f996203883 Merge pull request #4079 from guggero/psbt-chanfunding
wallet: PSBT channel funding
2020-03-31 10:03:46 -07:00
Johan T. Halseth
73c542c934 travis+lint+make: limit lint concurrency only on travis
Since linting is much faster by using the defaults locally.
2020-03-31 10:27:44 +02:00
Oliver Gugger
2f371556da docs: add PSBT funding tutorial 2020-03-31 10:00:12 +02:00
Oliver Gugger
c4f20dada4 lntest: test PSBT channel funding 2020-03-31 10:00:12 +02:00
Oliver Gugger
c892227953 lncli: add PSBT to openchannel command
We add a new flag --psbt to the openchannel command which triggers
an interactive conversation between the command line and the user.
2020-03-31 09:17:26 +02:00
Oliver Gugger
8b05d1b61f lncli: move openChannel command to new file
This is a pure code move!
2020-03-31 09:17:25 +02:00
Oliver Gugger
376a747bb2 rpcserver: implement PSBT funding flow
A PSBT funding flow consists of multiple steps. We add new RPC
messages that can trigger the underlying state machine to transition
to a new state. We also add new response messages that tell the
API user what the current state is.
2020-03-31 09:17:24 +02:00
Oliver Gugger
5a52420ab6 lnwallet+fundingmgr: interrupt funding flow for PSBT
In case the funding manager detects that a funding flow is requested
to be executed with the help of a PsbtIntent, the normal channel
negotiation with the remote peer is interrupted, as soon as the
accept_channel message was received. With the remote peer's funding
multisig key and our local key, we can derive the funding output
script and its address. This is enough to start the PSBT funding
and signing process which the user will do externally to the daemon.
2020-03-31 09:17:24 +02:00
Oliver Gugger
126f79dbb1 chanfunding: add PSBT assembler and intent
We add a new funding assembler and intent type that handle channel
funding through the use of a PSBT. The PsbtIntent is in itself a
simple state machine that can be stepped through the process of
assembling the required information for the funding output, verifying
a user supplied PSBT for correctness, accepting a fully signed PSBT
and then assembling the funding wire message.
2020-03-31 09:17:23 +02:00
Oliver Gugger
357f5978ad lnrpc: add new PSBT funding step messages 2020-03-31 09:17:22 +02:00
Oliver Gugger
f97339c3e8 mod: add PSBT dependency 2020-03-31 09:17:05 +02:00
Olaoluwa Osuntokun
90dfb97224 Merge pull request #4087 from Crypt-iQ/wt_hs_0310
watchtower: automatically create tor hidden service if enabled
2020-03-30 16:42:35 -07:00
Conner Fromknecht
6a55f3c305 Merge pull request #4125 from bhandras/betweenness_centrality
Addressing final comments from beteweenness centrality PR
2020-03-30 14:20:55 -07:00
nsa
2848eb1d53 docs: detail watchtower tor hidden service configuration 2020-03-30 11:54:48 -04:00
Andras Banki-Horvath
919710467e autopilot: tidying up source code to fit to 80 cols 2020-03-30 16:36:13 +02:00
Andras Banki-Horvath
93cb05142a lnrpc: rename FloatValue to FloatMetric
This commit renames lnrpc.FloatValue to lnrpc.FloatMetric as requested
in the final review of centrality PR.
2020-03-30 16:36:11 +02:00
nsa
ada0b78dfc lnd+server+watchtower: allow Standalone access to the tor controller
This commit lets the watchtower automatically create hidden services
by giving it a pointer to a TorController. The server was also slightly
refactored so that it was not the sole owner of the TorController.
2020-03-29 12:36:54 -04:00
nsa
f1fd5e86c0 config: add WatchtowerKeyPath Tor option
Co-authored-by: Turtle <orbitalturtle@protonmail.com>
2020-03-29 11:54:59 -04:00
Joost Jager
a2336005e6 Merge pull request #4113 from joostjager/mc-failure-overwrite
routing: minimum failure relaxation interval
2020-03-28 11:10:26 +01:00
Joost Jager
1a6b28553a routing: stricter mission control state failure updates
This commit puts a mechanism in place to prevent a failure for a low
amount from being overwritten very soon after by a higher amount
failure.
2020-03-28 07:49:23 +01:00
Olaoluwa Osuntokun
0b59ded7ca Merge pull request #4073 from joostjager/anchor-sweep-itest
lntest/itest: select anchor commitment format and sweeping itests
2020-03-27 13:23:02 -07:00
Olaoluwa Osuntokun
eb10594381 Merge pull request #4092 from Crypt-iQ/peer_ll_0210
link+peer: buffer messages until link active
2020-03-27 13:20:25 -07:00