Commit Graph
100 Commits
Author SHA1 Message Date
Carla Kirk-Cohen 03a61617f8 release-notes: add UpdateNodeAnnouncement changes 2023-02-16 14:42:20 -05:00
Carla Kirk-Cohen 3cc8e81121 lncli/bugfix: use int64slice for update node announcement features
As is, we'll never get any add/remove features because the flag is
set as an int 64 slice but accessed as an int slice (which has no
value, and the cli doesn't fail if the flag doesn't exist).
2023-02-14 15:53:56 -05:00
Carla Kirk-Cohen 19f013b5c4 release-notes: add send custom message override functionality 2023-01-05 12:06:25 -05:00
Carla Kirk-Cohen 1b1bc642bc lntest/itest: add custom messaging itest including new override feature 2023-01-05 12:06:24 -05:00
Carla Kirk-Cohen 1cb08e42ef lnrpc: update custom message API to explain ability to override 2023-01-05 12:05:06 -05:00
Carla Kirk-Cohen c2ce8635e7 multi: add custom message overrides to protocol config options 2023-01-05 12:05:05 -05:00
Carla Kirk-Cohen 93dcbd7ea3 lnwire: allow overriding of protocol messages outside of custom range
Add the ability to specify messages < CustomRangeStart that will still
be treated like custom messages by lnd (rather than unknown ones). This
allows code external to lnd to handle protocol messages that are *not
yet known to lnd*.
2023-01-05 12:05:04 -05:00
Carla Kirk-Cohen 610f5d2140 lnwire: make custom type start a constant 2023-01-05 12:05:03 -05:00
Carla Kirk-Cohen 4df0759ad5 docs: add 0.16 release notes and add warning logging PR 2022-05-16 15:19:19 -04:00
Carla Kirk-Cohen 99828b8ebb multi: add ability to read warning messages and log on link level
Warning messages are intended to add "softer" failure modes for peers,
so to start with we simply log the warnings sent to us. While we "may"
disconnect from the peer according to the spec, we start with the least
extreme option (which is also not a change in behavior because
previously we'd just log that we received an unknown odd message).
2022-05-16 13:51:31 -04:00
Carla Kirk-Cohen f5ef4992e0 lnwire: add warning message wrapping existing Error message structure
This commit adds Warning messages to lnwire, as introduced in bolts/950.
It does not include reading/writing of warning messages, which will be
covered in followup commits.
2022-05-16 13:51:29 -04:00
carla 46e048af31 docs: add pr to release notes 2022-02-07 09:07:10 +02:00
carla 0092c731e5 lnrpc: limit hop hint selection in both passes by amount + count
Previously, we'd always add up to the maximum number of hop hints
(and beyond!) when selecting hop hints in our first pass. This
change updates hop hint selection to always stick to our hop hint
limit, and to the "hop hint factor" that we scale our invoices by.

This change will result in selecting fewer channels in our first
pass if their total inbound capacity reaches our hop hint factor.
This prevents us from revealing as many private channels as
before, but has the downside of providing fewer options for
payers.
2022-02-07 09:04:30 +02:00
carla 5836d58a99 lnrpc: add unit test covering too many hop hints 2022-02-07 09:03:10 +02:00
carla 4ac6f82b5e itest: fix lack of hop hint coverage in hold invoice test
Update our test to assert that we have hop hints present when we
expect them, and fix the "alice is a private node" issue that was
previously preventing us from adding hop hints. Asserting that we
have hop hints present in this itest ensures that we'll fail our
itests if a change to SelectHopHints results in our no longer
having hints in this secnario.
2022-02-07 09:03:09 +02:00
carla 0f8d314ee7 github: simplify PR template and add more sections [skip ci] 2022-01-28 09:50:02 +02:00
carla c15d010ba2 docs: add release notes 2022-01-27 15:10:04 +02:00
carla 714a1fb05c invoicerpc: move hop hint to constant and add tests to select hop hint 2022-01-27 15:09:21 +02:00
carla 80bf4bf014 invoicerpc: return hop hints from select hop hint rather than functions
Update SelectHopHints to return a set of hop hints that can be
converted to route hints / functional options by the caller. This
change allows external code to call SelectHopHints to get a set of
route hints and use them as it likes, rather than limiting the
return value to functional options for invoice creation.
2022-01-27 15:09:20 +02:00
carla 00a47740c8 invoicesrpc: pass in specialized config for select hop hints 2022-01-27 15:09:19 +02:00
carla 56e83de9ef invoicesrpc: add HopHintInfo decoupling hop hint from channel internals 2022-01-27 15:09:18 +02:00
carla 5e8f86a9b6 lntest/test: ensure nodes connected before disconnecting [skip ci] 2022-01-25 14:42:11 +02:00
carla 7241653561 docs: add release notes 2022-01-20 14:31:47 +02:00
carla 0ae38457de server: disable chain health check if we're running without backend
There is no chain backend to check, so this check will always fail.
This commit disables it when we're running without a backend.
2022-01-20 14:21:36 +02:00
carla 721ef7d367 release-notes: add amount sensitive bandwidth hints 2021-10-19 09:52:19 +02:00
carla 990dda4b18 multi: thread bandwidth check amount down to MayAddOutgoingHtlc
Pass htlc amount down to the channel so that we don't need to rely
on minHtlc (and pad it when the channel sets a 0 min htlc). Update
test to just check some sane values since we're no longer relying
on minHtlc amount at all.
2021-10-19 09:50:51 +02:00
carla 45de686d35 multi: move bandwidth hints behind interface 2021-10-19 09:50:49 +02:00
carla 6aa37066b2 server: send 0 bandwidth hints for links that can't add htlc 2021-06-22 15:39:33 +02:00
carla 5d717cb039 multi: surface may add outgoing hltc 2021-06-22 13:56:08 +02:00
carla e3a4d6e989 lnwallet: refactor add htlc sanity checks to separate methods 2021-06-22 13:56:07 +02:00
carla 8491d0da43 multi: enable monitoring build by default
The monitoring server still needs to be enabled using prometheus.enable,
so including this in the default build does not add an additional http
server unless the user opts in.
2021-06-18 09:15:51 +02:00
carla 64333c0303 channeldb: cache htlc attempt session key 2021-05-19 09:08:18 +02:00
carla 8071ebb16a channeldb: read raw htlc attempt session key 2021-05-19 09:03:52 +02:00
carla eb068bf666 multi: unexport session key and add constructor for htlc attempt info 2021-05-19 09:03:46 +02:00
carla 74373f26b9 invoices/test: add height expiry watcher tests with registry 2021-05-11 08:47:17 +02:00
carla 8066ff7047 itest/test: assert expired hold invoice updated correctly 2021-05-11 08:45:32 +02:00
carla b7d1ed0cbb itest/test: test hold invoice cancel before force close 2021-05-11 08:45:31 +02:00
carla 85e56dbfb7 invoices/test: add test for hodl invoices 2021-05-11 08:45:30 +02:00
carla 34de5922ed multi: add height-based invoice expiry
This commit adds height-based invoice expiry for hodl invoices
that have active htlcs. This allows us to cancel our intentionally
held htlcs before channels are force closed. We only add this for
hodl invoices because we expect regular invoices to automatically
be resolved.

We still keep hodl invoices in the time-based expiry queue,
because we want to expire open invoices that reach their timeout
before any htlcs are added. Since htlcs are added after the
invoice is created, we add new htlcs as they arrive in the
invoice registry. In this commit, we allow adding of duplicate
entries for an invoice to be added to the expiry queue as each
htlc arrives to keep implementation simple. Our cancellation
logic can already handle the case where an entry is already
canceled, so this is ok.
2021-05-11 08:45:29 +02:00
carla b43ddfdb11 routing: label payment lifecycle loop 2021-04-23 08:51:07 +02:00
carla a63640c488 routing: account for payment terminal errors
If we have processed a terminal state while we're pathfinding
for another shard, the payment loop should not error out on
ErrPaymentTerminal. Instead, it would wait for our shards to
complete then cleanly exit.
2021-04-23 08:46:22 +02:00
carla 58d95be4dd multi: change RegisterAttempt error checking order
Move our more generic terminal check forward so that we only
need to handle a single class of expected errors. This change
is mirrored in our mock, and our reproducing tests are updated
to assert that this move catches both classes of errors we get.
2021-04-23 08:39:45 +02:00
carla 12136a97a9 routing/test: add test for stuck payment with in-flight htlcs
Add an additional stuck-payment case, where our payment gets
a terminal error while it has other htlcs in-flight, and a
shard fails with ErrTerminalPayment. This payment also falls in
our class of expected errors, but is not currently handled. The
mock is updated accordingly, using the same ordering as in our
real RegisterAttempt implementation.
2021-04-23 08:39:45 +02:00
carla 80451afe48 routing/test: add test to demonstrate stuck payment, single shard
This commit adds a test which demonstrates that payments can
get stuck if we receive a payment failure while we're pathfinding
for another shard, then try to dispatch a shard after we've
recorded a permanent failure. It also updates our mock to
only consider payments with no in-flight htlcs as in-flight,
to more closely represent our actual RegisterAttempt.
2021-04-23 08:39:44 +02:00
carla 125980afb7 routing/test: block on pathfinding in tests
This commit adds a step to our payment lifecycle test to add
control over when we find a path for our payment, This is
required for testing race conditions around pathfinding
completing and payment failures being reported.
2021-04-23 08:39:43 +02:00
carla a68155545c routing/test: use half shard for single success case
Update our single shard success case to use a route which
splits the payment amount in half. This change still tests
the case where reveal of the preimage counts as a success,
even if we don't have the full amount. This change is made
to cut down on potential races in this test case. While we
are waiting for collectResultAsync to report a success, the
payment lifecycle will continue trying to dispatch shards.
In the case where we send 1/4 of the payment amount, we
send 1 or 2 more shards, depending on how long collectAsync
takes. Reducing this test to send 1/2 of the payment amount
means that we will always only try one more shard before
waiting for our shard.
2021-04-23 08:39:42 +02:00
carla 198d567cb2 routing/test: assert error value for payment failures 2021-04-23 08:39:41 +02:00
carla e0c52e4473 routing/test: close payment result channel on shutdown, mimicking switch
This commit updates our mock to more closely follow the behavior of the
switch for mocked calls to GetPaymentResult. As it stands, our tests
send a test-created error from the switch when we want to mock shutdown.
In reality, the switch will close its result channel, so we update this
test to follow that behavior. This matters for the commit that follows,
because we start checking the error our payments return. If we have an
error from the switch, our tests will fail with an error that we do
not encounter in practice.
2021-04-23 08:39:40 +02:00
carla 9a78e9da73 routing/tests: move lock acquisition after state driving channels
In our payment lifecycle tests, we have two goroutines that
compete for the lock in our mock control tower: the resumePayment
loop which tries to call RegisterAttempt, and the collectResult
handler which is launched in a goroutine by collectResultAsync
and is responsible for various settle/fail calls.

The order that the lock is acquired by these goroutines is
arbitrary, and can lead to flakes in our tests if the step
that we do not intend to execute first gets the lock (eg,
we want to fail a payment in collectResult, but RegisterAttempt
gets there first). This commit moves contention for this lock
after our mock's various "state driving" channels, so that the
lock will be acquired in the order that the test intends it.
2021-04-23 08:39:39 +02:00
carla b2d941ebfb routing/test: remove test channel buffers
Now that we run each test individually, we don't need to buffer
our mock's channels anymore. This helps to tighten our test loop,
which currently can move on from a step before it's actually
been processed by the mock. This removal ensures that our payment
loop processes each of the test's steps before moving on to the
next once.
2021-04-23 08:39:38 +02:00
carla 806c4cbd57 routing/test: run each test case individually, add names
Update our payment lifecycle test to run each test case with
a fresh router. This prevents test cases from interacting with
each other. Names are also added for easy debugging.
2021-04-23 08:39:37 +02:00
carla cb927e89b0 routing/test: add check that sendpayment completes
As is, we don't check that our SendPayment call in
TestRouterPaymentStateMachine completes. This makes it easier
to create malformed tests that just run through steps but leave
the SendPayment call hanging. This commit adds a check that we
have completed our payment to help catch tests like this. We
also remove an unused quit channel.
2021-04-23 08:39:36 +02:00
carla d0d0d21573 itest/test: remove hold force close dependency
Our aggregate htlc test depends on our previous behavior
where recipients would allow channels with pending hold
invoice htlcs to force close. Now that we have an expiry
watcher to prevent these force closes, we can't rely on
this for tests because the recipient will cancel the htlcs
back before they expire.
2021-04-23 08:19:58 +02:00
carla 7536dd8179 invoices: refactor - add method to handle expected cancelation errors 2021-04-23 08:19:57 +02:00
carla 039e9f439c invoices: refactor - update timestamp expiry to use specific names 2021-04-23 08:19:56 +02:00
carla d29f2fe4f9 invoices: refactor - move cancel check into separate function
Useful for tests which need to mock cancelInvoiceImpl
2021-04-23 08:19:55 +02:00
carla 4cd48c52ea invoices: refactor - add interface for expiry items
In preparation for having more than one expiry type, we
alias the queue.PrioirtyQueueItem interface for readability.
2021-04-23 08:19:54 +02:00
carla 9c6e83b15f invoices: refactor - rename expiry queue to be timestamp specific 2021-04-23 08:19:53 +02:00
carla f5f1e9e6c7 invoices: refactor - rename invoiceExpiry to invoiceExpiryTs
We're going to add block based expiry, so we clarify now.
2021-04-23 08:19:52 +02:00
carla 2e39edd6bd itest/test: add test for expired hold invoices
This commit adds a test for a hold invoice which is accepted
off-chain, and held by the recipient until it expired and
the payer force-closes the channel. With this test we
demonstrate two bugs in our handling of hold invoice state
in the invoice registry when we expire on chain:
- Htlcs not updated: even when we've timed out, we don't
  update the htlc state accordingly.
- Invoice can be settled: the invoice can be settled even
  though it's expired on chain.
2021-04-23 08:19:51 +02:00
carla 16373d3879 itest/test: add test to reproduce settling timed out invoice
Reproduce the case where we allow settling of invoices that have
htlcs that have actually timed out on chain. This bug can rarely
occur if a hodl invoice goes to chain and is manually settled
after it has timed out. Funds are SAFU, but this could be a
headache because the invoice says it's settled when no funds
were claimed.
2021-04-23 08:19:50 +02:00
carla fff6f83f23 itest/test: update remote force close timeout to use hodl inv
This commit updates our multi-hop force close test to use a hodl
invoice so that we can reproduce some bugs which will require
the preimage for the invoice that is timed out on chain.
2021-04-23 08:19:47 +02:00
carla 5b7b6ab9b0 multi: send channel update for failed interceptor packets 2021-04-22 19:39:37 +02:00
carla 0368da02bd itest: whitelist neutrino shutting down error 2021-04-21 12:36:43 +02:00
carla db1d671b1a multi: terminate SubscribeSingleInvoice once completed 2021-04-14 09:19:23 +02:00
carla 0686329062 itest/test: add settle/canceled assertions for subscribe single 2021-04-14 09:19:22 +02:00
carla 7f1e0a4d7b itest/test: move test hold persistence into its own file 2021-04-14 09:19:21 +02:00
carla a80a6f0453 Makefile: bump goacc commit 2021-04-13 15:39:03 +02:00
carla cb977622c6 lncli: add mission control import command 2021-03-18 10:52:23 +02:00
carla d0e7164c07 routerrpc: add mission control import 2021-03-18 10:51:45 +02:00
carla 22491ad567 routing: add mission control import functionality 2021-03-18 10:46:45 +02:00
carla cd1a8b2d3a lnrpc: correct comment on half life seconds
Field is not a unix timestamp, it's just number of seconds.
2021-03-05 16:26:02 +02:00
carla 63bdd6b07b itest: add coverage for hold invoices with hop hints
This PR updates the hold invoice itest to create a private
channel, and sets the private option on the invoices created
to add coverage for the addition of hop hints.
2021-02-08 09:19:21 +02:00
carla 63775756e0 lncli: add mission control getter and setter 2021-01-19 10:57:16 +02:00
carla 64dad77e2e multi: add get and set mission control to routerrpc 2021-01-19 10:57:15 +02:00
carla edac5bb868 routing: add getter and setter for mission control config 2021-01-19 10:57:14 +02:00
carla e10e8f11de routing: extract probability estimator cfg and add validation
In preparation for allowing live update of mc config, we extract our
probability estimator cfg for easy update and add validation.
2021-01-19 10:57:13 +02:00
carla 7b24b586a0 routing: move locking for ReportPaymentSuccess and ReportPaymentFailure
All of the other mission control exported functions acquire their locks
immediately, and do not lock in the subsequent unexported functions.
This commit moves the lock up for the report payment functions so that
mission control's config values are covered by this lock, in preparation
for allowing config to be updated at runtime. Moving this lock means
that we will hold the lock for the additional time it takes to store a
single result, AddResult, to the store.
2021-01-19 10:57:12 +02:00
carla 97442da8f7 routing: add string method for cfg 2021-01-19 10:57:11 +02:00
carla 0735d359b9 router: move self node out of config
We are going to use the config struct to allow getting and setting
of the mission control config in the commits that follow. Self node
is not something we want to change, so we move it out for better
separation.
2021-01-19 10:57:10 +02:00
carla 8eaba51bdc sample-lnd: add anchors to sample config 2021-01-14 22:21:20 +02:00
carla 4093b2ae45 config: increase chain backend healthcheck timeout and backoff 2021-01-14 22:07:31 +02:00
carla d7e2fddb75 github: add workflow that allows us to pin dependencies
This commit adds a workflow that pins certain dependencies in go.mod
that we do not want to bump.
2020-12-15 21:17:11 +02:00
carla d8978c6109 go.sum: cleanup unused entries
go mod tidy does not always remove unused entries (known issue for
gomod). This commit cleans up the entries we don't need.
2020-12-15 21:17:04 +02:00
carla 7d1282af70 peer/test: add test for static key downgrade for legacy channels 2020-12-09 16:31:02 +02:00
carla 887ff442db multi: fix verbose output for listsweeps and check all against wallet
Previously, the verbose output of listsweeps would fail if we did not
find some sweeps in our wallet's listtransactions output. This could be
the case for sweeps that were rbf-ed, so the endpoint would fail. This
commit also updates the listsweeps endpoint to always check against the
wallet, so that we do not return these discarded sweeps that never
confirmed.
2020-11-13 13:59:52 +02:00
carla 697dbf7f3a contractcourt: get arbitrator state before we start each arbitrator 2020-11-12 15:32:15 +02:00
carla f1404af475 contractcourt: pass in optional txns to lookups required for arb startup
To allow us to grab all of the information we need for our channel arbs
in a more efficient way on startup, we add an optional tx to our lookup
functions required on start.
2020-11-12 15:25:35 +02:00
carla 89fe21b79a contractcourt: use single block subscription for block epochs 2020-11-12 15:23:24 +02:00
carla 61777c41e4 lnd: return missing shutdown parameter 2020-11-12 09:12:32 +02:00
carla ca3b36c4b1 multi: use uptime api for bitcoind healthcheck if version > 0.15
The getblockchaininfo call in bitcoind uses a commonly used lock,
csmain, in bitcoind. This made the endpoint unsuitable for a health
check, because some nodes were seeing waits up to 5 minutes (!). This
commit updates our health check function to use the uptime api, provided
our bitcoind version is > 0.15, when the api was added. We do not need
to switch our health check for btcd, because it has more granular
locking.
2020-11-11 11:26:15 +02:00
carla 5679dde1bc multi: add channel open parameters to channel acceptor
Add more fields to channel acceptor response so that users can have more
fine grained control over their incoming channels. With our chained
acceptor, it is possible that we get inconsistent responses from
multiple chained acceptors. We create a conjugate repsponse from all the
set fields in our various responses, but fail if we get different, non-
zero responses from our various acceptors. Separate merge functions are
used per type so that we avoid unexpected outcomes comparing interfaces
(panic on comparing types that aren't comparable), with casting used
where applicable to avoid code duplication.
2020-11-10 21:09:10 +02:00
carla 0d35ce7561 mutli: move parse upfront shutdown out of rpcserver 2020-11-10 11:40:52 +02:00
carla 38fd7d206f multi: add custom error messages to channel acceptor
This commit adds an optional error message to the channel acceptor's
reponse to allow operators to inform (or insult) unsuccessful channel
initiators as to the reason for their rejection.

This field is added in addition to the existing accept field to maintain
backwards compatibity. If we were to deprecate accept and interpret a
non-nil error as rejecting the channel, then received a response with
accept=false and a nil error, the server cannot tell whether this is a
legacy rejection or new mesage type acceptance (due to nil error),
so we keep both fields.
2020-11-10 11:38:47 +02:00
carla 54c3e98b40 multi: move channel acceptor logic out of rpcserver
This commit moves and partially refactors the channel acceptor logic
added in c2a6c86e into the channel acceptor package. This allows us to
use the same logic in our unit tests as the rpcserver, rather than
needing to replicate it in unit tests.

Two changes are made to the existing implementation:
- Rather than having the Accept function run a closure, the closure
  originally used in the rpcserver is moved directly into Accept
- The done channel used to signal client exit is moved into the acceptor
  because the rpc server does not need knowledge of this detail (in
  addition to other fields required for mocking the actual rpc).

Crediting orginal committer as co-author:
Co-authored-by: Crypt-iQ
2020-11-10 11:38:45 +02:00
carla 5668b335d3 chainreg: register logger 2020-11-09 14:11:31 +02:00
carla f1aa3d2071 lncli: allow setting max local csv for open channel requests 2020-11-04 13:57:21 +02:00
carla 91bf59df17 multi: allow specifying max csv for locally initiated channels 2020-11-04 13:55:39 +02:00
carla f4136decae multi: add max local csv config option
To allow nodes more control over the amount of time that their funds
will be locked up, we add a MaxLocalCSVDelay option which sets the
maximum csv delay we will accept for all channels. We default to the
existing constant of 10000, and set a sane minimum on this value so that
clients cannot set unreasonably low maximum csv delays which will result
in their node rejecting all channels.
2020-11-04 13:55:37 +02:00
carla c92b030652 multi: remove experimential build flag for assumechanvalid 2020-10-21 14:13:50 +02:00