Commit Graph
100 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun 7f3c59033b Merge pull request #5527 from ErikEk/isset-validateconfig
config: sync-freelist being ignored
2021-09-28 20:35:57 -07:00
Olaoluwa Osuntokun 884cc0d191 Merge pull request #5768 from priyanshiiit/lookupInvoice
lnd: adds NOT_FOUND status code for LookupInvoice
2021-09-28 14:33:29 -07:00
Olaoluwa Osuntokun 42ce27f663 Merge pull request #5745 from Roasbeef/contract-court-move
multi: move breach arbiter and utxo nursery into contractcourt package
2021-09-27 21:33:51 -07:00
Olaoluwa Osuntokun 7bde1662e2 multi: move breach arbiter and utxo nursery into contractcourt package
In this commit, we take an initial step towards converting the existing
breach arbiter and utxo nursery logic into contract resolvers by moving
the files as is, into the `contractcourt` pacakge.

This commit is primarily move only, though we had to massage some
interfaces and config names along the way to make things compile and the
tests run properly.
2021-09-27 19:10:31 -07:00
Olaoluwa Osuntokun 3800cd9433 build: update kvdb to kvdb/v1.1.0 [skip ci]
Updates to the latest version that adds a tag after the recent postgres
support.
2021-09-24 16:12:05 -07:00
Olaoluwa Osuntokun fbb1d159e0 Merge pull request #4364 from yyforyongyu/clean-forward-states
multi: clean up forwarding state from closed channels
2021-09-24 15:52:46 -07:00
Olaoluwa Osuntokun e62bd65c7a Merge pull request #5785 from guggero/deprecated-ssh-terminal
mod+lncli: remove deprecated package [skip ci]
2021-09-24 15:32:17 -07:00
Olaoluwa Osuntokun 9094fcddfa Merge pull request #5784 from benthecarman/patch-1
Fix incorrect link in java gRPC docs
2021-09-24 15:31:38 -07:00
Olaoluwa Osuntokun 7970ffcc2a Merge pull request #5366 from bottlepay/postgres
kvdb: add postgres
2021-09-21 13:58:10 -07:00
Olaoluwa Osuntokun 9264185f5b Merge pull request #5101 from guggero/macaroon-interceptor
Add macaroon based RPC middleware interceptor
2021-09-20 19:15:04 -07:00
Olaoluwa Osuntokun ac5f88bae8 Merge pull request #5618 from Crypt-iQ/coop_switch_sync_08092021
multi: optimistically shutdown link during coop close
2021-09-20 18:09:07 -07:00
Olaoluwa Osuntokun 5e6532594c Merge pull request #5683 from guggero/websocket-write-deadline
lnrpc: Fix WebSocket write deadline not being extended
2021-09-20 17:07:41 -07:00
Olaoluwa Osuntokun 650827aade routing: add wait.NoError to TestBlockDifferenceFix assertion
This fixes a flake I've seen in the wild lately:
```
--- FAIL: TestBlockDifferenceFix (0.01s)
    router_test.go:4335: height should have been updated to 5, instead got 4
FAIL
FAIL	github.com/lightningnetwork/lnd/routing	3.865s
FAIL
```

