Commit Graph

12225 Commits

Author SHA1 Message Date
Elle Mouton
f667683e6c
htlcswitch: respect minimum relay fee
When channels fee rates are being considered for an update, the minimum
relay fee should also be considered.
2021-10-05 18:30:41 +02:00
Elle Mouton
6712595618
lnwallet: fix validateFeeRate
The validateFeeRate function uses the availableBalance function to get
the current spendable balance of a channel, adds the old fee and then
ensures that the new fee is not larger than the amount we have available
to spend. This commit also removes the local reserve check in the
validateFeeRate function since the balance returned from
availableBalance already takes the local reserve into acccount.
2021-10-05 09:00:02 +02:00
Elle Mouton
2b8a4d296e
lnwallet: use availableBalance in max fee calc
In this commit we ensure that the max fee calculated in the MaxFeeRate
function takes the local reserve amount into account along with any
pending HTLCs. This is done by calling the avaialbeBalance function.
2021-10-05 08:24:10 +02:00
Olaoluwa Osuntokun
af9b620854
Merge pull request #5538 from ellemouton/refreshPeerIP
multi: refresh peer IP during reconnect
2021-10-04 15:26:47 -07:00
Elle Mouton
317acf7c7c
docs/release-notes: add new entry for 5538 2021-10-04 14:57:50 +02:00
Elle Mouton
da64a24ad8
server: update persistent peer addrs from announcements
In this commit, a subscription is made to topology updates. For any
NodeAnnouncements received for our peristent peers, we store their newly
advertised addresses. If at the time of receiving these new addresses
there are any existing connection requests, these are updated to reflect
the newly advertised addresses.
2021-10-04 14:57:50 +02:00
Elle Mouton
6b5b53d517
lntest: show reconnection bug
In this commit we demonstrate a bug to show that if an inbound peer
changes their listening address to one not advertised in their original
NodeAnnouncement then we will not be able to reconnect to them. This bug
will be fixed in a follow-up commit.
2021-10-04 14:57:50 +02:00
Elle Mouton
d639a4d73f
server+lntest: use all addrs during reconnect
In this commit, all advertised addresses of a peer are used during
reconnection. This fixes a bug previously demonstrated in an itest.
2021-10-04 14:57:50 +02:00
Elle Mouton
169316eba2
server: fetch addr from db if outbound too
This commit just ensures that we fetch the lastest advertised addresses
for a peer from the db for both inbound and outbound peers. The reason
for seperating this into its own commit is to make future commits in
this PR easier to review.
2021-10-04 14:57:49 +02:00
Elle Mouton
004ce640d0
server: exit early if not persistent peer
The point of this commit is to make future commits in the same PR easier
to review. All that this commit does is exit early if the peer we are
considering is not persistent instead of having a bunch of logic
indented in an if-clause.
2021-10-04 14:57:49 +02:00
Elle Mouton
18909e1a8e
lntest: show that multi addresses are not used
This commit adds an itest to demonstrate that if a peer advertises
multiplie external IP addresses, then they will not all be used to
reconnect to the peer during reconnection. This will be fixed in a
follow-up commit.
2021-10-04 14:57:49 +02:00
Elle Mouton
5177ec2f84
lntest: create persistent connection
This commit adds a ConnectNodesPerm function to the itest NetworkHarness
so that persistent connections between nodes can be mocked.
2021-10-04 14:57:49 +02:00
Elle Mouton
9a97577c00
lntest: refactor assertNumConnections
The assertNumConnection function currently takes in an 'expected' number
of connections argument and asserts that both alice and bob only each
only have that number of connections. So this fails to be useful if say
alice is also connected to charlie cause then if we call
assertNumConnections between alice and bob it will fail saying there are
2 connections between them since all it does is count alice's total
  number of connections. This commit replaces this function with 2 new
