Commit Graph

18756 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
2be2d3b489 lnwallet/chancloser: create unique ServiceKey for the RBF chan closer
This can be used to allow any system to send a message to the RBF chan
closer if it knows the proper service key. In the future, we can use
this to redo the msgmux.Router in terms of the new actor abstractions.
2025-05-16 17:50:01 -07:00
Olaoluwa Osuntokun
d046d595b9 protofsm: implement the actor.ActorBehavior interface for StateMachine
In this commit, we implement the actor.ActorBehavior interface for
StateMachine. This enables the state machine executor to be registered
as an actor, and have messages be sent to it via a unique ServiceKey
that a concrete instance will set.
2025-05-16 17:50:01 -07:00
Olaoluwa Osuntokun
e3cbe76d7b peer: register the rbfCloseActor, have RPC route fee bumps to it
In this commit, we now register the rbfCloseActor when we create the rbf
chan closer state machine. Now the RPC server no longer neesd to
traverse a series of maps and pointers (rpcServer -> server -> peer ->
activeCloseMap -> rbf chan closer) to trigger a new fee bump.

Instead, it just creates the service key that it knows that the closer
can be reached at, and sends a message to it using the returned
actorRef/router. We also hide additional details re the various methods
in play, as we only care about the type of message we expect to send and
receive.
2025-05-16 17:50:01 -07:00
Olaoluwa Osuntokun
b96d978482 peer: create new rbfCloseActor to decouple RPC RBF close bumps
In this commit, we create a new rbfCloseActor wrapper struct. This will
wrap the RPC operations to trigger a new RBF close bump within a new
actor. In the next commit, we'll now register this actor, and clean up
the call graph from the rpc server to this actor.
2025-05-16 17:50:01 -07:00
Olaoluwa Osuntokun
09d9ff4a7a build: add temp replace to point to new actor package 2025-05-16 17:50:01 -07:00
Olaoluwa Osuntokun
9319e4c8e6 actor: add README.md
In this commit, we add a readme which serves as a general introduction
to the pacakge, and also the motivation of the package. It serves as a
manual for developers that may wish to interact with the package.
actor/v0.0.1-alpha
2025-05-16 17:50:01 -07:00
Olaoluwa Osuntokun
0fbf4435de actor: add example files
In this commit, we add a series of examples that show how the package
can be used in the wild. They can be run as normal Example tests.
2025-05-16 17:24:19 -07:00
Olaoluwa Osuntokun
f5e92daa46 actor: add the actor system and router
In this commit, we add the actor system (along with the receiptionist)
and the router.

An actor can be registered with the system, which allows other callers
to locate it to send message to it via the receptionist. Custom routers
can be created for when there're actors that rely on the same service
key and also req+resp type. This can be used to implement something
similar to a worker pool.
2025-05-16 17:24:19 -07:00
Olaoluwa Osuntokun
c2b9f378e0 actor: add fundamental interfaces and concrete Actor impl
In this commit, we add the actual Actor implementation. We define a
series of types and interfaces, that in concert, describe our actor. An
actor has some ID, a reference (used to send messages to it), and also a
set of defined messages that it'll accept.

An actor can be implemented using a simple function if it's stateless.
Otherwise, a struct can implement the Receive method, and handle its
internal message passing and state that way.
2025-05-16 17:24:19 -07:00
Olaoluwa Osuntokun
72a143c4cb actor: add Future[T] and Promise[T] w/ concrete impls
In this commit, we add two new fundamental data structures: Future[T]
and Promise[T].

A future is a response that might be ready at some point in the future.
This is already a common pattern in Go, we just make a type safe wrapper
around the typical operations: block w/ a timeout, add a call back for
execution, pipeline the response to a new future.