We wrap things in an assertion loop to ensure that timing quirks don't
cause the test to fail sporadically.
2021-09-17 17:02:03 -07:00
Olaoluwa Osuntokun 6be472eb98 Merge pull request #5737 from naveensrinivasan/naveen/feat/fix-jwt-osv
mod : Replace for OSV GO-2020-0017 JWT
2021-09-17 16:30:06 -07:00
Olaoluwa Osuntokun 854d8bcd39 Merge pull request #5722 from xanoni/dedupe-pubkey-log-output
server.go: dedupe pubkey output in debug/log msgs
2021-09-17 16:28:15 -07:00
Olaoluwa Osuntokun fb06c14c22 Merge pull request #5731 from guggero/arm-reduce-parallel
Travis: reduce ARM itest parallelism to 2
2021-09-14 18:06:29 -07:00
Olaoluwa Osuntokun b8d5b7fa7c Merge pull request #5315 from orbitalturtle/block_height_discrepancy
Router: fix block height discrepancy
2021-09-14 17:57:20 -07:00
Olaoluwa Osuntokun 3608d36cca Merge pull request #5637 from yyforyongyu/fix-bitcoind-backup
itest: fix restore backup file test flake for bitcoind backend
2021-09-13 20:36:06 -07:00
Olaoluwa Osuntokun b0f3a08f2d Merge pull request #5465 from Crypt-iQ/spend_height_0702
chainntnfs: populate spendsByHeight during historical dispatch
2021-09-13 11:58:49 -07:00
Olaoluwa Osuntokun 27b416935e Merge pull request #5695 from ErikEk/lncli-remove-error-log
lncli: remove error logs
2021-09-10 16:50:34 -07:00
Olaoluwa Osuntokun 75f5b407ea Merge pull request #5635 from bhandras/flatten-htlc-bucket
channeldb: flatten the htlc attempts bucket
2021-09-07 20:10:12 -07:00
Olaoluwa Osuntokun d263a01a2d Merge pull request #5669 from Roasbeef/explicit-chan-type
lnwire+funding: introduce new protocol extension for explicit commitment type negotiation
2021-08-31 19:28:59 -07:00
Olaoluwa Osuntokun 26169e8e16 Merge pull request #5627 from Zero-1729/patch-3
trivial: minor grammar and typo fix [skip ci]
2021-08-30 19:23:43 -07:00
Olaoluwa Osuntokun ad758d8499 funding: use explicit commitment type negotiation when possible
In this commit, we modify the existing logic that defaults to implicit
commitment type negotiation to support explicit negotiation if the new
feature bit is set. This change allows us to ditch the notion of a
"default" commitment type, as we'll now use feature bits to signal our
understanding of a commiment type, but allow peers to select which
commitment type they actually wish to use.

In addition, this explicit negotiation removes the need for using the
required bit of any commitment types. Instead, if an implementation
wishes to no longer support a commitment type, they should simply stop
advertising the optional bit.
2021-08-30 19:17:37 -07:00
Olaoluwa Osuntokun 5a9f499dd5 rpc: add new commitment_type field to OpenChannelRequest
This field will be examined later down the stack along with the set of
feature bits to determine if explicit channel commitment type
negotiation is possible or not.
2021-08-30 19:17:28 -07:00
Olaoluwa Osuntokun d0779e2ec2 lnwire: add new feature bits for explicit channel type negotiation
If these bits are present, then both sides can examine the new
CommitmentType TLV field that's present and use this in place of the
existing implicit commiment type negotiation. With this change, it's now
possible to actually deprecate old unsupported commitment types
properly.
2021-08-30 19:17:24 -07:00
Olaoluwa Osuntokun 57b7a668c0 lnwire: add new ChannelType field as TLV record to Open/AcceptChannel
In this commit, we add a new ChannelType field as a new TLV record to
the OpenChannel message. During this change, we make a few tweaks to the
generic TLV encode/decode methods for the ExtraOpaqueData struct to have
it work on the level of tlv.RecordProducer instead of tlv.Record, as
this reduces line noise a bit.

We also partially undo existing logic that would attempt to "prepend"
any new TLV records to the end of the ExtraOpaqueData if one was already
present within the struct. This is based on the assumption that if we've
read a message from disk to order to re-send/transmit it, then the
ExtraOpaqueData is fully populated so we'll write that as is. Otherwise,
a message is being encoded for the first time, and we expect all fields
that are known TLV fields to be specified within the struct itself.

