Commit Graph
100 Commits
Author SHA1 Message Date
Conner Fromknecht 2ccec4bc5c Merge pull request #4152 from cfromknecht/lncli-invoices-category
cmd/lncli: move invoice-related cmds to Invoices category
2020-04-07 15:48:38 -07:00
Conner Fromknecht b8da7e54fb Merge pull request #4145 from cfromknecht/remove-overflow-queue
htlcswitch: remove overflow queue
2020-04-07 14:33:30 -07:00
Conner Fromknecht f50649d21b htlcswitch/link: remove overflow queue
This commit removes the overflowQueue from the link. We do so in order
to promote better UX for senders, so that HTLCs are failed faster when
the commitment is full. This gives the sender the opportunity to try
another, more open path, rather than perceive the HTLC as being stuck.

At the same time, we remove the total number of active goroutines in lnd
by a factor of N where N is the number of active channels.
2020-04-07 13:20:36 -07:00
Conner Fromknecht 68d1753dcb htlcswitch/test_utils: send htlcs before waiting for result
This commit is preparation for the test added in the subsequent commit.
We modify makeHoldPayment to return any failures direectly when trying
to add an HTLC to the switch. This lets us know that the HTLC was indeed
sent without failure when the method returns.
2020-04-07 11:56:22 -07:00
Conner Fromknecht 5a057de5c4 htlcswitch/mailbox: remove errors from AckPacket, Start, Stop
A following commits will move/modify callsites of AckPacket, Start, and
Stop, none of which use the return value and ultimately cause the linter
to complain. However, none of these in-memory operations can fail so we
just remove the returned errors altogether.
2020-04-07 11:55:54 -07:00
Conner Fromknecht e86ddf6ae7 htlcswitch/link: remove unused isReProcess argument 2020-04-07 11:55:25 -07:00
Conner Fromknecht 759d7a122f htlcswitch/test_utils: add missing return
This commit corrects a bug in the testing harness that could cause
more than one error to be returned on the error channel.
2020-04-07 11:54:56 -07:00
Conner Fromknecht 310e20f8b7 invoices/invoiceregistry: remove debug spew 2020-04-07 11:54:29 -07:00
Conner Fromknecht 77041c131a htlcswitch/switch_test: add t.Helper() to assertion 2020-04-07 11:54:02 -07:00
Conner Fromknecht 028345daea htlcswithc/link_test: rm unused arg from generateHtlc
Linter started complaining.
2020-04-07 11:53:36 -07:00
Conner Fromknecht 2c3641e915 htlcswitch/link_test: fix preimage assertion
This flakes locally for me on darwin.
2020-04-07 11:53:15 -07:00
Conner Fromknecht 425b2c712f htlcswitch/switch_test: increase checkHtlcEvents timeout
This flakes locally for me on darwin.
2020-04-07 11:52:50 -07:00
Conner Fromknecht 3233388750 cmd/lncli: move invoice-related cmds to Invoices category
The Payments category is getting quite large, so this commit breaks out
the invoice-related commands into their own category.
2020-04-06 14:24:08 -07:00
Conner Fromknecht 4aceaba1be cmd/lncli: move invoice commands to cmd_invoice.go 2020-04-06 14:23:21 -07:00
Conner Fromknecht 978ff82f1f contractcourt/chain_watchter: fix broken log stmts 2020-04-03 15:29:18 -07:00
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 ae41623a91 lntest/itest/lnd_test: wait when calling OpenChannel
In #4130, OpenChannel was changed to assert that the wallet is fully
synced before allowing a channel open. This introduced flakes on travis,
which are resolved here by using a wait predicate when calling
OpenChannel.

