Commit Graph

19035 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
c33fbfb3e7 Merge pull request #9928 from ellemouton/removeModReplaces
go.mod: remove tlv and sqldb replace directives
2025-06-11 12:01:08 -07:00
Olaoluwa Osuntokun
07f65b5118 Merge pull request #9923 from ellemouton/graphCache
graph/db: only fetch required info for graph cache population
2025-06-11 10:57:45 -07:00
Elle Mouton
9e9524766c go.mod: remove tlv and sqldb replace directives
Bump tlv to v1.3.2 and sqldb to v1.0.10
2025-06-11 06:18:24 +02:00
Shivam Chawla
bfe1edf4ec lnrpc: add filters to forwardhistoryrequest
This commit adds incoming and outgoing channel ids filter to forwarding history request to filter events received/forwarded from/to a particular channel
2025-06-11 09:10:13 +05:30
Olaoluwa Osuntokun
eb863e46af lnwallet/chancloser: fix fllake in TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script
In this commit, we fix a flake in the
`TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script`
test.

This flake can happen if the test shuts down _before_ the state machine
is actually able to process the sent event. In this case, the
expectations are triggered, and we find that the error isn't sent.

To resolve this, we create a new wrapper function that'll use a sync
channel send to assert that the error has been sent before we exit the
test.
2025-06-10 18:44:34 -07:00
Olaoluwa Osuntokun
92a5d35cff Merge pull request #9911 from ziggie1984/exit-early-for-fwd-adds
htlcswitch: exit early if no adds are in the fwd pkg
sqldb/v1.0.10 tlv/v1.3.2
2025-06-10 15:14:09 -07:00
Elle Mouton
6fb90c88ca docs: update release notes 2025-06-10 20:10:36 +02:00
Elle Mouton
c52c6c962b graph/db: introduce ForEachChannelCacheable
Implement ForEachChannelCacheable which is like ForEachChannel but its
call-back takes the cached versions of channel info & policies. This is
then used during graph cache population. This will be useful once the
SQL implementation is added so that we can reduce the number of DB trips
on cache population.
2025-06-10 20:10:36 +02:00
Elle Mouton
3069a67b62 graph/db: let GraghCache.AddChannel take CachedEdgeInfo
Define a new CachedEdgeInfo type and let the graph cache's AddChannel
use this. This will let us later on (for the SQL impl of the graph db)
only load from the DB what we actually need for the graph cache.
2025-06-10 20:10:35 +02:00
Elle Mouton
3ea86bfbf4 graph/db: let GraphCache.AddChannel take cached edge polies
So that the call-sites of this method dont necessarily need to fetch all
the data required to populate the full ChannelEdgePolicy.
2025-06-10 20:10:35 +02:00
Elle Mouton
f95588caca graph/db: add CachedEdgePolicy helpers 2025-06-10 20:10:35 +02:00
Elle Mouton
42c6e951ed graph/db: let GraphCache.UpdatePolicy take a cached policy
Update the GraphCache.UpdatePolicy method to take a
`models.CachedEdgePolicy` instead of a `models.ChannelEdgePolicy`.
Doing this will allow us later on to only fetch the necessary info for
populating the CachedEdgePolicy when we are populating the cache via
UpdatePolicy.
2025-06-10 20:10:35 +02:00
Elle Mouton
0816645328 graph/db: simplify GraphCache.UpdatePolicy signature
Remove the redundant "edge2" param and rather use the "policy" param to
derive the boolean.
2025-06-10 20:10:35 +02:00
Elle Mouton
2e716bf301 graph/db: remove unused GraphCache method
Remove the unused UpdateChannel method.
2025-06-10 20:10:34 +02:00
Olaoluwa Osuntokun
32592dbd20 Merge pull request #9897 from ellemouton/inboundFeeTLV
multi: explicitly define InboundFees in ChannelUpdate and ChannelEdgePolicy
2025-06-10 11:05:48 -07:00
ziggie
6feed32288 htlcswitch: exit early if no adds are in the fwd pkg
This lead to the case that we would always record a HTLC
two times in the decayed log protection which is not necessary
in the first place.
2025-06-09 09:17:25 +02:00
Elle Mouton
6141bcd851 docs: update release notes 2025-06-09 08:44:50 +02:00
Elle Mouton
6d8bc63ad6 discovery+graph: get inbound fee directly from ChannelUpdate
Remove the previously added TODOs which would extract InboundFee info
from the ExtraOpaqueData of a ChannelUpdate at the time of
ChannelEdgePolicy construction. These can now be replaced by using the
newly added InboundFee record on the ChannelUpdate message.
2025-06-09 08:44:47 +02:00
Elle Mouton
420001a98c lnwire: add InboundFee TLV record to ChannelUpdate 2025-06-09 08:32:52 +02:00
Elle Mouton
7add5bfd4a tlv+go.mod: generate inbound fee TLV type
Also add a temporariy replace to the tlv package which can be removed as
soon as the PR that includes this commit is merged and a new tag for the
tlv package has been created.
2025-06-09 08:32:50 +02:00
Elle Mouton
bf72d9ec19 graph+rpcserver: add InboundFee to ChannelEdgeUpdate
And then use that new field instead of parsing from extra opaque data.
2025-06-09 08:32:15 +02:00
Elle Mouton
cb16c7177a graph/db: use InboundFee directly from ChannelEdgePolicy
Now that we know that the InboundFee on the ChannelEdgePolicy is always
set appropriately, we can update the GraphCache UpdatePolicy method to
take the InboundFee directly from the ChannelEdgePolicy object.
2025-06-09 08:31:19 +02:00
Elle Mouton
9890d74622 multi: set the InboundFee on ChannelEdgePolicy
In this commit, we make sure to set the new field wherever appropriate.
This will be any place where the ChannelEdgePolicy is constructed other
than its disk deserialisation.
2025-06-09 08:31:10 +02:00
Elle Mouton
1d162216e6 peer: stop extracting InboundFees
Like the previous commit, here we can start directly using the
InboundFee on the models.ChannelEdgePolicy object since we know we read
it from disk and so the InboundFee field will be populated accordingly.

