Commit Graph

14133 Commits

Author SHA1 Message Date
c03de26dcc Merge pull request #7268 from ellemouton/avoidPanicInFundingTest
funding: check error to avoid panic during test
2023-01-03 16:32:32 +01:00
3ffd3b2018 Merge pull request #7176 from b-ryan/fix-bumpfee-doc
Fix bumpfee command doc, incorrect reference to pendingsweeps
2023-01-03 11:22:52 +01:00
73328bd449 Merge pull request #7271 from hieblmi/patch-4
docs: Fix lnd.conf typo
2023-01-03 11:08:48 +01:00
c5fa9ef45f docs: Fix lnd.conf typo
Remove repeated word error [skip ci]
2022-12-28 20:37:03 +10:30
d4a49b08f5 funding: check error to avoid panic during test
This commit, the error returned from `getInitialFwdingPolicy` is checked
in order to avoid a nil pointer dereference panic during the
TestFundingManagerCustomChannelParameters test.
2022-12-22 10:06:42 +02:00
de3e0d7875 Merge pull request #7239 from Roasbeef/gossip-scoping-issues
discovery: ensure we prioritize sending out our own local announcements
2022-12-16 13:51:17 -08:00
050db16e5d docs/release-notes: add release notes for gossip msg prioritization 2022-12-15 11:56:49 -08:00
f94a67a26d discovery: properly set the isRemote field for validated networkMsg
This wasn't set properly, leading to some test failures after the prior
change.
2022-12-15 11:56:44 -08:00
52451b37af discovery: ensure we prioritize sending out our own local announcements
In this commit, we modify our gossip broadcast logic to ensure that we
always will send out our own gossip messages regardless of the
filtering/feature policies of the peer.

Before this commit, it was possible that when we went to broadcast an
announcement, none of our peers actually had us as a syncer peer (lnd
terminology). In this case, the FilterGossipMsg function wouldn't do
anything, as they don't have an active timestamp filter set. When we go
to them merge the syncer map, we'd add all these peers we didn't send
to, meaning we would skip them when it came to broadcast time.

In this commit, we now split things into two phases: we'll broadcast
_our_ own announcements to all our peers, but then do the normal
filtering and chunking for the announcements we got from a remote peer.

Fixes https://github.com/lightningnetwork/lnd/issues/6531
Fixes https://github.com/lightningnetwork/lnd/issues/7223
Fixes https://github.com/lightningnetwork/lnd/issues/7073
2022-12-15 11:56:41 -08:00
9a4701d709 discovery: add new msgsToBroadcast struct
This struct will be used to later on do filtering when we go to
broadcast, based on if a message was locally sourced or granted from a
remote peer.
2022-12-15 11:56:38 -08:00
e8177ea427 discovery: add isLocal bool to msgWithSenders
This lets us keep track of which messages we created ourselves vs the
messages that originated remotely from a peer.
2022-12-15 11:56:36 -08:00
adb239300f fn: add new fn (func utils) package for generic helper funcs
We start with a simple Map function that can be useful for transforming
objects on the fly.

We may want to eventually make this Taro pakage into a module so we can
just have everything in one place:
https://github.com/lightninglabs/taro/tree/main/chanutils.
2022-12-15 11:56:31 -08:00
a347e405e8 Merge pull request #7254 from yyforyongyu/fix-tools
tools: fix docker version
2022-12-15 11:55:49 -08:00
3ca7e30199 github: move fmt-check into lint 2022-12-15 16:56:06 +08:00
26110beb53 github: upgrade actions/checkout to v3 2022-12-15 16:32:45 +08:00
26613a2d46 github: create new action to hold common setup 2022-12-15 16:26:12 +08:00
601cf60070 tools: fix docker version 2022-12-15 16:03:55 +08:00
8a18824851 Merge pull request #7243 from guggero/ghost-utxo-fix
wallet: fix ghost UTXOs not being detected
2022-12-13 20:00:31 -08:00
d468391d95 Merge pull request #6857 from bitromortac/2208-apriori-capacity
pathfinding: capacity-dependent apriori model probability
2022-12-12 19:07:39 -08:00
6bba1dc976 Merge pull request #7242 from morehouse/itest_mining_patch
lntemp: after mining, sync to latest block
2022-12-12 21:11:59 +01:00
55a146d4e4 docs: update release notes 2022-12-12 09:08:12 -06:00
b72993c9dd lntemp: after mining, sync to latest block
Ensure active nodes are synced to the latest block mined.

