lnd/docs
Olaoluwa Osuntokun ac71ea7559 discovery+funding+peer+server: migrate gossip result to actor.Future[error]
In this commit, we eliminate the three buffered chan error patterns in
the discovery package and replace them with actor.Promise[error]/
actor.Future[error]. The old pattern is error-prone: if a channel is
completed more than once (e.g. when a deferred message copy is
re-enqueued and processed again), the second write to a capacity-1
channel blocks forever. actor.Promise.Complete() is idempotent via
sync.Once, so the second call is always a safe no-op regardless of
whether anyone holds a reference to the Future.

Additionally, PropagateChanPolicyUpdate previously blocked on <-errChan
after enqueuing a policy update with no quit-channel check, creating a
latent deadlock if the gossiper shut down between enqueue and send. It
now uses AwaitGossipResult with a ContextFromQuit-derived context, so
shutdown is always respected.

This is an atomic migration that updates all callers in the same
commit so each commit builds standalone. The three main pieces are:

discovery

networkMsg.err chan error becomes errPromise actor.Promise[error].
chanPolicyUpdateRequest.errChan chan error becomes errPromise.
syncTransitionReq.errChan chan error becomes errPromise. All ~65 sites
that previously wrote to the error channel now call
completeGossipResult(nMsg.errPromise, err) instead.

ProcessRemoteAnnouncement and ProcessLocalAnnouncement now return
actor.Future[error] instead of chan error. The capacity-2 buffer
comment on ProcessRemoteAnnouncement, which was itself a workaround
for the old pattern, is removed along with the TODO referencing the
actor model redesign. ProcessSyncTransition in syncer.go follows the
same pattern: the errChan select is replaced with AwaitGossipResult
using a ContextFromQuit-derived context.

funding

The SendAnnouncement function type in funding.Config changes from
returning chan error to returning actor.Future[error]. The call sites
in addToGraph and announceChannel are updated to await the future with
AwaitGossipResult, passing a context derived from f.quit via
ContextFromQuit. Shutdown signals (context.Canceled and
discovery.ErrGossiperShuttingDown) are both mapped to
ErrFundingManagerShuttingDown via the new mapGossipError helper, which
also factors out the duplicated graph-rejected / unknown-error
handling. The three mock SendAnnouncement implementations in
manager_test.go are updated accordingly.

peer+server

In peer/brontide.go, the ProcessRemoteAnnouncement call in the gossip
stream handler intentionally discards the result since remote gossip
messages are fire-and-forget from the peer's perspective. The old
comment explaining why the chan error was unsafe to use is replaced
with a note that an unawaited Future[error] carries no overhead.

In server.go (applyChannelUpdate), the previous select on errChan and
the quit channel is replaced with ContextFromQuit + AwaitGossipResult.
2026-04-10 19:16:49 -07:00
..
alloy-models docs/alloy-model: add linear fee function model 2024-08-01 17:42:31 -07:00
grpc Update ruby.md 2024-12-06 13:48:22 +01:00
release-notes discovery+funding+peer+server: migrate gossip result to actor.Future[error] 2026-04-10 19:16:49 -07:00
rest multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
backport-workflow.md ci: fix some minor issues in the backport ci job 2025-12-14 09:00:02 +01:00
benchmark_perf_loop.md docs: add docs explaining usage of pprof+benchmarks to optimize 2025-09-24 11:52:01 -07:00
code_contribution_guidelines.md docs: add comprehensive backport workflow documentation 2025-12-12 22:48:51 +01:00
configuring_tor.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
db_migration_guide.md docs: update sql migration guide 2025-12-04 09:34:58 +00:00
debugging_lnd.md chore: fix some typos 2025-01-03 21:48:29 +08:00
development_guidelines.md docs: explain what "visual symmetry" means 2025-08-04 16:34:18 +02:00
DOCKER.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
estimate_route_fee.md docs: update api documentation for estimateRouteFee 2025-12-01 18:07:56 +01:00
forwarding_history_privacy.md docs: add forwarding history privacy guide 2026-03-30 17:39:46 +02:00
fuzz.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
gossip_rate_limiting.md docs: update gossip rate limiting doc 2025-08-04 15:55:11 +08:00
INSTALL.md Merge pull request #10557 from Liongrass/master 2026-02-24 21:17:22 +08:00
key_import.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
leader_election.md docs: fix leader node readiness probe example [skip ci] 2024-07-29 21:31:24 +02:00
macaroons.md docs: document deterministic macaroons, add release notes 2024-10-15 09:48:47 +02:00
MAKEFILE.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
musig2.md Update link in musig2.md 2024-10-02 10:17:16 -07:00
postgres.md lncfg+scripts: use configurable global lock for postgres backends 2025-11-28 09:22:19 +01:00
psbt.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
recovery.md [docs] Typo recovery.md 2025-10-22 13:30:58 +02:00
release.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
release_branch_management.md docs: create new document describing proposed release/branch management 2025-11-11 12:42:27 -08:00
remote-signing.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
review.md docs: add development_guidelines.md 2025-04-14 17:08:56 +08:00
safety.md Merge pull request #8881 from mwaite-codes/fix-doc-grammar 2024-07-23 00:25:17 -06:00
signing_release_candidate.md docs: fix build instructions doc url 2025-10-21 17:32:24 -07:00
SphinxReplayDB.md docs: add sphinx replay description 2025-06-13 15:37:03 +02:00
sqlite.md docs: add sqlite instructions 2023-01-25 14:16:56 +02:00
wallet.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
watchtower.md multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
zero_conf_channels.md docs: add documentation for zero-conf channels 2022-08-10 14:25:11 -04:00