Commit Graph

14053 Commits

Author SHA1 Message Date
bitromortac
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
bitromortac
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
bitromortac
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
bitromortac
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
bitromortac
99273cc5e1
lntypes+routing: add generic Min/Max functions 2022-12-12 13:22:28 +01:00
bitromortac
e96d48e3a8
mod: add golang.org/x/exp
This commit adds experimental support for generic type constraints.
2022-12-12 13:22:28 +01:00
bitromortac
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
bitromortac
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
bitromortac
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
Oliver Gugger
d9febbb9fc
Merge pull request #7186 from yyforyongyu/fix-missing-channel-updates
Fix potential channel announcements missing
2022-12-12 10:44:25 +01:00
Oliver Gugger
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
yyforyongyu
289e2db2ee
itest+lntemp: add ChainKitClient RPCs and refactor testChainKit 2022-12-09 23:52:40 +08:00
yyforyongyu
1206174648
docs: add release notes for gossip fix 2022-12-08 17:57:28 +08:00
yyforyongyu
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
yyforyongyu
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
yyforyongyu
8dceb739ff
routing: refactor WaitForDependants to allow detailed logging 2022-12-08 17:57:01 +08:00
yyforyongyu
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
yyforyongyu
b237dbfd74
discovery: add method handleNetworkMessages to process messages 2022-12-08 17:57:01 +08:00
yyforyongyu
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
yyforyongyu
26d1a41926
discovery+routing: add more logs to reveal channel update flow 2022-12-08 17:57:01 +08:00
Oliver Gugger
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
ffranr
d72d2edfea
docs: add release notes for chainkit RPC/cli 2022-12-07 14:50:15 +00:00
ffranr
bab526f655
cmd: add chain subcommand
Chain subcommand includes the commands: getblock, getbestblock, and getblockhash.

This commit removes conflicting neutrino cli commands.
2022-12-07 14:50:15 +00:00
ffranr
1345b3c0aa
itest: add chainkit test
This test covers GetBlock, GetBestBlock, and GetBlockHash.
2022-12-07 14:50:15 +00:00
ffranr
561bf82985
chainrpc: add chainkit RPC service
New endpoints: GetBlock, GetBestBlock, and GetBlockHash.
2022-12-07 14:50:14 +00:00
Oliver Gugger
33a5c30671
Merge pull request #7174 from yyforyongyu/prepare-refactor-payment
Prepare for refactoring payment lifecycle
2022-12-07 12:56:06 +01:00
yyforyongyu
0e9bb5cbc6
docs: update release notes 2022-12-07 18:38:22 +08:00
yyforyongyu
271c36d348
channeldb: move payment status code into new file
This prepares the following expansion of the payment status codes.
2022-12-07 18:38:01 +08:00
yyforyongyu
8d49dfb07e
routing: stop tracking totalAmount in paymentLifecycle
This commit removes the field `totalAmount` from `paymentLifecycle` and
only reads it from the channeldb payment.
2022-12-07 18:38:01 +08:00
yyforyongyu
e3bc4f4cc9
htlcswitch+routing: rename GetPaymentResult to GetAttemptResult
This commit renames the method `GetPaymentResult` to be
`GetAttemptResult` to avoid potential confusion and to address the
one-to-many relationship between a payment and its attempts.
2022-12-07 18:38:01 +08:00
yyforyongyu
d1611c999a
routing: rename Fail to FailPayment
This commit renames the method `Fail` to be `FailPayment` to explicitly
address its purpose.
2022-12-07 18:38:01 +08:00
yyforyongyu
2fd4c1e318
channeldb+routing: fix format 2022-12-07 18:38:01 +08:00
Eugene
b8c80dceef
Merge pull request #7221 from ffranr/ci_update_coverage
CI: update test coverage library go-acc
2022-12-06 12:04:21 -08:00
ffranr
308e7ce72d
lnrpc: identify *.proto files as separate files within a given directory 2022-12-06 12:52:31 +00:00
ffranr
03f9549f97
chainrpc: generalise chain notifier RPC server name 2022-12-06 12:52:25 +00:00
Oliver Gugger
ddbe09be87
Merge pull request #7236 from yyforyongyu/fix-typo
proto: fix typo [skip ci]
2022-12-06 09:21:11 +01:00
yyforyongyu
7533de4a8f
proto: fix typo [skip ci] 2022-12-06 14:04:42 +08:00
Olaoluwa Osuntokun
2477095473
Merge pull request #7209 from guggero/btcwallet-fund-psbt
mod+docs: bump btcwallet to latest version
2022-12-05 19:47:42 -08:00
Oliver Gugger
625c6f1949
Merge pull request #7227 from Crypt-iQ/tlv_change_to_p2p
multi: update to tlv/v1.1.0 and use new *P2P tlv decoding variants
2022-12-05 23:11:30 +01:00
eugene
60d4815b54
release-notes: update for 0.16.0 2022-12-05 09:32:59 -05:00
eugene
032632b4e0
multi: update to tlv/v1.1.0 and use new *P2P tlv decoding variants
This changes the call-sites in several places to use the *P2P variants
to not trigger an OOM on untrusted input. This makes the code safe with
the new tlv version. Note that the call-sites prior to this change were
also safe.
2022-12-05 09:32:56 -05:00
Oliver Gugger
e23c5dca73
Merge pull request #7159 from yyforyongyu/code-review-6542
Payments and invoices filtering by creation date
2022-12-05 14:39:17 +01:00
ffranr
2067e32862
CI: update test coverage library go-acc 2022-12-05 13:15:10 +00:00
Tommy Volk
6dfbf17b74
gitrelease-notes: update release notes for 0.16.0 2022-12-05 20:04:47 +08:00
yyforyongyu
29652d88ee
lntest: add itest for timestamp filters 2022-12-05 20:04:47 +08:00
yyforyongyu
57b7eb7814
cli: update listinvoices and listpayments to use the date filter 2022-12-05 20:04:47 +08:00
yyforyongyu
e9269c2093
channeldb+lnd: rpc server filters payments by date 2022-12-05 20:04:47 +08:00
yyforyongyu
b7c829f792
proto: add creation data filters in ListPaymentsRequest 2022-12-05 20:04:42 +08:00
yyforyongyu
234b9a3d97
channeldb+lnd: rpc server filters invoices by date 2022-12-05 20:03:58 +08:00
yyforyongyu
cfa2cb01d0
proto: add creation date filters in ListInvoiceRequest 2022-12-05 20:03:55 +08:00