NOTE: unlike the previous commit, behaviour is slightly different here
since previously we would error out here if TLV parsing failed whereas
now, the DB call will just skip the error and return a nil policy. This
should be ok since this is explicitly only dealing with our own updates
and so our TLV should always be valid.
2025-06-09 08:29:16 +02:00
Elle Mouton
e170ad44d9 graph/db+rpcserver: remove inbound fee extraction
For any call-site where we extract inbound fees from a
models.ChannelEdgePolicy object that was deserialised from disk, we can
now just use the new InboundFee field on the object since we know that
it would have been populated at deserialisation time.

Note that for all these call-sites, if a failure previously happened on
decoding of the TLV stream, the error would be ignored and the edge
would just be skipped. This behaviour is now still the same given how
ErrParsingExtraTLVBytes is handled on the DB layer.
2025-06-09 08:28:50 +02:00
Elle Mouton
8314bacdda graph/db: extract InboundFee at deserialisation time
Here we add an explicit InboundFee field to the ChannelEdgePolicy
struct. Then, in the graph KVStore, at deserialisation time, we extract
the InboundFee from the ExtraOpaqueData. Currently we do this at higher
levels but we are going to move it to the DB layer so that when we add
the SQL implementation of the graph store, we can have explicit columns
for inbound fees. We need to account for the fact that we may have
invalid TLV already persisted though and we dont want to fail if we
deserialise those necessarily. So we return ErrParsingExtraTLVBytes now
if we fail to parse the extra bytes as TLV and then we let the callers
handle it similarly to how ErrParsingExtraTLVBytes is handled in that we
dont necessarily fail if we receive one of these errors.

As of this commit, we can now expect the InboundFee field of a
ChannelEdgePolicy to be set (if inbound fees are set on the policy) for
any update that we read from disk.
2025-06-09 08:26:33 +02:00
Elle Mouton
239acb4063 graph/db: validate edge policy TLV data before persisting
In this commit, we start validating the extra opaque data of a channel
edge policy before persisting it. We just check that the data is valid
TLV.