A promise is an intent to complete a future. Typically the caller
receives the future, and the callee is able to complete the future using
a promise.
2025-05-16 17:24:19 -07:00
Olaoluwa Osuntokun
beefa4b0fa actor: add new actor package as distinct sub-module 2025-05-16 17:24:19 -07:00
Olaoluwa Osuntokun
5ea7232c31 Merge pull request #9811 from lightningnetwork/0-19-rc-5
build: bump version to v0.19.0-beta.rc5
v0.19.0-beta.rc5
2025-05-15 14:48:45 -07:00
Olaoluwa Osuntokun
71dbc189d4 Merge pull request #9801 from Roasbeef/pong-relax
peer+lnd: add new CLI option to control if we D/C on slow pongs
2025-05-15 10:25:29 -07:00
Oliver Gugger
1e8fcc5ea9 build: bump version to v0.19.0-beta.rc5 2025-05-15 16:38:26 +02:00
Olaoluwa Osuntokun
e2c56af519 docs/release-notes: add release notes entry for pong default change 2025-05-15 16:36:38 +02:00
Olaoluwa Osuntokun
c493f0c0a9 peer+lnd: add new CLI option to control if we D/C on slow pongs
In this commit, we add a new CLI option to control if we D/C on slow
pongs or not. Due to the existence of head-of-the-line blocking at
various levels of abstraction (app buffer, slow processing, TCP kernel
buffers, etc), if there's a flurry of gossip messages (eg: 1K channel
updates), then even with a reasonable processing latency, a peer may
still not read our ping in time.

To give users another option, we add a flag that allows users to disable
this behavior. The default remains.
2025-05-15 16:36:38 +02:00
Oliver Gugger
b0cba7dd08 Merge pull request #9804 from ellemouton/removeChanGraphCacheMu
graph/db: remove ChannelGraph cacheMu
2025-05-13 16:10:17 +02:00
Oliver Gugger
1db6c31e20 Merge pull request #9798 from ellemouton/graphFixNotificationSubs
graph/db: synchronous topology client subscriptions/cancellations
2025-05-12 17:10:44 +02:00
Elle Mouton
0155d5d7b0 graph/db: handle topology updates in a single location
In this commit, we ensure that any topology update is forced to go via
the `handleTopologySubscriptions` handler so that client subscriptions
and updates are handled correctly and in the correct order.

This removes a bug that could result from a client missing a
notification about a channel being closed if the client is subscribed
and shortly after, `PruneGraph` is called which would notify all
subscribed clients and possibly do so before the client subscription has
actually been persisted.
2025-05-12 14:42:22 +02:00
Oliver Gugger
8044891df4 Merge pull request #9799 from guggero/function-call-formatting
docs: document previously implicit formatting rule
2025-05-12 13:13:14 +02:00
Elle Mouton
765fc6c132 graph/db: remove ChannelGraph cacheMu
We remove the mutex that was previously held between DB calls and calls
that update the graphCache. This is done so that the underlying DB calls
can make use of any batch requests which they currently cannot since the
mutex prevents multiple requests from calling the methods at once.

