Commit Graph
100 Commits
Author SHA1 Message Date
Conner Fromknecht e3a8b3b0c4 routing/router: prune zombies when either end is stale 2021-04-21 13:56:21 -05:00
Conner Fromknecht 672dbe39e7 channeldb/graph: only set laggard zombie pubkey 2021-04-21 13:56:19 -05:00
Conner Fromknecht f28a98aa6f discovery/gossiper: only parse zombie pubkey if non-empty 2021-04-21 13:56:16 -05:00
Conner Fromknecht 4baee9537b discovery/gossiper: move zombie handling to helper 2021-04-21 13:56:11 -05:00
Conner Fromknecht 748265d097 Merge pull request #5207 from carlaKC/4727-singleinvoice
invoicesrpc: terminate SubscribeSingleInvoice once invoice reaches a final state
2021-04-14 15:32:53 -07:00
Conner Fromknecht de7da3d223 Merge pull request #5182 from PierreRochard/node-update-addresses
rpcserver+lnrpc: make graph node addresses consistent
2021-04-13 14:30:07 -07:00
Conner Fromknecht f8d201a605 channeldb/invoice: only allow pay-addr lookup w/ no query hash
Without this check, it's possible to send a probe HTLC w/ a valid
payment address but invalid payment hash that gets settled. Because
there was no assertion that the HTLC's payment hash matches the
invoice, the link would fail when it receives an invalid preimage for
the HTLC on its commitment.
2021-04-13 12:18:42 -07:00
Conner Fromknecht 791a82878d Merge pull request #5208 from carlaKC/makefile-acc
makefile: bump goacc commit
2021-04-13 11:57:14 -07:00
Conner Fromknecht 213b264e4c Merge pull request #5187 from bottlepay/config-commit-time
config: add commit time parameter
2021-04-09 16:44:40 -07:00
Conner Fromknecht 730b718208 lntest: add AMP itest 2021-04-07 12:09:47 -07:00
Conner Fromknecht 888af51ab4 lntest: make buildRoute method on mppTestContext
This will be reused by the amp itest.
2021-04-07 12:09:47 -07:00
Conner Fromknecht 352ce10658 lnrpc: add UnmarshalAMP decoding 2021-04-07 12:09:47 -07:00
Conner Fromknecht 00581efec6 lnrpc: add AMPRecord to Hop 2021-04-07 12:09:43 -07:00
Conner Fromknecht cfa9e954c7 channeldb/invoice: allow creating AMP invoices w/o preiamge 2021-04-07 12:08:35 -07:00
Conner Fromknecht ea934e1be9 invoices: add TestSpontaneousAmpPayment
Adds a set of test cases that exercise the spontaneous AMP payment flow
with valid and invalid reconstructions, as well as with single and
multiple HTLCs. This also asserts that spontaneous AMP is gated behind
the existing AcceptKeysend flag.
2021-04-07 12:08:35 -07:00
Conner Fromknecht 90a255078d invoices: reconstruct AMP child preimages 2021-04-07 12:08:35 -07:00
Conner Fromknecht 2a49b59f4f channeldb/invoices: rigorously test updateHtlc for MPP/AMP scenarios 2021-04-07 12:08:35 -07:00
Conner Fromknecht 0b5be8576e channeldb/invoice: make Copy() a member of InvoiceHTLC 2021-04-07 12:08:35 -07:00
Conner Fromknecht 6780f74c87 channeldb/invoices: set AMP HTLC preimages when settling invoice 2021-04-07 12:08:35 -07:00
Conner Fromknecht 24d283e615 channeldb/invoice_test: only set htlc-level preimage on accept 2021-04-07 12:08:34 -07:00
Conner Fromknecht 88b72ab398 invoices: add processAMP 2021-04-07 12:08:34 -07:00
Conner Fromknecht 3fb70dd936 invoices: add checkSettleResolution and checkFailResolution
Also refactor existing unit tests to use them.
2021-04-07 12:08:34 -07:00
Conner Fromknecht 7e2f5a184b channeldb: validate feature dependencies when adding invoice 2021-04-07 12:08:34 -07:00
Conner Fromknecht 7bed359296 channeldb: refactor InvoiceRef.String() with all optional fields 2021-04-07 12:08:34 -07:00
Conner Fromknecht 174d577524 channeldb: make payhash on InvoiceRef optional
Currently we support queries by payHash or payHash+payAddr. For handling
of AMP HTLCs, we only need to support querying by payAddr.
2021-04-07 12:08:34 -07:00
Conner Fromknecht be6698447e channeldb/invoice: add InvoiceRefByAddr 2021-04-07 12:08:34 -07:00
Conner Fromknecht 438b03afa4 features: define temporary AMP feature bits 30/31 2021-04-07 12:08:34 -07:00
Conner Fromknecht c2729cbbbd htlcswitch/hop: parse and validate AMP records 2021-04-07 12:08:33 -07:00
Conner Fromknecht 135a0a9f7f htlcswitch/hop: make unknown required type const
Currently we use the AMP record type, this allows us to change it easily
as we add new known records. We also bump this to 0x0c instead of 0x0a.
2021-04-07 12:08:33 -07:00
Conner Fromknecht 82b4f11292 record/amp: use switch from 10 -> 14 for AMP TLV type
This is to not conflict with trampoline BOLT.
2021-04-07 12:08:33 -07:00
Conner Fromknecht 8fe4de88c1 record: convert child_index from uint16 to uint32 2021-04-07 12:08:29 -07:00
Conner Fromknecht e2690918a0 Merge pull request #5002 from akovalenko/master
lncli addinvoice: allow specifying msat with --amt_msat
2021-03-17 10:03:56 -07:00
Conner Fromknecht 482ca0ddc4 Merge pull request #5068 from wpaulino/gossip-rate-limit-config
lncfg: expose channel update rate limiting options
2021-03-17 09:58:53 -07:00
Conner Fromknecht b4aa661d16 Merge pull request #5064 from ellemouton/set-coop-close-target-confs
multi: allow setting target confs for co-op close
2021-03-16 11:14:15 -07:00
Conner Fromknecht 53c1175407 Merge pull request #5111 from yyforyongyu/fix-feature-check
routing: check payment.DestFeatures against nil
2021-03-16 10:01:00 -07:00
Conner Fromknecht 7e33548e8b Merge pull request #4775 from halseth/input-tx-size-constants
[input/size] Check tx size constants
2021-03-10 09:23:40 -08:00
Conner Fromknecht 8c4e32012e Merge pull request #5070 from alexbosworth/patch-14
trivial: match newline style
2021-03-05 12:30:20 -08:00
Conner Fromknecht b121d1da4e Merge pull request #5078 from carlaKC/fix-comment
lnrpc: correct comment on half life seconds
2021-03-05 12:29:59 -08:00
Conner Fromknecht e7f3fe3923 Merge pull request #5074 from cfromknecht/add-invalid-onion-payload-rpc
lnrpc: expose INVALID_ONION_PAYLOAD via RPC
2021-03-05 09:50:47 -08:00
Conner Fromknecht 71db3a83bc lnrpc: expose INVALID_ONION_PAYLOAD via RPC 2021-03-04 15:27:16 -08:00
Conner Fromknecht 56b61078c5 Merge pull request #4338 from cfromknecht/set-id-index
channeldb+invoices: add set id index for AMP
2021-03-04 12:17:08 -08:00
Conner Fromknecht 68688d6346 invoices: replace all asserts with requires 2021-03-04 10:11:22 -08:00
Conner Fromknecht d004442efb lnrpc+itest: expose AMP fields on InvoiceHTLC
We also test that legacy keysend payments are promoted to AMP payments
on the receiver-sdie by asserting basic properties of the fields
returned via the rpc.
2021-03-04 10:11:21 -08:00
Conner Fromknecht ffddb85e9c tlv/bench_test: fix ESatPerKw, pass reference to uint64 2021-03-04 10:02:29 -08:00
Conner Fromknecht 7cd78afd1a tlv/bench_test: check for errors in benchmarks 2021-03-04 10:02:29 -08:00
Conner Fromknecht 137258fb58 invoices/invoiceregistry: unbundle invalid preimage error 2021-03-03 16:28:03 -08:00
Conner Fromknecht 9da3e7fc90 invoices: filter HTLC set by set id from AMP payload 2021-03-03 16:28:02 -08:00
Conner Fromknecht 5f34880040 channeldb/invoices: continue cancel loop early 2021-03-03 16:28:02 -08:00
Conner Fromknecht fc9af92dd9 channeldb: only accept/settle non-empty HTLC sets
Prior to AMP, there could only be one HTLC set. Now that there can be
multiple, we introduce the inherent risk that we might be persisting a
settle/accept of the wrong HTLC set. To migitigate this risk, we add a
check to assert that an invoice can only be transitioned into an
Accepted or Settled state if the specified HTLC set is non-empty, i.e.
has accepted HTLCs.

