Commit Graph

1043 Commits

Author SHA1 Message Date
f2ef2b4774 lnwallet: update GenTaprootFundingScript to also return the taproot internal key 2024-04-24 16:47:37 +02:00
ebeb3afb04 multi: update GenTaprootFundingScript to pass tapscript root
In most cases, we won't yet be passing a root. The option usage helps us keep the control flow mostly unchanged.
2024-04-24 11:34:29 +02:00
648fb22f63 multi: wrap all errors 2024-04-11 15:04:03 +02:00
0bae781785 routing: add inbound fee support to pathfinding
Add sender-side support for inbound fees in pathfinding
and route building.
2024-03-31 18:12:28 +02:00
9d4251c18d routing/test: test local unified edge 2024-03-31 18:12:28 +02:00
e0a080454a routing: track unifiedPolicyEdge
Preparation so that we can have the inbound fee available
in addition to the outgoing policy.
2024-03-31 18:12:28 +02:00
763787e08c routing+lnrpc: add inbound fee policy update 2024-03-31 16:49:19 +02:00
3e6adbf1c0 lnwire+channeldb: parse inbound fees
In this commit, the tlv extension of a channel update message is parsed.
If an inbound fee schedule is encountered, it is reported in the
graph rpc calls.
2024-03-31 16:33:26 +02:00
d67f65212b routing: fix comment on blinded path cltv delta 2024-03-27 09:39:02 -04:00
0aeb7c4ba2 multi/refactor: clarify blinded payment fee rate field name 2024-03-27 09:39:00 -04:00
ad9144ffa3 Merge pull request #8273 from guggero/bitcoind-26
GitHub: use bitcoind v26.0 for CI
2024-03-20 01:50:44 -06:00
aa811c784a lnwallet+routing: use chainntnfs.NewBitcoindBackend
Since we fixed a number of issues in chainntnfs.NewBitcoindBackend that
makes it compatible with bitcoind v26.0, we now want to use that
function in all our unit tests.
2024-03-18 16:13:40 +01:00
d40312c36b multi: move unit test backend funcs to new package
To avoid circular dependency issues between packages, we move the unit
test backend creation function to a new package in the lntest parent
package.
2024-03-18 16:13:39 +01:00
c170a9830b multi: use chainntnfs.NewMiner for miners in unit tests
With the chainntnfs.NewMiner now being optimized for not creating
nodes with colliding ports, we use it in all unit tests that spin up
temporary miners.
2024-03-18 16:13:39 +01:00
11d6442d17 routerrpc: Add detailed info/trace logging during a rescan 2024-03-14 11:23:16 -06:00
24080c51f9 multi: fee estimation timeout parameters
conf: fee estimation timeout in sample config
2024-03-05 09:24:27 +01:00
cd566eb097 multi: fix fmt.Errorf error wrapping
Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
2024-02-27 11:13:40 +00:00
4732c09a26 multi: Fix final hop payload size for AMP payments. 2024-02-03 12:16:06 +00:00
ff30ff40bf multi: Fix final hop payload size for blinded rt.
The final hop size is calculated differently therefore we extract
the logic in its own function and also account for the case where
the final hop might be a blinded hop.
2024-02-03 12:11:01 +00:00
c1b91fff14 multi: use new AdditionalEdge interface.
In the previous commit the AdditionalEdge interface was introduced
with both of its implementations `BlindedEdge` and `PrivateEdge`.
In both cases where we append a route either by a blinded route
section or private route hints we now use these new types. In
addition the `PayloadSizeFunc` type is introduced in the
`unifiedEdge` struct. This is necessary to have the payload size
function at hand when searching for a route hence not overshooting
the max sphinx package size of 1300 bytes.
2024-02-03 12:10:46 +00:00
9d3c0d9e3a routing: add new interface AdditionalEdge.
A new interface AdditionalEdge is introduced which allows us to
enhance the CachedEdgePolicy with additional information. We
currently only need a PayloadSize function which is then used to
determine the exact payload size when building a route to adhere
to the sphinx package size limit (BOLT04).
2024-02-01 17:37:43 +00:00
6c427a6ba9 multi: update FetchChanInfos to take in an optional tx
In this commit, the FetchChanInfos ChannelGraph method is updated to
take in an optional read transaction for the case where it is called
from within another transaction.
2024-01-22 21:07:55 +02:00
08c18a338b Merge pull request #8275 from ProofOfKeags/chore/enforce-feature-bits
multi: make legacy feature bits compulsory
2024-01-18 17:26:09 +02:00
26c466aa80 Merge pull request #8372 from mohamedawnallah/deep-copy-transactions-GetBlock
routing: deep copy any transaction we obtain from `GetBlock` call.
2024-01-15 20:13:00 +08:00
99908ed2dc routing: deep copy any transaciton we obtain from GetBlock call. 2024-01-15 11:35:55 +02:00
239103c2b3 multi: make tlv onion compulsory 2024-01-11 09:43:31 -08:00
34af399a5b Merge pull request #8096 from ziggie1984/fix-dip-below-reserve
lnwallet: Introduce a fee buffer.
2024-01-09 01:52:04 +08:00
1aa1e18b9f routing: add log message. 2024-01-08 16:47:48 +01:00
58677569b5 routing+routerrpc: remove redudant error check
Since `SendPaymentAsync` now never returns an error, there's no need to
catch it and check it in `SendPaymentV2`.
2024-01-05 18:11:04 +08:00
cedbdd8999 Merge pull request #8142 from carlaKC/8137-validateblindedpayload
routing: Add Validation for Decoding Blinded Paths
2024-01-03 12:33:11 -08:00
4071db77b5 routing: add handling for blinded errors from final node
We do not expect blinding errors from the final node:
1. If the introduction is the recipient, they should use regular errors.
2. Otherwise, nodes have no business sending this error when they are
   not part of a blinded route.