The reason the cacheMu was originally added here was during a code
refactor that moved the `graphCache` out of the `KVStore` and into the
`ChannelGraph` and the aim was then to have a best effort way of
ensuring that updates to the DB and updates to the graphCache were as
consistent/atomic as possible.
2025-05-12 08:29:40 +02:00
Oliver Gugger
12dbeb99c3 docs: document previously implicit formatting rule
Adds a formatting rule to the code style documentation that is being
used widely throughout the codebase but isn't properly documented.
2025-05-12 07:00:51 +02:00
Oliver Gugger
ee25c228e9 Merge pull request #8330 from bitromortac/2401-bimodal-improvements
bimodal pathfinding probability improvements
2025-05-08 21:35:49 +02:00
bitromortac
86249fbe6c docs: update release notes 2025-05-08 18:31:31 +02:00
Oliver Gugger
43e822c3b0 Merge pull request #9789 from ellemouton/updateTLVDep
multi: use updated TLV SizeFunc signature
2025-05-08 10:20:37 +02:00
Olaoluwa Osuntokun
1a5432368e Merge pull request #9785 from Roasbeef/go-1-23-9
build: bump Go version to v1.23.9
2025-05-07 16:17:00 -07: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
Oliver Gugger
8b413e89f1 Merge pull request #9793 from ellemouton/tlvSizeBigSize
tlv: catch unhandled type in SizeBigSize
tlv/v1.3.1
2025-05-07 19:21:57 +02:00
Elle Mouton
ecb9755e19 tlv: constrain the types passed to MakeBigSizeRecord and SizeBigSize
Protect against unhandled types being passed to these methods.
2025-05-07 15:45:12 +02:00
Olaoluwa Osuntokun
1c76c6198c build: bump Go version to v1.23.9 2025-05-06 15:50:16 -07:00
Oliver Gugger
67a40c90ad Merge pull request #9782 from Roasbeef/v19-rc4
build: bump to version v0.19 rc4
v0.19.0-beta.rc4
2025-05-06 18:36:20 +02:00
Oliver Gugger
221b7634a6 Merge pull request #9783 from bitromortac/2505-loadmc-fixes
lncli: establish connection after parsing of mc data for loadmc
2025-05-06 13:52:57 +02:00
bitromortac
306df7048f docs: update release notes 2025-05-06 11:16:36 +02:00
bitromortac
d33c92bd19 lncli: option to skip prompts for loadmc
This makes the command scriptable.
2025-05-06 11:13:30 +02:00
bitromortac
725a80a3b7 lncli: remove possibility to discard mission control from loadmc
This can already be done with resetmc and was only included here because
loadmc was used in a different context.
2025-05-06 10:59:41 +02:00
bitromortac
452022ee75 lncli: establish connection after mc parsing for loadmc
It can take some time to unmarshal large mission control data sets such
that the macaroon can expire during that phase. We postpone the
connection establishment to give the user more time to answer the
prompt.
2025-05-06 10:59:38 +02:00
bitromortac
56ccf60267 lncli: correct docs for loadmc 2025-05-06 10:53:37 +02:00
Olaoluwa Osuntokun
850f1edc5f build: bump to version v0.19 rc4 2025-05-05 12:58:35 -07:00
Olaoluwa Osuntokun
7b6c1cf840 Merge pull request #9781 from bitromortac/2505-loadmc
lncli: add loadmc command
2025-05-05 12:00:32 -07:00
bitromortac
aaccc2bcaa docs: update release notes 2025-05-05 15:02:55 +02:00
bitromortac
8351018f8b lncli: add loadmc command
This command lets one import data exported by `lncli querymc > mc.json`
via `lncli loadmc --mcdatapath mc.json`.
2025-05-05 15:02:55 +02:00
bitromortac
180f61b9eb lncli: change importmc category 2025-05-05 15:02:55 +02:00
Oliver Gugger
334a7d1123 Merge pull request #9770 from bitromortac/2504-mc-migration-fix
routing+migration: fix mission control migration with nil failure msg
2025-05-02 14:22:59 +02:00
bitromortac
07f863a2a5 routing: refine amount scaling
Mission control may have outdated success/failure amounts for node pairs
that have channels with differing capacities. In that case we assume to
still find the liquidity as before and rescale the amounts to the
according range.
2025-05-02 10:30:28 +02:00
bitromortac
5afb0de8a8 routing: forget info for contradictions
If we encounter invalid mission control data, we fall back to no
knowledge about the node pair.
2025-05-02 10:30:28 +02:00
bitromortac
5ba9619d22 routing: don't compute prob for success amounts
We skip the evaluation of probabilities when the amount is lower than
the last success amount, as the probability would be evaluated to 1 in
that case.
2025-05-02 10:30:28 +02:00
bitromortac
3819941c12 routing: regularize bimodal model
If the success and fail amounts indicate that a channel doesn't obey a
bimodal distribution, we fall back to a uniform/linear success
probability model. This also helps to avoid numerical normalization
issues with the bimodal model.

This is achieved by adding a very small summand to the balance
distribution P(x) ~ exp(-x/s) + exp((x-c)/s), 1/c that helps to
regularize the probability distribution. The distribution becomes finite
for intermediate balances where the exponentials would be evaluated to
an exact zero (float) otherwise. This regularization is effective in
edge cases and leads to falling back to a uniform model should the
bimodal model fail.

This affects the normalization to be s * (-2 * exp(-c/s) + 2 + 1/s) and
the primitive function to receive an extra term x/(cs).

The previously added fuzz seed is expected to be resolved with this.
2025-05-02 10:30:12 +02:00
bitromortac
fe32105b3e routing: add test for small scale
This test demonstrates that the current bimodal model leads to numerical
inaccuracies in a certain regime of successes and failures.
2025-05-02 10:26:13 +02:00
bitromortac
615b617cda routing: add test for fuzz test special case
This test demonstrates an error found in a fuzz test by adding a
previously found seed, which will be fixed in an upcoming commit.

The following fuzz test is expected to fail:
go test -v -fuzz=Prob ./routing/
2025-05-02 10:25:19 +02:00
bitromortac
04eec71d54 routing: use default tolerance for bimodal testing 2025-05-02 10:24:22 +02:00