Note there is one existing call that was not converted, because it is
interested in the returned error. This call does not have a wait
predicate surrounding it, but this shouldn't cause a flake because other
channels are opened earlier in the test that will have already waited
for the wallet to sync up.
2020-04-02 17:56:00 -07:00
Conner Fromknecht 184939c81a Merge pull request #4138 from Roasbeef/cnct-logging
contractcourt: add additional logging of commitments at play
2020-04-02 17:54:30 -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
Conner Fromknecht d1fa33c8eb rpcserver: only block co-op close for frozen chans
This commit fixes a recent issue from #4081 that would prevent a frozen
channel from being force closed via the rpc. We correct this, so that
only the co-op path is inhibited.
2020-04-02 17:40:08 -07:00
Conner Fromknecht 3c371dd633 rpcserver: remove NewLightningChannel usage in CloseChannel 2020-04-02 17:39:47 -07:00
Conner Fromknecht ec784db511 multi: remove returned error from WipeChannel
The linter complains about not checking the return value from
WipeChannel in certain places. Instead of checking we simply remove the
returned error because the in-memory modifications cannot fail.
2020-04-02 17:39:29 -07:00
Conner Fromknecht 9385b8cdc6 channeldb+lnwallet: move ActiveHtlcs calc to OpenChannel 2020-04-02 17:39:10 -07:00
Conner Fromknecht 422928b8a3 lnwallet/channel: remove unused RemoteCommitHeight method 2020-04-02 17:38:54 -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
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
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
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
Conner Fromknecht 8fd5d13c75 Merge pull request #4064 from breez/optimistic-batch-limit
Use batch for historical confirmations filters request.
2020-03-23 13:59:10 -07:00
Conner Fromknecht 4e793497c8 Merge pull request #2669 from cfromknecht/use-netann-in-discovery
netann+discovery+server: consolidate network announcements to netann pkg
2020-03-23 13:38:06 -07:00
Conner Fromknecht 92456d063d discovery: remove unused updateChanPolicies struct 2020-03-19 13:43:57 -07:00
Conner Fromknecht 5c2fc4a2d6 discovery/gossiper: use netann pkg for signing channel updates 2020-03-19 13:43:39 -07:00
Conner Fromknecht b6a0bfcabe Merge pull request #3848 from carlaKC/htlcnotifier-3-addhtlcnotifierrpc
[htlcnotifier 4/4]: lnrpc: Add HTLC Event Subscription
2020-03-17 16:37:52 -07:00
Conner Fromknecht 5147a6d63d netann/channel_update: set timestamp via modifier 2020-03-17 16:25:22 -07:00
Conner Fromknecht f6c194c3cd netann/node_announcement: consolidate signing logic 2020-03-17 16:25:02 -07:00
Conner Fromknecht 089ac647d8 discovery/chan_series: use netann.ChannelUpdateFromEdge helper 2020-03-17 16:24:25 -07:00
Conner Fromknecht 7b0d564692 discovery: move remotePubFromChanInfo to gossiper, remove utils 2020-03-17 16:24:10 -07:00
Conner Fromknecht 6a813e3433 discovery/multi: move CreateChanAnnouncement to netann 2020-03-17 16:23:54 -07:00
Conner Fromknecht d82aacbdc5 discovery/utils: use netann.ChannelUpdateFromEdge 2020-03-17 16:23:37 -07:00
Conner Fromknecht 9d92cfd2b4 netann/channel_update: use generic SignAnnouncement 2020-03-17 16:23:19 -07:00
Conner Fromknecht df44d19936 discovery/multi: move SignAnnouncement to netann 2020-03-17 16:23:01 -07:00
Conner Fromknecht fcecc5cc39 Merge pull request #4066 from guggero/unlock-stdin
lncli: allow unlock with password from stdin
2020-03-10 17:58:55 -07:00
Conner Fromknecht ae815f221f input/size: correct NestedP2WSHSize comment 2020-03-10 11:53:58 -07:00
Conner Fromknecht 7a1013fb9e make+travis: verify compiled protos on travis 2020-03-10 13:03:01 +01:00
Conner Fromknecht 852ab592bb Merge pull request #4034 from cfromknecht/nested-size-fix
input/size: correct NP2WKH and NP2SH input count
2020-03-09 18:24:52 -07:00
Conner Fromknecht 8a5d846f94 Merge pull request #3996 from guggero/lncli-json
lncli+proto: use original name in jsonpb marshaler and remove json_name fields in proto
2020-03-07 11:08:14 -08: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
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
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
Conner Fromknecht 4c2bc7bc79 lnwallet+input: move size_test.go to input pkg 2020-03-04 08:01:37 -08:00
Conner Fromknecht 4c402ab9d4 lnwallet/size_test: refactor and expand unit tests 2020-03-04 08:00:48 -08:00
Conner Fromknecht 6eb7f2800d input/size: correct NP2WKH and NP2SH input count
This commit corrects a bug in TxWeightEstimator that could result in
underestimations for transactions involving NestedP2WPKH and NestedP2WSH
inputs. The scriptSig data push is now accounted for in a proper size
constant, and the input count is now incremented in both. This would
only be detectable in the event that the number of non-nested inputs and
the total number of inputs straddle the discontinuities in the
CompactSize encoding, e.g. 253, 2^16-1, or 2^32-1.
2020-03-04 08:00:33 -08:00
Conner Fromknecht be74d94c48 lnwallet/size_test: add test exercising nested input count bug
This commit modifies the NP2WKH and NP2WSH input tests to ensure the
input count is properly incremented and accounted for in the size
estimate. 253 is chosen because it is the lowest value that, when
serialized, occupies more than one byte on the wire.
2020-03-04 08:00:09 -08: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
Conner Fromknecht 9fc197d8b1 routing/route: fix TestMPPHop comment 2020-01-28 06:43:44 -08:00
Conner Fromknecht 0cb27151e5 routing/route: add AMP record to payload size calcs 2020-01-28 06:43:34 -08:00
Conner Fromknecht de88a4b174 record: add AMP record and encode/decode methods 2020-01-28 06:43:07 -08:00
Conner Fromknecht 51dbdd3b38 multi: rename key_send, key-send and key send to keysend 2020-01-16 18:37:16 -08:00
Conner Fromknecht 51306f4ecd lncli: fix sendcoins docs, allow base58 or bech32 addrs 2020-01-15 05:01:42 -08:00
Conner Fromknecht b3f2a94c3b lncli: improve last_hop help message
Clarifies that last_hop is not the destination, but the penultimate node
in the path, i.e. the last intermediary.
2020-01-09 17:57:52 -08:00
Conner Fromknecht 32284ef1f1 routing/pathfind_test: use ctx in recent tests
Modifies TestMissingFeatureDep and TestDestPaymentAddr to use the test
ctx directly instead of generating a closure and using local state to
modify restrictions.
2020-01-09 13:53:45 -08:00
Conner Fromknecht 6c8c99dae9 Merge pull request #3893 from cfromknecht/pathfind-ignore-required-features
routing: ignore unknown required features in pathfinding
2020-01-08 14:13:04 -08:00
Conner Fromknecht 2510ec00f5 watchtower/wtwire/init: use feature.ValidateRequired
This allows us to remove the custom error type originally implemented
for this purpose.
2020-01-08 12:26:00 -08:00
Conner Fromknecht 0f9023256e peer: use feature.ValidateRequired, cleanup error msgs 2020-01-08 12:25:41 -08:00
Conner Fromknecht b9b66419ff zpay32/invoice: remove unknown required fbit check from decode
This commit removes the unknown required feature bit check from the
invoice decoding logic. This allows greater utility to users of the
decodepayreq rpc since it can provide inspection of otherwise invalid
invoices. In the prior commit, this check moved into our path finding
logic, so invalid features taken from an invoice will instead cause a
failure when attempting to pay.
2020-01-08 12:25:21 -08:00
Conner Fromknecht c7a241fc59 routing/pathfind: ignore unknown required features
This commit brings us inline with recent modifications to the spec, that
say we shouldn't pay nodes whose feature vectors signal unknown required
features, and also that we shouldn't route through nodes signaling
unknown required features.