NOTE: we recently [started
validating](1410a0949d)
this at the lnwire level. So really, no new update will reach the DB
layer without this already being checked. But we check it again here so
that the DB API behaves correctly as its own unit.
2025-06-09 08:26:11 +02:00
Olaoluwa Osuntokun
c6d6d4c0b6 Merge pull request #9913 from yyforyongyu/debug-switch
htlcswitch+lntest: add more debug logs
2025-06-06 12:34:40 -07:00
Oliver Gugger
a0f658b44d Merge pull request #9889 from yyforyongyu/fix-htlcindex
Use `BigSizeT` for `HtlcIndex` in retribution log
2025-06-06 15:50:50 +02:00
Oliver Gugger
e1c9825b8a Merge pull request #9813 from Abdulkbk/htlcidx-to-fwdingevent
lnrpc: add HtlcIndex to ForwardingEvents
2025-06-06 14:32:29 +02:00
yyforyongyu
870e16bdd7 channeldb+lnwallet: fix typo 2025-06-06 19:55:59 +08:00
yyforyongyu
2cd97fcd6d docs: add release note entry 2025-06-06 19:55:59 +08:00
yyforyongyu
4efd99774e channeldb: add customized encoding for HtlcIndex 2025-06-06 19:55:59 +08:00
yyforyongyu
f5ffe82280 lnwallet+channeldb: use BigSizeT to save space 2025-06-06 19:55:58 +08:00
yyforyongyu
26960e36ce htlcswitch+lntest: add more debug logs 2025-06-06 19:40:35 +08:00
Abdullahi Yunus
ccf3a282d0 docs: add release note 2025-06-06 12:21:46 +01:00
Abdullahi Yunus
a0634e4ade lnd+lnrpc: update fwdinghistory message
In this commit we update the returned message for fwdinghistory
to include the htlcindex for all forwarded htlcs.
2025-06-06 12:21:46 +01:00
Abdullahi Yunus
f79e6137c1 htlcswitch+channeldb: add htlcidx to fwding log
In this commit we add htlcindex field to the forwardingevent
struct, which is persisted alongside the other event fields.
2025-06-06 12:21:39 +01:00
Oliver Gugger
4a7cd0095e Merge pull request #9902 from ellemouton/simplifyForwardingLogQuery
channeldb: remove unnecessary for loop from Query method
2025-06-06 09:43:57 +02:00
Elle Mouton
7571acbe81 channeldb: remove unnecessary for loop from Query method
This commit simplifies the code of the ForwardingLog.Query method by
removing a confusing for-loop. The for-loop makes it seem as though
multiple events could be encoded under a single timestamp. But from the
time that this forwarding log was introduced, it was never possible to
encode multiple events under the same timestamp and so this loop will
never execute successfully more than once per timestamp and can thus be
removed. This paves the way such that future expansions of the method
can be added easily.

See the initial commit that introduced this code [here](f2cd668bcf).
In this commit you can see that from the start it was never possible to
have more than one event in a single timestamp since any previous event
in that timestamp would be overwritten. Then see [this commit](97c73706b5)
where even more protection was added to ensure that each event had a
unique timestamp.
2025-06-05 11:07:46 +02:00
Oliver Gugger
fc906f2a65 Merge pull request #9127 from MPins/issue-8993
Add the option on path creator to specify the incoming channel on blinded path
2025-06-05 08:47:05 +02:00
Oliver Gugger
aec16eee97 Merge pull request #9876 from yyforyongyu/fix-accessman
accessman: remove restrictions on protected/temporary peers
2025-06-04 09:53:13 +02:00
Olaoluwa Osuntokun
89881414e6 Merge pull request #9726 from Roasbeef/protofsm-full-block-conf
protofsm: add option to allow conf resp to return full block
2025-06-03 16:41:22 -07:00
Olaoluwa Osuntokun
3f03752b25 protofsm: add test for new full block conf behavior 2025-06-03 16:39:48 -07:00
Olaoluwa Osuntokun
4908d76653 protofsm: add option to allow conf resp to return full back
In this commit, we add an option to allow a conf req caller to receive
the full block. This is useful if the caller wants to be able to create
an SPV proof.
2025-06-03 16:39:48 -07:00
Olaoluwa Osuntokun
a8930773a4 Merge pull request #9725 from Roasbeef/protofsm-conf-mapper
protofsm: add ConfMapper to allow conf attribute projection for new events
2025-06-03 16:28:01 -07:00
Olaoluwa Osuntokun
946ae4c804 protofsm: add generic type assertion to state machine tests
This commit introduces a new generic type assertion function
`assertState` to the state machine tests. This function asserts that the
state machine is currently in the expected state type and returns the
state cast to that type. This allows us to directly access the fields of
the state without having to perform a type assertion manually.
2025-06-03 16:27:30 -07:00
Olaoluwa Osuntokun
c580666e28 protofsm: add unit tests for SpendMapper 2025-06-03 16:27:30 -07:00
Olaoluwa Osuntokun
cb46f3daa0 protofsm: add new ConfMapper similar to SpendMapper for conf events
In this commit, we add a new ConfMapper which is useful for state
machines that want to project some of the conf attributes into a new
event to be sent post conf.
2025-06-03 16:27:28 -07:00
Oliver Gugger
239aab8b9e Merge pull request #9875 from ziggie1984/fix-peer-connection-2
discovery: make sure we do not block the read queue
2025-06-03 22:37:17 +02:00