Commit Graph

1257 Commits

Author SHA1 Message Date
ziggie
2b856f036e multi: fix linter 2025-08-14 19:53:18 +02:00
ziggie
df9bac2ecf multi: move PaymentCreationInfo to payment pkg 2025-08-14 19:53:18 +02:00
ziggie
d138e23919 multi: move FailureReason to payment package 2025-08-14 19:53:18 +02:00
ziggie
03af9858d2 multi: move payment related code into own package
This commit moves most of the code into its own package. It is
the smallest code move possible without moving import cycles and
keeping the changes to the code base as small as possible during
refactor.
2025-08-14 19:53:15 +02:00
ziggie
77a6b577eb channeldb: move helper function to codec.go
This method is not only used by the payment logic so we need to
move it to a generalized place because in the following commits
we move payment related code into its own package.
2025-08-14 08:08:51 +02:00
ziggie
4bb21a7284 channeldb: export pagination method
We export some methods related to the pagination logic be the
kv store implemenation of the payment data will live in another
package.
2025-08-14 08:08:50 +02:00
ziggie
4e0af2f495 channeldb: rename storedPaymentSeq 2025-08-11 16:44:15 +02:00
ziggie
a4b1569647 channeldb: rename currPaymentSeq 2025-08-11 16:44:15 +02:00
ziggie
6bae3c98b3 channeldb: rename paymentSeqMx 2025-08-11 16:44:14 +02:00
ziggie
88da582526 mulit: use kvdb.Backend for the kv payment db
Instead of the ChannelState struct we now use the kv backend
interface for the payment kv database.
2025-08-11 16:44:14 +02:00
ziggie
18afd4442d multi: introduce new paymentsDB package
We introduce a new package paymentsDB and start by moving the
payment specifc errors from the channeldb package to the
paymentsDB package. We also fix linter issues which showed up
due to changing this code part.
2025-08-11 16:44:14 +02:00
ziggie
db2c50a599 channeldb: add context to query method
We add a context for the query method because the query method
is part of the paymentDB interface and for the SQL case
we will need the context for this method because the native
SQL drivers demand one. So we add it for the kv implementation
here as well so we can then make use of the new interface type.
2025-08-11 16:44:13 +02:00
ziggie
2b3b27f5a9 multi: fix linter issues 2025-08-02 13:24:27 +02:00
ziggie
0aef5fa44c multi: unify all payment related kv data
All interactions related to the payment db are now part of the
kvPaymentDB struct.
2025-08-02 13:24:27 +02:00
ziggie
aaa1ee0b74 channeldb: move kv related code
We move all kv particular code which was in the payments.go file
to the kv related file. Code which will be backend independant
will remain in the payments.go file although only the kv backend
is currently supported.
2025-08-02 13:24:25 +02:00
ziggie
84b2a94da2 multi: fix linter issues 2025-08-02 13:21:45 +02:00
ziggie
8bd4744ee8 channeldb: rename pControl to paymentDB in tests 2025-08-02 11:48:01 +02:00
ziggie
2d07d44d1a channeldb: rename PaymentControl struct
In the following commits we will gradually unify the current
payment db operations into an interface to later down the road
support both backends (sql+kv).
2025-08-02 11:24:59 +02:00
ziggie
252ebdea5b channeldb: rename payment_control files
We rename the file to payment_kv_store to highlight that this
is the kv implementation of the payment db backend.
2025-08-01 17:51:11 +02:00
ziggie
923cafb989 multi: revert back changes from 9911
always process remote ADDs even when they are empty to trigger
the gc process when loading them back into memory.
2025-07-08 10:25:26 +02:00
Elle Mouton
8cf567b948 multi: use the "errors" package everywhere
Replace all usages of the "github.com/go-errors/errors" and
"github.com/pkg/errors" packages with the standard lib's "errors"
package. This ensures that error wrapping and `errors.Is` checks will
work as expected.
2025-06-30 09:46:55 +02:00
ziggie
d220b87b60 multi: Add decayedlog db migration code
This commit adds the migration code for the decayedlog db which
is optional and will default to true.
2025-06-21 09:20:19 +02:00
ziggie
c7e773132b channeldb: update optional migration code for multiple versions 2025-06-21 09:20:18 +02:00
ziggie
c19d89149f channeldb: add migration34
Migration34 garbage collects the decayed log database. This commit
only adds the migration code and does not use it.
2025-06-21 09:20:17 +02:00
Olaoluwa Osuntokun
faa68a220e Merge pull request #9880 from yyforyongyu/accessman
Improve access control in peer connections
2025-06-20 15:26:24 -07:00
yyforyongyu
32d8e2123d channeldb+lnd: rename peerCounts to peerChanInfo for clarity 2025-06-19 16:48:13 +08:00
Elle Mouton
e724e1c3e4 multi: thread context through to AddrsForNode 2025-06-17 19:20:59 +02:00
Oliver Gugger
5d161e8cd0 Merge pull request #9653 from djkazic/reorder-buckets-check
channeldb: perform init of top level buckets first
2025-06-16 08:24:03 +02:00
djkazic
759a870072 channeldb: perform init of top level buckets first 2025-06-13 09:02:07 -04: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
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
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
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
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
Elle Mouton
5d7c6c4b60 channeldb: remove graph calls from tests
The channeldb no longer depends on the graph. So remove the use of
MakeTestGraph from tests.
2025-05-22 14:14:40 +02:00
Elle Mouton
ad38ed73c7 go.mod+lnwire: bump TLV dep and fix MilliSatoshi Record
In this commit, we update the `tlv` package version which includes type
constraints on the `tlv.SizeBigSize` method parameter. This exposes a
bug in the MilliSatoshi Record method which is fixed here.