Currently we assert that invoices don't have such features during
decoding, but now that users can specify feature vectors via the rpc
interface, it makes sense to perform this check deeper in call stack.
This will also allow us to remove the check from decoding entirely,
making decodepayreq more useful for debugging.
2020-01-08 12:25:00 -08:00
Conner Fromknecht f9a1acfbe4 feature/required: add ValidateRequired method
This wraps the raw UnknownRequiredFeatures method and returns a proper
error type to enable more exact testing.
2020-01-08 12:24:37 -08:00
Conner Fromknecht 72a49d486a Merge pull request #3647 from cfromknecht/hex-jsonpb
build+lncli: default to hex encoding for byte slices
2019-12-20 18:23:52 -08:00
Conner Fromknecht 153cd58c97 lnrpc+lncli: reorder getinfo and use printRespJSON 2019-12-20 01:05:27 -08:00
Conner Fromknecht 8f5d78c875 build+lncli: default to hex encoding for byte slices
This commit swaps out golang/protobuf/jsonpb for a custom variant that
by default prints byte slices as hex, which is more useful for our
setting. Some existing wrapper structs are removed as they can now be
printed directly with the new jsonpb.

!!! NOTE !!!

This commit introduces a breaking change to lncli listinvoices since
payment hashes and preimages will now be printed in hex instead of
base64.
2019-12-20 01:05:08 -08:00
Conner Fromknecht fb6cf21948 Merge pull request #3862 from cfromknecht/allow-graph-feature-fallback
routerrpc: allow dest_features graph fallback
2019-12-20 00:39:26 -08:00
Conner Fromknecht f6172fb83a Merge pull request #3858 from bhandras/betweenness_centrality
autopilot: fix memChannelGraph channel edge addition
2019-12-19 22:52:40 -08:00
Conner Fromknecht e6db31f267 routerrpc: allow dest_features graph fallback 2019-12-19 16:28:57 -08:00
Conner Fromknecht e745798a6e zpay32: update spec test vectors, write features last
This commit updates the BOLT11 test vectors to use the updated versions
from the spec (with TLV bit set). This also pointed out that the
ordering was inconsistent with the spec, in that the payment secret
should be serialized before the feature vector.
2019-12-19 14:36:28 -08:00
Conner Fromknecht ff443a389b routing/pathfind_test: constructed sorted edge policies
This commit fixes a potential bug in our test harness, by ensuring that
the constructed node policies are configured _after_ sorting. Currently
the node pubkeys are sorted, but additional parameters (max htlc,
disabled, etc) are applied using the unsorted policies.