There are two scenarios where they might not be synced to the correct
block even when SyncedToChain is true:
  1. The backend may have rejected a newly mined block (e.g., see
     #7241).
  2. The backend might not have fully processed the new blocks yet.

In either case SyncedToChain will (correctly) be true since the node is
indeed fully synced to the backend. This commit makes sure we detect
case 1 above, while making sure we continue to wait in case 2.
2022-12-12 09:06:51 -06:00
2d7fda2a41 routerrpc: mark QueryProbability deprecated
We deprecate `QueryProbability`, as it displays the same information as
`QueryMissionControl` less the probability. `QueryRoutes` still contains
the total probability of a route.
2022-12-12 13:23:31 +01:00
1dd7a37d4d routing: apply capacity factor
We multiply the apriori probability with a factor to take capacity into
account:

P *= 1 - 1 / [1 + exp(-(amount - cutoff)/smearing)]

The factor is a function value between 1 (small amount) and 0 (high
amount). The zero limit may not be reached exactly depending on the
smearing and cutoff combination. The function is a logistic function
mirrored about the y-axis. The cutoff determines the amount at which a
significant reduction in probability takes place and the smearing
parameter defines how smooth the transition from 1 to 0 is. Both, the
cutoff and smearing parameters are defined in terms of fixed fractions
of the capacity.
2022-12-12 13:22:29 +01:00
454c115b6e routing+routerrpc: add capacity in rpcs
FetchPairCapacity is used by the following endpoints to introduce the
capacity for probability calculations:

* QueryProbability
* QueryRoutes
2022-12-12 13:22:29 +01:00
66ffc64776 router: return probability from findPath
The returned probability can then be used in QueryRoutes to not having
to reconstruct the probability.
2022-12-12 13:22:29 +01:00
516e3a8cca routing: use capacity in pathfinding
Extends the pathfinder with a capacity argument for later usage.

In tests, the inserted testCapacity has no effect, but will be used
later to estimate reduced probabilities from it.
2022-12-12 13:22:28 +01:00
2b6308a61f routing: implement capacity in getEdge
This commit adds the maximal capacity between two nodes to the unified
edge data. We use MaxHTLC as a replacement if the channel capacity is
not available.

In tests we use larger maxHTLC values to be able to convert to a
non-zero sat capacity.
2022-12-12 13:22:28 +01:00
99273cc5e1 lntypes+routing: add generic Min/Max functions 2022-12-12 13:22:28 +01:00
e96d48e3a8 mod: add golang.org/x/exp
This commit adds experimental support for generic type constraints.
2022-12-12 13:22:28 +01:00
ce6cadec18 routing: refactor unified edges test
The test for unified edges is refactored into a table-driven test. It
accomodates already a unifier per test for later expansion.
2022-12-12 13:22:28 +01:00
76e711ead0 routing: refactor unified policies to edges
This commit refactors the semantics of unified policies to unified
edges. The main changes are the following renamings:

* unifiedPolicies -> nodeEdgeUnifier
* unifiedPolicy -> edgeUnifier
* unifiedPolicyEdge -> unifiedEdge

Comments and shortened variable names are changed to reflect the new
semantics.
2022-12-12 13:22:26 +01:00
7d29ab905c routing: return *unifiedPolicyEdge in getPolicy
We encapsulate the capacity inside a unifiedPolicyEdge for later usage.
The meaning of "policy" has changed now, which will be refactored in the
next commmit.
2022-12-12 13:19:29 +01:00
d9febbb9fc Merge pull request #7186 from yyforyongyu/fix-missing-channel-updates
Fix potential channel announcements missing
2022-12-12 10:44:25 +01:00
72d97e92b6 Merge pull request #7245 from yyforyongyu/itest-chain-kit
itest+lntemp: add `ChainKitClient` RPCs and refactor `testChainKit`
2022-12-09 18:32:18 +01:00
289e2db2ee itest+lntemp: add ChainKitClient RPCs and refactor testChainKit 2022-12-09 23:52:40 +08:00
ad0dbb1c15 walletunlocker: re-create loader after unloading wallet
Because the wallet loader sets its internal database reference to nil
when unloading a wallet, it cannot be loaded again in case of a remote
DB such as etcd or postgres. To avoid running into a nil pointer panic
we just re-create the loader as well before opening the wallet.
2022-12-09 11:09:05 +01:00
d04182f482 docs: add release notes 2022-12-09 00:56:49 +01:00
f26a9a84d7 lntest: fix rescan test to show correct behavior
Now that we have patched the btcwallet version to the one that includes
the fix, we can adjust the rescan test to show the correct and expected
behavior.
2022-12-09 00:56:49 +01:00
5e851912a7 mod: bump btcwallet to latest version 2022-12-09 00:56:49 +01:00
2221d0ccb1 lntest+lntemp: add itest case for wallet rescan problem
In this commit we add a test that demonstrates the problem of ghost
UTXOs lingering in the wallet after a re-scan, even if they were spent.

NOTE: This test shows the incorrect behavior and will be adjusted in a
follow-up commit to show the correct behavior after patching the
btcwallet version.
2022-12-09 00:56:49 +01:00
1206174648 docs: add release notes for gossip fix 2022-12-08 17:57:28 +08:00
443095a907 discovery: signal allow for ignored channel announcements
This commit makes the `handleChanAnnouncement` always returning `true`
for messages processed but ignored by router, even when the extracted
announcements are empty.
Previously we'd return false when the announcements are empty, which
could cause `ChannelUpdate`s being ignored since the validation barrier
will signal deny for the jobs. This can easily be trigger using
following setup,
1. Alice connects to Bob and open a channel.
2. Alice connects to Carol, Bob connects to Carol.
3. Once the channel is open, Alice and Bob will both announce it to Carol.

At some point, we'd have the following messages in Carol's node,
- Alice's ChannelAnnouncement
- Alice's ChannelUpdates, for both directions
- Bob's ChannelAnnouncement
- Bob's ChannelUpdates, for both directions

And a bug could happen, if,
- Alice's ChannelAnnouncement is processed by router, hence added to db,
  but not reporting back to gossiper yet, so the validation barrier
  hasn't sent signal allow.
- Bob's ChannelAnnouncement is processed by router, and returned
  `ErrIgnored` as the edge info is already in db, and reported back to
  gossiper, the validation barrier will signal deny to all the
  ChannelUpdates jobs.
- Depending on how fast Alice's ChannelAnnouncement is processed, we may
  get zero to four denies to the above ChannelUpdates, causing a channel
  edge policy never being updated.
2022-12-08 17:57:02 +08:00
716c685f10 discovery+peer: add logs to reveal shutdown flow
Also adds a `TODO` for checking the err chan.
2022-12-08 17:57:01 +08:00
8dceb739ff routing: refactor WaitForDependants to allow detailed logging 2022-12-08 17:57:01 +08:00
152a438fbe discovery: move shouldBroadcast inside goroutine
This commit moves the `shouldBroadcast` logic closer to the execution
logic of deciding whether we want to broadcast the announcements. This
is a pure code refactor and should make no difference in announcing
message unless the `d.syncMgr.IsGraphSynced()` gives different results
inside the goroutine.
2022-12-08 17:57:01 +08:00
b237dbfd74 discovery: add method handleNetworkMessages to process messages 2022-12-08 17:57:01 +08:00
29c2458831 routing: add method handleNetworkUpdate to process the network update
This commit refactors the `networkHandler` to use the new method
`handleNetworkUpdate`. Because the `select` is called inside a for loop,
which is equivalent of firing goroutine inside range loop, it's possible
that a variable used inside a previous goroutine is referencing the
current one. This is now fixed by making the goroutine taking the params
used for network update.
2022-12-08 17:57:01 +08:00
26d1a41926 discovery+routing: add more logs to reveal channel update flow 2022-12-08 17:57:01 +08:00
a0385a535b Merge pull request #7197 from ffranr/add_chain_rpc_calls
lncli+chainrpc: add chainkit RPC service with endpoints GetBlock, GetBestBlock, GetBlockHash
2022-12-07 17:32:54 +01:00