functions: assertConnected which asserts that at least one connection
exists between two peers and assertNotConnected which asserts that no
connections exists between the two peers.
2021-10-04 14:57:48 +02:00
Oliver Gugger
51d19dad87
Merge pull request #5363 from guggero/psbt-no-final-tx
Allow skipping `PsbtFinalize` step during channel funding to support external broadcast
2021-10-04 12:37:51 +02:00
Oliver Gugger
692ea25295
Merge pull request #5642 from guggero/in-memory-graph
In-memory graph cache for faster pathfinding
2021-10-04 11:20:23 +02:00
Oliver Gugger
3e7df3d20d
docs: add release notes 2021-10-04 11:17:58 +02:00
Oliver Gugger
bf60b20def
docs: add example for PSBT batch funding 2021-10-04 11:17:09 +02:00
Oliver Gugger
57253c0c05
itest: add test for fully external PSBT funding 2021-10-04 11:17:08 +02:00
Oliver Gugger
1608faf199
multi: allow skipping the PSBT finalize step
The FundingPsbtFinalize step is a safety measure that assures the final
signed funding transaction has the same TXID as was registered during
the funding flow and was used for the commitment transactions.
This step is cumbersome to use if the whole funding process is completed
external to lnd. We allow the finalize step to be skipped for such
cases. The API user/script will need to make sure things are verified
(and possibly cleaned up) properly.
2021-10-04 11:17:08 +02:00
Oliver Gugger
d4136002c1
lnwallet: only set funding TX witness if we publish
During the final part of the channel funding negotiation we only need to
assemble the full funding TX with the witness if we are going to publish
the transaction ourselves. If the final funding TX is published
externally we don't need this information. This will make it possible to
skip the verify process for fully externally funded PSBT channels.
2021-10-04 11:17:08 +02:00
Oliver Gugger
9b04ae45e3
chanfunding: fix swapped godoc comments 2021-10-04 11:17:07 +02:00
Oliver Gugger
fa8e8e6f99
Merge pull request #5761 from naveensrinivasan/naveen/feat/fix-mongo-CVE
mod:replace mongo driver to address CVE-2021-20329
2021-10-04 10:43:20 +02:00
naveen
844dbc08e7
mod:replace mongo driver to address CVE-2021-20329
* The mongo driver has CVE https://github.com/advisories/GHSA-f6mq-5m25-4r72
* The mongo driver is an indirect reference and cannot be directly
upgraded.
* https://deps.dev/advisory/OSV/GO-2021-0112?from=%2Fgo%2Fgithub.com%252Flightningnetwork%252Flnd
* The fix will replace the reference of the library with the fixed
  version.
2021-10-01 13:48:47 +00:00
Oliver Gugger
c43b9e4fe7
Merge pull request #5759 from naveensrinivasan/naveen/feat/fix-GO-2021-0053
mod:replace gogo/protobuf for GO-2021-0053
2021-10-01 15:45:54 +02:00
naveen
d5e3302265
mod : replace gogo/protobuf for GO-2021-0053
The gogo/protobuf has OSV GO-2021-0053
https://deps.dev/advisory/OSV/GO-2021-0053?from=%2Fgo%2Fgithub.com%252Flightningnetwork%252Flnd

This is used indirectly and has to be replaced in go.mod to avoid the
direct reference to that version.