Most of the constructors used today use the symmetric channel
constructor, so this shouldn't cause an issue with the majority of our
tests. We recently introduced an asymmetric channel constructor for
which this could have been an issue, however, no known issues were
discovered.

Lastly, we remove the direction from the configuration altogether, and
derive it purely from the final sorting of the pubkeys.
2019-12-19 03:47:24 -08:00
Conner Fromknecht 8ce9e15f4a Merge pull request #3679 from cfromknecht/bolt-11-payment-addr
bolt 11 payment addr + single shot mpp for SendPayment
2019-12-19 01:48:14 -08:00
Conner Fromknecht 1dbeb34a66 feature/default_sets: expose optional mpp and pay_addr features IN9 2019-12-18 23:58:11 -08:00
Conner Fromknecht 35dd5f354d routerrpc: parse dest_features bits for manual SendPayment 2019-12-18 23:57:38 -08:00
Conner Fromknecht 457fda6095 routerrpc: add dest_features to SendPaymentRequest 2019-12-18 23:57:23 -08:00
Conner Fromknecht 396a978cec lntest+wait: replace sleeps in assertAmountSent
This commit constructs a helper closure assertAmountSent that can be
reused by other functions. The closure returns an error so that it can
be used with wait.NoError or the new wait.InvariantNoError. The latter
is added since the predicate could otherwise pass immediately for the
sphinx_replay_persistence tests, but change shortly after. It also
rounds out the wait package so that we offer all combinations of
predicate and no-error style waits.
2019-12-18 23:57:12 -08:00
Conner Fromknecht f868bc128b rpcserver+routerrpc: thread features + payment addr to SendPayment 2019-12-18 23:56:59 -08:00
Conner Fromknecht 0993256b77 routing/pathfind: set single-shot MPP if payment addr is known 2019-12-18 23:56:42 -08:00
Conner Fromknecht 7965cb08db routing/pathfind: consolidate population of custom records 2019-12-18 23:56:23 -08:00
Conner Fromknecht cddb71ee53 routing/pathfind: evaluate TLV support sooner
We move up the check for TLV support, since we will later use it to
determine if we can use dependent features, e.g. TLV records and payment
addresses.
2019-12-18 23:56:05 -08:00
Conner Fromknecht e3a9603846 routing/pathfind: simplify cltv calculation 2019-12-18 23:55:47 -08:00
Conner Fromknecht b97adf79a4 routing/pathfind: consolidate final vs non-final hop processing 2019-12-18 23:55:27 -08:00
Conner Fromknecht 495ae8ca42 routing: consolidate final hop params for newRoute
This commit creates a wrapper struct, grouping all parameters that
influence the final hop during route construction. This is a preliminary
step for passing in the receiver's invoice feature bits, which will be
used to select an appropriate payment or payload type.
2019-12-18 23:55:08 -08:00
Conner Fromknecht 71e05e05bf routing/pathfind: set final hop features used in pathfinding
In this commit, we overwrite the final hop's features with either the
destination features or those loaded from the graph fallback. This
ensures that the same features used in pathfinding will be provided to
route construction.

In an earlier commit, we validated the final hop's transitive feature
dependencies, so we also add validation to non-final nodes.
2019-12-18 23:54:49 -08:00
Conner Fromknecht 990d55d08c routing/pathfind: ensure final hop supports payment addrs
This commit adds an optional PaymentAddr field to the RestrictParams, so
that we can verify the final hop can support it before doing an
expensive round of pathfindig.
2019-12-18 23:54:31 -08:00
Conner Fromknecht acb7b83ead routing/pathfind: validate final hop feature dependencies 2019-12-18 23:54:11 -08:00