To do this check, we unroll the loops in UpdateInvoice to first process
any added or canceled HTLCs. This ensures that the set of accepted HTLCs
is up-to-date when we got to transition the invoice into a new state, at
which point we can accurately check that the HTLC set is non-empty.
Previously this sort of check wasn't possible because a newly added HTLC
wouldn't be populated on the invoice when going to call
updateInvoiceState.

Once the invoice-level transition checks have completed, we complete a
final pass to move the HTLCs into their final states and recompute the
amount paid.

With this refactor, it is now possible to make stronger assertions
about the invoice and the state transitions being made by the
invoiceregistry before those changes are ultimately persisted.
2021-03-03 16:28:02 -08:00
Conner Fromknecht e1b0fe5e98 channeldb/invoices: update AMP invoice htlcs 2021-03-03 16:28:02 -08:00
Conner Fromknecht fad25f3f26 channeldb/invoices: add invoices to set id index on update 2021-03-03 16:28:01 -08:00
Conner Fromknecht 7c0d1e0093 channeldb/invoice: map zero-value timestamps to 0
Mainly affects ResolveTime which can be 0 before its settled.
2021-03-03 16:26:43 -08:00
Conner Fromknecht da049ebcf7 channeldb: ensure invoices can't be added with HTLCs 2021-03-03 16:26:43 -08:00
Conner Fromknecht b2234703f6 invoices+channeldb: add HTLCSet method to invoice 2021-03-03 16:26:43 -08:00
Conner Fromknecht 7f05c9d3bb channeldb/invoice: persist optional AMP fields on InvoiceHTLC 2021-03-03 16:26:43 -08:00
Conner Fromknecht 464dff09ac invoices: expose AMPRecord() method on Payload 2021-03-03 16:26:39 -08:00
Conner Fromknecht c9ed5927f6 Merge pull request #5038 from cfromknecht/debug-unit
make: add unit-debug target
2021-02-19 14:01:31 -08:00
Conner Fromknecht 17489ba6a3 lntest/itest: add websocket close to error whitelist 2021-02-18 12:14:50 -08:00
Conner Fromknecht 250bc8560e routing: avoid modifying AssumeChannelValid in unit tests
This produces a race condition when reading AssumeChannelValid from a
different goroutine. Instead we isolate the test cases and initial
AssumeChannelValid properly.
2021-02-17 22:43:24 -08:00
Conner Fromknecht f7c5236bf6 routing: dial back max concurrent block fetches
This commit reduces the number of concurrent validation operations the
router will perform when fully validating the channel graph. Reports
from several users indicate that GetInfo would hang for several minutes,
which is believed to be caused by attempting to validate massive amounts
of channels in parallel. This commit returns the limit back to its
original state before adding the batched gossip improvements.