This change required the unit tests to be modified slightly, as we'll
always encode a fresh set of TLV records if none was already specified
within the struct.
2021-08-30 19:17:21 -07:00
Olaoluwa Osuntokun 988d01de0d lnwire: introduce new explicit ChannelType TLV record
In this commit, we add a new TLV record that's intended to be used as an
explicit channel commitment type for a new form of funding negotiation,
and later on a dynamic commitment upgrade protocol. As defined, we have
3 channel types: base (the OG), tweakless, and anchors w/ zero fee
HTLCs. We omit the original variant of anchors as it was never truly
deployed from the PoV of lnd.
2021-08-30 19:17:19 -07:00
Olaoluwa Osuntokun 3b026c401c chainntnfs/neutrinonotify: fix rebase Conflict compilation issue 2021-08-30 19:16:33 -07:00
Olaoluwa Osuntokun 844874252f Merge pull request #5676 from ErikEk/chainnotifier-remove-error-log
chainnotifier: remove error logs
2021-08-30 18:35:12 -07:00
Olaoluwa Osuntokun 480a111c54 Merge pull request #5453 from Crypt-iQ/neutrino_conf_0629
chainntnfs: neutrinonotify patches
2021-08-30 16:04:57 -07:00
Olaoluwa Osuntokun b9231ced2b Merge pull request #5622 from Roasbeef/wire-serdes-optimization
peer+brontide: when decrypting re-use the allocated ciphertext buf & ensure buf pool buf doesn't escape
2021-08-30 11:45:57 -07:00
Olaoluwa Osuntokun 8339b285e7 docs/release-notes: add new brontide optimization to 0.14 notes 2021-08-27 16:57:21 -07:00
Olaoluwa Osuntokun 3e1558b616 peer: re-use buf from bufpool when decoding messages
In this commit, which builds on top of the prior commit, rather than
using the returned buffer outside of the closure (which means it'll be
copied), we instead use it within the `Submit` closure instead. With the
recent changes to the `brontide` package, we won't allocate any new
buffer when we decrypt, as a result, the `rawMsg` byte slice actually
just slices into the passed `buf` slice (obtained from the pool)`.

With this change, we ensure that the buffer pool can release the slice
back to the pool and eliminate any extra allocations along the way.
2021-08-27 16:57:15 -07:00
Olaoluwa Osuntokun 8c6dbc9ffa brontide: when decrypting re-use the allocated ciphertext buf
In this commit, we implement a simple optimization that dramatically
reduces the number of allocations we need to make when we decrypt a new
message. Before this commit, we would pass in a `nil` value to the
`Decrypt` method which meant that it would always allocate a new
buffers.

Rather than force this behavior, in this commit, we pass in the
ciphertext buffer (with a length of zero), such that the decryption
operation will simply copy the plaintext bytes over the cipher text in
place. This works as the cipher text is always larger than the
plaintext, since the plaintext doesn't have a MAC attached.

The amount the perf increase, amount of allocations, and amount of bytes
allocated are pretty nice:
```
benchmark                        old ns/op     new ns/op     delta
BenchmarkReadHeaderAndBody-8     88652         75896         -14.39%

benchmark                        old allocs     new allocs     delta
BenchmarkReadHeaderAndBody-8     6              4              -33.33%

benchmark                        old bytes     new bytes     delta
BenchmarkReadHeaderAndBody-8     65664         128           -99.81%
```

Here old is without this change, and new with it.
2021-08-27 16:57:12 -07:00
Olaoluwa Osuntokun 02509025d5 brontide: add new benchmark to measure allocs for header+body decrypt 2021-08-27 16:57:09 -07:00
Olaoluwa Osuntokun c93824ec9a Merge pull request #5621 from Roasbeef/ping-pong-headers
peer: always send latest block header as part of ping messages
2021-08-27 16:55:46 -07:00
Olaoluwa Osuntokun d9644eba84 Merge pull request #5629 from Roasbeef/priv-key-caching
keychain+lnwallet: when fetching priv keys or signing try to use cache
2021-08-27 16:51:24 -07:00
Olaoluwa Osuntokun abb2448718 docs/release-notes: add section w/ priv key caching in 0.14 2021-08-25 18:55:27 -07:00
Olaoluwa Osuntokun d6524ea517 keychain+lnwallet: when fetching priv keys or signing try to use cache
In this commit, we start to optimistically use the new private key cache
that was added to btcwallet. As is, btcwallet will cache the decrypted
account keys for each scope in memory. However, the existing methods
to derive a child key from those account keys requires a write database
transaction, and will re-derive the private key using BIP-32 each time.

The newly added `DeriveFromKeyPathCache` lets us skip all this and
directly use a cache assuming the account info is already cached. The
new logic will try to use this method, but if it fails fall back to the
existing `DeriveFromKeyPath` method. All calls after this will use this
new cached key.

Fixes https://github.com/lightningnetwork/lnd/issues/5125.

Basic benchmark before the btcwallet change and after:
```
benchmark                    old ns/op     new ns/op     delta
BenchmarkDerivePrivKey-8     22840583      125           -100.00%

benchmark                    old allocs     new allocs     delta
BenchmarkDerivePrivKey-8     89             2              -97.75%