This was not caught in tests before since currently only
our TLV encoding code makes use of this SizeFunc (so we would write 0
size to disk) but then when we read the bytes from disk and decode, we
dont use the SizeFunc and our MilliSatoshi decode method makes direct
use of the `tlv.DBigSize` function which _currently does not make use of
the `l` length variable passed to it_. So it currently does correctly
read the data.
2025-05-07 19:36:25 +02:00
bitromortac
15f0888fa8 routing: fix mission control migration
This commit is temporary and demonstrates a panic. To be squashed with
the following commit.
2025-05-02 08:42:25 +02:00
ziggie
b9620a7dc3 mulit: increase logprogress time
Switched the batchsize to 30 seconds instead of number of payments
and invoices.
2025-04-22 00:01:16 +02:00
ziggie
440ed31419 multi: add more logging when fetching invoices and payments. 2025-04-18 16:33:39 +02:00
ziggie
490347b056 multi: update walletdb package 2025-04-09 18:47:53 +02:00
xinhangzhou
b7e3c20383 refactor: use maps.Copy for cleaner map handling
Signed-off-by: xinhangzhou <shuangcui@aliyun.com>
2025-03-25 01:19:55 +08:00
Olaoluwa Osuntokun
8432e706d3 multi: extract new DeriveHeightHint() function, use for new rbf closer
With this commit, we make sure we set the right height hint, even if the
channel is a zero conf channel.
2025-03-18 11:44:20 -05:00
Eugene Siegel
15f17633aa channeldb: FetchPermAndTempPeers to load access perms on startup
We introduce a new func FetchPermAndTempPeers that returns two maps.
The first map indicates the nodes that will have "protected" access
to the server. The second map indicates the nodes that have
"temporary" access to the server. This will be used in a future
commit in the server.go code.
2025-03-11 20:42:34 -04:00
fuyangpengqi
150f72414a refactor: use a more straightforward return value
Signed-off-by: fuyangpengqi <995764973@qq.com>
2025-02-28 17:09:56 +08:00
yyforyongyu
f96eb50ca8 channeldb+routing: cache circuit and onion blob for htlc attempt
This commit caches the creation of sphinx circuit and onion blob to
avoid re-creating them again.
2025-02-10 11:28:23 +08:00
András Bánki-Horváth
327eb8d8ca Merge pull request #9438 from bhandras/invoice-bucket-tombstone
channeldb+lnd: set invoice bucket tombstone after migration
2025-02-01 10:59:51 +01:00
ziggie
118261aca4 invoices+channeldb: Fix AMP invoices behaviour.
We now cancel all HTLCs of an AMP invoice as soon as it expires.
Otherwise because we mark the invoice as cancelled we would not
allow accepted HTLCs to be resolved via the invoiceEventLoop.
2025-01-31 13:10:02 +01:00