We keep the 1000 concurrent validation request limit for
AssumeChannelValid, since we don't fetch blocks in that case. This
allows us to still keep the performance benefits on mobile/low-resource
devices.
2021-02-17 18:17:09 -08:00
Conner Fromknecht 1c75d92929 Merge pull request #5037 from guggero/make-docker-release
release: fix golang version issue in docker-release and shasum issue in verification script
2021-02-17 10:45:47 -08:00
Conner Fromknecht 7f9dcc143f make: add unit-debug target 2021-02-17 08:47:59 -08:00
Conner Fromknecht db5af6fc14 Merge pull request #5017 from Roasbeef/default-max-parts
routing: if MaxShardAmt is set, then use that as a ceiling for our splits, use default of 16 for MaxParts
2021-02-16 09:43:34 -08:00
Conner Fromknecht 8c06eb57c5 Merge pull request #5026 from cfromknecht/init-mock-fee-estimator
htlcswitch: init mockFeeEstimator in other LinkChannelConfigs
2021-02-15 13:03:02 -08:00
Conner Fromknecht 4fcc82251e Merge pull request #5016 from cfromknecht/extract-channel-whitelist
lntest: update error log whitelist
2021-02-15 12:50:33 -08:00
Conner Fromknecht fd3dd2cfff Merge pull request #5023 from cfromknecht/min-required-sigs-five
scripts/verify-install: require 5 of 7 signatures before accepting
2021-02-15 12:17:36 -08:00
Conner Fromknecht 774d29d890 htlcswitch: init mockFeeEstimator in other LinkChannelConfigs
If the tests don't execute quick enough, the link will try to sample the
network fee and cause a panic. This happens semi-regularly on travis.
2021-02-15 12:14:32 -08:00
Conner Fromknecht 95eadfee2f scripts/verify-install.sh: combine final SUCCESS logs 2021-02-15 10:00:42 -08:00
Conner Fromknecht c03f95a63b scripts/verify-install: bump min required signatures to 5 2021-02-15 09:59:59 -08:00
Conner Fromknecht 12182d0fc9 Merge pull request #5019 from guggero/detach-sign
release: create and verify detached signatures, fix hashing command on MacOS
2021-02-15 09:48:17 -08:00
Conner Fromknecht 4a96c2e55a Merge pull request #5021 from guggero/custom-binary-verify
scripts: allow verification of custom binary
2021-02-12 12:04:49 -08:00
Conner Fromknecht 32507bc835 Merge pull request #5020 from guggero/expand-path
config: clean and expand backup file path
2021-02-12 09:19:39 -08:00
Conner Fromknecht 91a3350dd1 lntest: add Block height out of range to whitelist 2021-02-11 17:51:07 -08:00
Conner Fromknecht cc34af4e57 lntest: add unable to extract ChannelUpdate to whitelist 2021-02-11 17:48:41 -08:00
Conner Fromknecht 76e0388368 Merge pull request #5013 from lightningnetwork/release-pin-go-version
github/workflows: pin exact docker release
2021-02-11 17:24:07 -08:00
Conner Fromknecht a6b977e760 github/workflows: pin exact docker release 2021-02-11 16:05:32 -08:00
Conner Fromknecht 1ee5eb97d5 Merge pull request #5006 from wpaulino/new-rate-limit-chan-updates
discovery: use token bucket based rate limiting to throttle gossip
2021-02-10 17:31:41 -08:00
Conner Fromknecht 5afc6b9284 Merge pull request #4945 from cfromknecht/no-graph-sync
discovery: no graph sync
2021-02-10 17:07:24 -08:00
Conner Fromknecht 58e924ad1c discovery: don't historical sync when NumActiveSyncers == 0
Currently when numgraphsyncpeers=0, lnd will still attempt to perform
an initial historical sync. We change this behavior here to forgoe
historical sync entirely when numgraphsyncpeers is zero, since the
routing table isn't being updated anyway while the node is active.