2023-12-18 12:07:56 -05:00
7ce3a152a1 routing/refactor: add failNode helper to final outcome processing
Note: this refactor updates the inequality used from >= 2 to > 1 to
align with the rest of this file so that we express this concept
consistently throughout the code.
2023-12-18 12:07:47 -05:00
b82478a7e7 routing: add result interpretation for intermediate invalid blinding
This commit adds handling for route blinding errors that are reported
by the introduction node in a multi-hop blinded route. As the
introduction node is always responsible for handling blinded errors,
it is not penalized - only the final hop is penalized to discourage the
blinded route without filling up mission control with ephemeral
results.

If this error code is reported by a node that is not an introduction
node, we penalize the node because it is returning an error code that
it should not be using.
2023-12-18 12:07:46 -05:00
f91589bef9 routing: handle introduction node failure to convert error
This commit adds handling for errors that originate after the
introduction node when making payment to a blinded route. This
indicates that the introduction node is not obeying the spec, so
it is punished for the violation.
2023-12-18 12:07:36 -05:00
69d5496e7c multi: update payload validation to account for blinded routes 2023-12-18 11:27:55 -05:00
7db072e020 routing: add additional validation to hop payload creation 2023-12-18 11:27:52 -05:00
585f28c5f5 multi: explicitly signal final hop in pack hop payload
Previously, we'd use the value of nextChanID to infer whether a payload
was for the final hop in a route. This commit updates our packing logic
to explicitly signal to account for blinded routes, which allow zero
value nextChanID in intermediate hops. This is a preparatory commit
that allows us to more thoroughly validate payloads.
2023-12-18 11:27:52 -05:00
a75bc13230 routing/test: set outgoing timelock on non-legacy test cases
Provide valid hop payloads for tests cases that use TLV onion format.
2023-12-18 11:27:49 -05:00
1bb48178d7 routing/test: add channel id for final hop in clear route
Add the missing channel field to the final hop in our clear text
route test case. Note that this is the channel of the hop. With the
addition of stricter validation, we'll need this so that the
penultimate hop has a non-zero next channel ID.
2023-12-12 10:01:25 -05:00
e12321cfd6 multi: extract and pass through IsZombieChannel method 2023-12-11 09:12:05 +02:00
faf76fbf0e routing: launch fetchFundingTx in goroutine so router can exit
This commit introduces a wrapper function fetchFundingTxWrapper
which calls fetchFundingTx in a goroutine. This is to avoid an issue
with pruned nodes where the router is attempting to stop, but the
prunedBlockDispatcher is waiting to connect to peers that can serve
the block. This can cause the shutdown process to hang until we
connect to a peer that can send us the block.
2023-11-30 10:45:02 -05:00
9acbbf0ec7 routing: make sure StatusInitiated is notified when creating payments
This commit fixes `InitPayment` method to make sure the subscribers get
notified when new payments are created.
2023-11-15 20:18:21 +08:00
678f416008 routing+docs: make sure non-MPP cannot use skipTempErr 2023-11-13 16:11:06 +08:00
98378d9408 routing: unify all dummy errors to be errDummy 2023-11-13 16:10:28 +08:00
7ccb77269d routing: log preimage when it's failed to be saved to db 2023-11-13 16:10:28 +08:00
8f5c6e8367 trivial: fix typos 2023-11-13 16:10:28 +08:00
e3dadd528b routing: mark payment as failed when no route can be found 2023-11-13 16:10:28 +08:00
6e93764bc1 routing: make sure payment hash is random in unit tests
This commit makes sure a testing payment is created via
`createDummyLightningPayment` to ensure the payment hash is unique to
avoid collision of the same payment hash being used in uint tests. Since
the tests are running in parallel and accessing db, if two difference
tests are using the same payment hash, no clean test state can be
guaranteed.
2023-11-13 16:09:12 +08:00
10052ff4f5 routing: patch unit tests for payment lifecycle
This commit adds unit tests for `resumePayment`. In addition, the
`resumePayment` has been split into two parts so it's easier to be
tested, 1) sending the htlc, and 2) collecting results. As seen in the
new tests, this split largely reduces the complexity involved and makes
the unit test flow sequential.

This commit also makes full use of `mock.Mock` in the unit tests to
provide a more clear testing flow.
2023-11-13 16:09:12 +08:00
e46c689bf1 routing: refactor attempt makers to return pointers
Thus adding following unit tests can be a bit easier.
2023-11-13 16:09:12 +08:00