The OSV has been addressed in v1.3.2
2021-10-01 13:07:52 +00:00
Oliver Gugger
036041d671
Merge pull request #5665 from LN-Zap/upstream/feat/single-utxo-reserved
lnd: use change output index from authoring TX to check reserved value
2021-10-01 09:51:28 +02:00
Bjarne Magnussen
1d84c1d739
docs: add to release notes 2021-10-01 08:21:46 +02:00
Bjarne Magnussen
a5a477e311
lnd: add optional change output index to check reserved wallet balance 2021-10-01 08:21:29 +02:00
Olaoluwa Osuntokun
32fa48df7d
Merge pull request #5770 from Crypt-iQ/dust_threshold_0619
lnwallet+htlcswitch: make Switch dust-aware
2021-09-30 20:20:19 -07:00
Olaoluwa Osuntokun
8ba68ca59f
Merge pull request #5789 from naveensrinivasan/naveen/feat/fix-CVE-2021-29482
mod: Upgraded xz library to FIX the CVE-2021-29482
2021-09-30 20:16:13 -07:00
Olaoluwa Osuntokun
91edfaed85
Merge pull request #5802 from yyforyongyu/5318-fix-addr-format
lndcfg: give verbose err when failed to load config
2021-09-30 20:14:08 -07:00
Olaoluwa Osuntokun
c6b250c479
Merge pull request #5807 from ellemouton/bumpNeutrinoVersion
go.mod: latest neutrino commit
2021-09-30 20:13:03 -07:00
Olaoluwa Osuntokun
dd7bfa0c4a
Merge pull request #5650 from Roasbeef/go-1-17
build: upgrade all CI+build infra to Go 1.17
2021-09-30 19:12:29 -07:00
eugene
25a0fe2902
docs: update release notes for 0.13.3 2021-09-30 13:44:35 -04:00
eugene
702b3a3258
multi: introduce config-level DustThreshold for defining threshold 2021-09-30 13:44:35 -04:00
eugene
3897baff0a
htlcswitch: call evaluateDustThreshold in SendHTLC, handlePacketForward
This commit makes SendHTLC (we are the source) evaluate the dust
threshold of the outgoing channel against the default threshold of
500K satoshis. If the threshold is exceeded by adding this HTLC, we
fail backwards. It also makes handlePacketForward (we are forwarding)
evaluate the dust threshold of the incoming channel and the outgoing
channel and fails backwards if either channel's dust sum exceeds the
default threshold.
2021-09-30 13:44:34 -04:00
eugene
0ce6194e1e
htlcswitch: extend ChannelLink iface with dustHandler iface
This allows the Switch to determine the dust exposure of a certain
channel and allows the link to set the feerate of the mailbox given
a fee update.
2021-09-30 13:44:34 -04:00
eugene
0b24603aef
htlcswitch: extend Mailbox iface with dust, fee methods
This commit extends the Mailbox interface with the SetDustClosure,
SetFeeRate, and DustPackets methods. This enables the mailbox to
report the dust exposure to the Switch when the Switch decides whether
to forward a dust packet. The dust is counted from the time an Add is
introduced via AddPacket until it is removed via AckPacket. This can
lead to some packets being counted twice before they are signed for,
but this is a trade-off between accuracy and simplicity.
2021-09-30 13:44:34 -04:00
eugene
7d16e58b5c
lnwallet: introduce GetDustSum method to calculate worst-case dust sum
It over-estimates the local or remote commitment's dust sum by
counting all updates in both updateLogs that are dust using the
trimmed-to-dust mechanism if applicable. The over-estimation is done
because ensuring an accurate counting is a trade-off between code
simplicity and accuracy.
2021-09-30 13:44:26 -04:00
Elle Mouton
9a27cd93c3
go.mod: latest neutrino commit 2021-09-30 09:30:10 +02:00
Olaoluwa Osuntokun
34cb9357ee
Merge pull request #5808 from Crypt-iQ/shutdown_clean_flakefix_0929
htlcswitch: fix flake in TestShutdownIfChannelClean
2021-09-29 17:43:09 -07:00
Olaoluwa Osuntokun
6ae6f8026b
build: retract v0.0.2
A stray version of lnd was pushed out waaaay back in 2016 that can trip
up `pkg.go.dev` and things like `go get`. Using the new Go 1.16 feature,
we can now "retract" this version, which marks it as being unavailable.
2021-09-29 17:31:50 -07:00
Olaoluwa Osuntokun
6b73f01683
build: set min Go version to 1.16 in go.mod 2021-09-29 17:31:45 -07:00
Olaoluwa Osuntokun
9b9e1d329a
docs/release-notes: add new entry for bump to Go 1.17 2021-09-29 17:31:42 -07:00
Olaoluwa Osuntokun
d6fc6f4960
docs: advertise Go 1.16 as min Go version in INSTALL.md 2021-09-29 17:31:40 -07:00
Oliver Gugger
0b4e03f5fc
multi: add golang 1.17 compatible build tags
With go 1.17 a change to the build flags was implemented:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

The formatter now automatically adds the forward-compatible build tag
format and the linter checks for them, so we need to include them in our
code.
2021-09-29 17:31:37 -07:00
Olaoluwa Osuntokun
d973cf1060
build: upgrade all CI+build infra to Go 1.17 2021-09-29 17:31:34 -07:00
Oliver Gugger
7aa9661d42
lntest: use errgroup for node startup
This commit fixes a nil pointer issue when a node fails to start up.
Because require.NoErrorf() doesn't abort a test immediately if run
inside a goroutine, this lead to the test continuing with nil node
references which lead to a panic later on.
2021-09-29 17:31:32 -07:00
Olaoluwa Osuntokun
dd4cf268a0
Merge pull request #5804 from guggero/itest-setup-error
lntest: use errgroup for node startup [skip ci]
2021-09-29 17:31:17 -07:00
Olaoluwa Osuntokun
aac824d6ef
Merge pull request #5781 from Crypt-iQ/accurate_dust0922
multi: replace DefaultDustLimit with accurate dust limit
2021-09-29 16:28:18 -07:00