This permits a no-graph lnd mode where no syncing occurs at all.
2021-02-10 09:35:45 -08:00
Conner Fromknecht a5aeca8ca2 Merge pull request #4983 from guggero/vendor-reproducible
make: clean mobile stubs before building release
2021-02-07 05:49:48 -08:00
Conner Fromknecht 2d9a030ae5 Merge pull request #4915 from Crypt-iQ/revsigbool_01132021
multi: store bool to determine retransmission ordering
2021-02-03 19:51:26 -08:00
Conner Fromknecht 7f006832fb Merge pull request #4934 from cfromknecht/pinned-active-syncers
discovery: pinned syncers
2021-02-03 10:54:00 -08:00
Conner Fromknecht 814b81bd25 Merge pull request #4902 from Crypt-iQ/lntestchannels_01072021
lntest/channels: introduce subpackage to deduplicate static structs
2021-02-01 14:12:08 -08:00
Conner Fromknecht ff9165070a Merge pull request #4974 from bolatovumar/fix/typo-manged
Fix typo in restorechanbackup command description
2021-02-01 10:22:39 -08:00
Conner Fromknecht faddf98391 gen_protos_docker: make image build non-quiet
This allows users to see progress whenever the docker image is
[re]built, and (esp on non-linux hosts) track the size of the build
context being uploaded. Currently no output is displayed, so it's hard
to attribute the source of latency, e.g. network latency, building
layers, a large work directory, etc.
2021-02-01 10:11:09 -08:00
Conner Fromknecht bd1c5378bf Merge pull request #4919 from joostjager/getnodeinfo-notfound
rpcserver: use NotFound http status code in GetNodeInfo
2021-01-31 09:43:33 -08:00
Conner Fromknecht 227fd45da2 lntest: fix linter errors 2021-01-29 01:37:37 -08:00
Conner Fromknecht b1fee734ec discovery/sync_manager: remove unneeded markGraphSyncing
AFAICT it's not possible to flip back from bein synced_to_chain, so we
remove the underlying call that could reflect this. The method is moved
into the test file since it's still used to test correctness of other
portions of the flow.
2021-01-29 00:19:48 -08:00
Conner Fromknecht e42301dee2 lntest: call markGraphSynced from gossipSyncer
Rather than performing this call in the SyncManager, we give each
gossipSyncer the ability to mark the first sync completed. This permits
pinned syncers to contribute towards the rpc-level synced_to_graph
value, allowing the value to be true after the first pinned syncer or
regular syncer complets. Unlinke regular syncers, pinned syncers can
proceed in parallel possibly decreasing the waiting time if consumers
rely on this field before proceeding to load their application.
2021-01-29 00:19:48 -08:00
Conner Fromknecht 920eda26fc lntest/graph_top: test pinned syncers 2021-01-29 00:19:48 -08:00
Conner Fromknecht ba67f3ecaa lntest/graph_top: remove dependence on net.Alice/Bob 2021-01-29 00:19:47 -08:00
Conner Fromknecht fcd5cb625a config: expose gossip.pinned-syncers for conf
The pinned syncer set is exposed as a comma-separated list of pubkeys.
2021-01-29 00:19:47 -08:00
Conner Fromknecht 2371fc5a8e lnrpc: expose PINNED_SYNC for listpeers 2021-01-29 00:19:47 -08:00
Conner Fromknecht 340414356d discovery: perform initial historical sync for pinned peers 2021-01-29 00:19:47 -08:00
Conner Fromknecht 2f0d56d539 discovery: add support for PinnedSyncers
A pinned syncer is an ActiveSyncer that is configured to always remain
active for the lifetime of the connection. Pinned syncers do not count
towards the total NumActiveSyncer count, which are rotated periodically.

This features allows nodes to more tightly synchronize their routing
tables by ensuring they are always receiving gossip from distinguished
subset of peers.
2021-01-29 00:19:47 -08:00
Conner Fromknecht 9e932f2a64 discovery/sync_manager: Pause/Resume HistoricalSyncTicker
This gives each initial historical syncer an equal amount of time before
being rotated, even if some fail.
2021-01-29 00:19:47 -08:00
Conner Fromknecht ef0cd82c1f discovery/sync_manager: make setHistoricalSyncer closure 2021-01-29 00:19:46 -08:00
Conner Fromknecht 72fbd1283b discovery/sync_manager: break out IsGraphSynced check 2021-01-29 00:19:46 -08:00
Conner Fromknecht 7c6aa20bd8 discovery: handle err for linter 2021-01-29 00:19:46 -08:00
Conner Fromknecht 626e732f9b Merge pull request #4956 from joostjager/htlc-attempt-id
lnrpc: add htlc attempt id
2021-01-27 17:01:08 -08:00