benchmark                    old bytes     new bytes     delta
BenchmarkDerivePrivKey-8     10225         24            -99.77%
```
2021-08-25 18:55:22 -07:00
Olaoluwa Osuntokun 2206eba91a build: point to latest btcwallet w/ new cached privkey method 2021-08-25 18:55:19 -07:00
Olaoluwa Osuntokun df11b0fed0 keychain: add basic benchmark for privkey derivation 2021-08-25 18:55:16 -07:00
Olaoluwa Osuntokun 8fd14bc458 docs/release-notes: add notes for new ping header in 0.14 2021-08-25 16:47:23 -07:00
Olaoluwa Osuntokun 00d275d9f0 lnrpc+rpc: expose last ping message received by peer over ListPeers resp 2021-08-25 16:47:17 -07:00
Olaoluwa Osuntokun 2947076607 peer: store the last ping payload received by a remote peer in an atomic var 2021-08-25 16:47:13 -07:00
Olaoluwa Osuntokun 4287e25494 peer: add message summaries for ping+pong 2021-08-25 16:47:10 -07:00
Olaoluwa Osuntokun d566e51a52 peer: always send latest block header as part of ping messages
In this commit, we implement a long discussed mechanism to use the
Lightning Network as a redundant block header source. By sending our
latest block header with each ping message, we give peers another source
(outside of the Bitcoin P2P network) they can use to spot check their
chain state. Peers can also use this information to detect if they've
been eclipsed from the traditional Bitcoin P2P network itself.

As is, we only send this data in Ping messages (which are periodically
sent), in the future we could also move to send them as the partial
payload for our pong messages, and also randomize the payload size
requested as well.
2021-08-25 16:47:07 -07:00
Olaoluwa Osuntokun 0d8ffd95dd chainntnfs/test: add new test assertion to ensure block epoch headers set 2021-08-25 16:47:04 -07:00
Olaoluwa Osuntokun 67aa7a0df7 chainntnfs/bitcoindnotify: always populate block headers for block epochs 2021-08-25 16:47:01 -07:00
Olaoluwa Osuntokun b2cc4cf088 chainntnfs/btcdnotify: always populate block headers for block epochs 2021-08-25 16:46:59 -07:00
Olaoluwa Osuntokun 99afad1105 chainntnfs/neutrinonotify: always populate block headers for block epochs 2021-08-25 16:46:56 -07:00
Olaoluwa Osuntokun 4eac8577cd chainntnfs: update impl independent functions to populate new block header 2021-08-25 16:46:53 -07:00
Olaoluwa Osuntokun 4fc6d15075 chainntnfs: add the current block header to the block epoch struct 2021-08-25 16:46:51 -07:00
Olaoluwa Osuntokun 4487acc5d9 docs/release-notes: add tor hybrid mode, fix mark down headers 2021-08-22 14:08:20 -05:00
Olaoluwa Osuntokun ec3af13081 Merge pull request #5410 from adriansmares/feature/add-hybrid-mode
Add Tor hybrid connectivity mode
2021-08-22 12:05:25 -07:00
Olaoluwa Osuntokun 52767a7567 Merge pull request #5591 from Crypt-iQ/rest_sendpayment_fix_07302021
rpcserver: validate FinalCltvDelta and CltvLimit for REST
2021-08-16 17:01:31 -07:00
Olaoluwa Osuntokun f6e9f01859 Merge pull request #5442 from bottlepay/zero-output-psbt
walletrpc+lncli: allow zero output psbt funding
2021-08-16 16:50:52 -07:00
Olaoluwa Osuntokun e05b666d54 Merge pull request #5508 from bottlepay/improve-logging
peer+htlcswitch: improve logging
2021-08-16 16:50:22 -07:00
Olaoluwa Osuntokun be341bcd68 Merge pull request #5528 from guggero/keep-channel-backup-local-force-close
backups: Keep channel backup in case of local force close
2021-08-10 19:31:59 -07:00
Olaoluwa Osuntokun b0e9442ba5 Merge pull request #4884 from yyforyongyu/3004-buffer-pool
lnwire: fix heap escapes to reduce gc pressure
2021-08-10 19:13:08 -07:00
Olaoluwa Osuntokun e9fa44f49f Merge pull request #5613 from Roasbeef/release-notes-checklist
docs: add release notes to PR checklist and contributor guidelines
2021-08-10 15:58:44 -07:00
Olaoluwa Osuntokun f33752da3b docs/release-notes: mention change to contribution guidelines 2021-08-10 15:56:26 -07:00
Olaoluwa Osuntokun 85e3dd3e45 docs: add release notes to PR checklist and contributor guidelines 2021-08-10 15:56:17 -07:00
Olaoluwa Osuntokun 90db8de6fe Merge pull request #5460 from ErikEk/lncli-add-command-for-publishtransaction
lncli: add command for publishtransaction
2021-08-06 14:42:49 -07:00
Olaoluwa Osuntokun 407ee84838 Merge pull request #5554 from Roasbeef/sendpayment-amp-reuse-fix
cmd/lncli: always parse the pay_addr field for sendpayment
2021-08-05 13:39:48 -07:00
Olaoluwa Osuntokun 945c0fa0df Merge pull request #5521 from Roasbeef/amp-test-flake-chan-open
lntest: fix possible race condition re asserting channel propagation
2021-08-04 19:21:03 -07:00
Olaoluwa Osuntokun 9505402ec2 docs/release-notes: add item for easy AMP CLI re-use 2021-08-04 19:17:57 -07:00
Olaoluwa Osuntokun 57d70ee9ce docs/release-notes: add item for sendpayment pay_addr bug fix 2021-08-04 19:17:51 -07:00
Olaoluwa Osuntokun c235b46e66 cmd/lncli: add new option for easy AMP invoice re-use
In this commit, we add a new option (`--amp-reuse`) that allows for easy
AMP invoice re-use when using either the `sendpayment` command.
2021-08-04 19:17:48 -07:00
Olaoluwa Osuntokun 6e3b33629c cmd/lncli: always parse the pay_addr field for sendpayment
In this commit, we fix a bug that would cause attempts to re-use an AMP
invoice to fail. Without this commit, we would only attempt to parse the
payment addr if no invoice was specified, so a user manually specifying the
pubkey of the detonation. The fix is straight forward: always parse the
`pay_addr` field as the user may be attempting to re-use an AMP invoice w/o
open coding each of the sections.
2021-08-04 19:17:45 -07:00
Olaoluwa Osuntokun da1d0226bd server: disable DNS boostrap for SigNet nodes (#5564)
* server: disable DNS boostrap for SigNet nodes

In this commit, we fix a bug that would cause nodes attempting to run
using the signet chain, to waste CPU as they attempted to boostrap to a
non-existent DNS seed. We fix this by ignoring the DNS boostrapper is
signet is active. Along the way, we refactor the conditional sightly to
be more readable, and easily extensible.

* server: extract bootstrap logic into new function w/ unit test

* docs/release-notes: update release notes for signet DNS fix
2021-08-04 18:58:55 -07:00
Olaoluwa Osuntokun 98b29a6967 docs/release-notes: update release notes for signet DNS fix 2021-08-04 18:31:41 -07:00
Olaoluwa Osuntokun 673acd781d server: extract bootstrap logic into new function w/ unit test 2021-08-04 18:30:20 -07:00
Olaoluwa Osuntokun 6b1696c4f2 server: disable DNS boostrap for SigNet nodes
In this commit, we fix a bug that would cause nodes attempting to run
using the signet chain, to waste CPU as they attempted to boostrap to a
non-existent DNS seed. We fix this by ignoring the DNS boostrapper is
signet is active. Along the way, we refactor the conditional sightly to
be more readable, and easily extensible.
2021-08-04 18:30:20 -07:00
Olaoluwa Osuntokun 30a0e6c745 Merge pull request #5533 from ErikEk/invoices-return-payment-address-addholdinvoice
invoices: return payment address and add index from addholdinvoice
2021-07-21 16:54:20 -07:00
Olaoluwa Osuntokun 115c99d0e0 docs/release-notes: add section re merge commit exemption 2021-07-20 16:22:46 -07:00
Olaoluwa Osuntokun fee92941f1 scripts: account for master branch merges in release notes script
Without this commit, the build may break if a PR commit is created, as
that shows the `PR_NUMBER` field we parse out as "master", reflecting
that its a merge commit into the master branch.
2021-07-20 16:22:37 -07:00
Olaoluwa Osuntokun 7176a212f7 Merge pull request #5520 from Roasbeef/actions-require-release-notes
build: add new GH actions to require release note updates
2021-07-16 14:21:27 -07:00
Olaoluwa Osuntokun 121979546b docs/release-notes: add entry for new release notes pre-submit check 2021-07-16 11:01:04 -07:00
Olaoluwa Osuntokun 6570749f7f build: add new GH actions to require release note updates
In this commit, we add a simple bash script to parse out the current PR
number from an environment variable in the GH actions context, and use
that to check to see if the PR has been referenced in the release notes
or not. This isn't 100% fool proof, but it should catch most of the
common cases.
2021-07-16 11:00:56 -07:00
Olaoluwa Osuntokun 6cd981420a lntest: fix possible race condition re asserting channel propagation
In this commit, we attempt to fix a race condition that may occur in the
current AMP and MPP tests.

It appears the following scenario is possible:
  * The `mppTestContext` [is used to create 6 channels back to
    back](https://github.com/lightningnetwork/lnd/blob/master/lntest/itest/lnd_amp_test.go#L43)
  * The method used to create the channel ends up calling
    [`openChannelAndAssert`](https://github.com/lightningnetwork/lnd/blob/edd4152682dc8f70e11da541cd3be4692db4b011/lntest/itest/lnd_mpp_test.go#L300)
    which'll open the channel, mine 6 blocks, [then ensure that the
    channel gets
    advertised](https://github.com/lightningnetwork/lnd/blob/edd4152682dc8f70e11da541cd3be4692db4b011/lntest/itest/assertions.go#L78)
  * Later on, [we wait for all nodes to hear about all channels on the
    network
    level](https://github.com/lightningnetwork/lnd/blob/master/lntest/itest/lnd_amp_test.go#L62)

I think the issue here is that we'll potentially already have mined 30
or so blocks before getting to the final nodes, and those nodes may have
already heard about the channel already. This may then cause their
[`lightningNetworkWatcher`](https://github.com/lightningnetwork/lnd/blob/edd4152682dc8f70e11da541cd3be4692db4b011/lntest/node.go#L1213)
goroutine to not properly dispatch this, since it's assumed that the
channel hasn't been announced (or notified) when the method is called.

One solution here is to just check if the channel is already in the
node's graph or not, when we go to register the notification. If we do
this in the same state machine as the watcher, then we ensure if the
channel is already known, the client is immediately notified. One thing
that can help us debug this more in the future is adding additional
logging in some of these helper goroutines so we can more easily track
the control flow.

This commit implements this solution by checking to ensure that the
channel isn't already known in our channel graph before attempting to
wait for its notification, as we may already have missed the
notification before this registration request came in.
2021-07-14 20:12:00 -07:00
Olaoluwa Osuntokun ea7ea33e24 lntest/itest: log node name in addition to ID if waitForChannels fails 2021-07-14 20:11:54 -07:00
Olaoluwa Osuntokun edd4152682 Merge pull request #5449 from yyforyongyu/itest-refactor-assertion
Break down the lnd_test.go file into smaller files
2021-07-13 16:41:55 -07:00
Olaoluwa Osuntokun 7e606c257a Merge pull request #5383 from Crypt-iQ/update_fuzz_docs_06142021
docs+Makefile: update fuzz.md to explain new build/run process
2021-07-13 16:23:48 -07:00
Olaoluwa Osuntokun c23d6fb0e2 Merge pull request #5504 from Zero-1729/patch-1
README: minor typo fix
2021-07-12 18:19:16 -07:00
Olaoluwa Osuntokun c733c139e9 Merge pull request #5462 from ErikEk/typo-labeltx
trivial: walletrpc typo
2021-07-09 17:36:21 -07:00
Olaoluwa Osuntokun 8df611f74c Merge pull request #5472 from joostjager/filter-leases
btcwallet: filter out expired leases
2021-07-09 17:31:03 -07:00
Olaoluwa Osuntokun 7e4b2b82f1 Merge pull request #5448 from xanoni/sample-lnd-conf-cleanup
sample-lnd.conf: remove duplicate setting and clean up section separators
2021-07-09 14:37:32 -07:00
Olaoluwa Osuntokun ab1149f26d Merge pull request #5471 from joostjager/db-itest-prep
itest: prepare for multiple db backends
2021-07-09 14:37:06 -07:00
Olaoluwa Osuntokun 47732ec59e Merge pull request #5475 from katokishin/patch-1
Fixed typo in comment
2021-07-09 14:35:50 -07:00
Olaoluwa Osuntokun ccd7421488 Merge pull request #5487 from C-Otto/fix-5367
htlcswitch: log amount for failures
2021-07-09 14:35:31 -07:00
Olaoluwa Osuntokun db3819fcef Merge pull request #5236 from offerm/preimage-to-settleevent
feature: expose preimage in forward+settle event
2021-07-09 14:35:11 -07:00
Olaoluwa Osuntokun 583dee9916 Merge pull request #5479 from Roasbeef/fix-send-to-route-error-propagation
lnrpc/routerrrpc+routing: fix send to route error propagation
2021-07-07 16:01:56 -07:00
Olaoluwa Osuntokun 079ab1c2bf channeldb: fix typo in PaymentControl.Fail 2021-07-07 15:31:27 -07:00
Olaoluwa Osuntokun 525ef594c7 routing: don't return an error from failPayment within handleSendError
In this commit, we fix a regression introduced by a recent bug fix in
this area. Before this change, we'd inspect the error returned by
`processSendError`, and then fail the payment from the PoV of mission
control using the returned error.

A recent refactoring removed `processSendError` and combined the logic
with `tryApplyChannelUpdate` in order to introduce a new
`handleSendError` method that consolidates the logic within the
`shardHandler`. Along the way, the behavior of the prior check was
replicated in the form of a new internal `failPayment` closure. However,
the new function closure ends up returning a `channeldb.FailureReason`
instance, which is actually an `error`.

In the wild, when `SendToRoute` fails due to an error at the
destination, then this new logic caused the `handleSendErorr` method to
fail with an error, returning an unstructured error back to the caller,
instead of the usual payment failure details.

We fix this by no longer checking the `handleSendErorr` for an error as
normal. The `handleSendErorr` function as is will always return an error
of type `*channeldb.FailureReason`, therefore we don't need to treat it
as a normal error. Instead, we check for the type of error returned, and
update the control tower state accordingly.

With this commit, the test added in the prior commit now passes.

Fixes #5477.
2021-07-07 15:31:22 -07:00
Olaoluwa Osuntokun b24edb2833 routing: modify TestSendToRouteStructuredError to return non-second chance error
In this commit, we modify the existing `TestSendToRouteStructuredError`
test to return an error that doesn't trigger the second chance logic.
Otherwise, we'll get a nil failure result from the mission control
interpretation, meaning we won't exercise the full code path. Instead,
we use a terminal error to ensure that the expected code path is hit.

As is, this test will fail as a recent refactoring causes us to return a
`channeldb.FailureReason` error, since the newly added `handleSendError`
code path in the `SendToRoute` method will return the raw error, rather
than the `shardError`, which is of the expected type.
2021-07-07 15:31:19 -07:00
Olaoluwa Osuntokun 9c9f821ded Merge pull request #5478 from Roasbeef/fix-may-add-htlc
lnwallet: fix payment regression introduced by MayAddOutgoingHtlc
2021-07-07 14:35:03 -07:00
Olaoluwa Osuntokun af43a863cb lnwallet: ensure MayAddOutgoingHtlc doesn't add zero-value HTLCs
In this commit, in order to allow the test added in the prior commit to
pass, we'll increment the mockHTLCAmt value by 1 to ensure we never
attempt to add a zero value HTLC.

Fixes #5468
2021-07-06 16:50:19 -07:00
Olaoluwa Osuntokun 49b18b4d35 lnwallet: add test case to exercise MayAddOutgoingHtlc bug
As is, if the remote party proposes a min HTLC of 0 `mSat` to us, then
we won't ever be able to _send outgoing_ in the channel as the
`MayAddOutgoingHtlc` will attempt to add a zero-value HTLC, which isn't
allowed within the protocol.

The default channels created actually already use a min HTLC value of
zero within the tests, so this test case fails as is.
2021-07-06 16:50:14 -07:00
Olaoluwa Osuntokun bb5c3f3b51 Merge pull request #5447 from bhandras/etcd_le_docs
docs: leader election docs
2021-07-06 16:43:40 -07:00