Skip to content

multi: remove deprecated RPCs and config flags scheduled for 0.21#10795

Draft
erickcestari wants to merge 11 commits into
lightningnetwork:masterfrom
erickcestari:remove-deprecated-rpcs-20
Draft

multi: remove deprecated RPCs and config flags scheduled for 0.21#10795
erickcestari wants to merge 11 commits into
lightningnetwork:masterfrom
erickcestari:remove-deprecated-rpcs-20

Conversation

@erickcestari
Copy link
Copy Markdown
Collaborator

This PR removes the deprecated RPCs, fields, and configuration options that
were announced for removal in 0.21 via the
0.20 release notes.

Changes

Removed deprecated RPCs

The following RPCs are removed. Callers must migrate to the V2 equivalents
listed in the 0.20 release notes:

Removed RPC Replacement
lnrpc.SendPayment (streaming) routerrpc.SendPaymentV2
lnrpc.SendPaymentSync routerrpc.SendPaymentV2
lnrpc.SendToRoute (streaming) routerrpc.SendToRouteV2
lnrpc.SendToRouteSync routerrpc.SendToRouteV2
routerrpc.SendPayment (streaming) routerrpc.SendPaymentV2
routerrpc.SendToRoute routerrpc.SendToRouteV2
routerrpc.TrackPayment (streaming) routerrpc.TrackPaymentV2

This includes removing the corresponding REST gateway routes:

  • POST /v1/channels/transaction-stream
  • POST /v1/channels/transactions
  • POST /v1/channels/transactions/route

Removed deprecated OutgoingChanId field

The single-channel outgoing_chan_id field on QueryRoutesRequest and
SendPaymentRequest is no longer honored. Callers must use the multi-channel
outgoing_chan_ids field introduced in 0.20.

The compatibility fallback that accepted either field (and errored when both
were set) is removed from the routerrpc backend.

Removed deprecated tor v2 support

The --tor.v2 configuration flag is removed. Tor v2 onion services have been
obsolete since October 2021 when the Tor network dropped support for them.

The hidden service setup paths in config.go, lnd.go, and server.go are
simplified to assume v3 whenever a hidden service is configured.

Internal cleanups

  • Removed the dead payment infrastructure in rpcserver.go that was
    exclusively used by the deleted lnrpc handlers: paymentStream,
    rpcPaymentRequest, rpcPaymentIntent, extractPaymentIntent,
    dispatchPaymentIntent, sendPayment, and sendPaymentSync (~640 lines).
  • Removed the legacyTrackPaymentServer wrapper, PaymentState enum, and
    PaymentStatus message that were only used by the deleted
    routerrpc.TrackPayment stream.
  • Removed the SendToRoute and SendToRouteSync helpers from the integration
    test harness.

Test changes

  • itest/lnd_routing_test.go: collapsed three SendToRoute test cases (sync,
    stream, v2) into a single test exercising SendToRouteV2. Updated the error
    propagation test to assert on HTLCAttempt.Failure.Code instead of the
    legacy PaymentError string.
  • itest/lnd_channel_policy_test.go: migrated from streaming SendToRoute to
    SendToRouteV2 with structured failure assertions.
  • lnrpc/routerrpc/router_backend_test.go: removed the singleChanID and
    bothChanIds test variants that exercised the deprecated single-field path
    and its conflict detection.

Commits

The PR is split into six logical commits:

  1. proto: remove deprecated SendPayment, SendToRoute, TrackPayment RPCs - all
    proto, yaml, and regenerated stub files
  2. lnrpc: remove deprecated Send* RPC server implementations - server-side
    handlers and dead payment infrastructure in rpcserver.go
  3. routerrpc: remove deprecated SendPayment, SendToRoute, TrackPayment impls -
    server-side shims and macaroon entries
  4. routerrpc: remove deprecated outgoing_chan_id field handling - backend
    compatibility fallback removal
  5. lncfg: remove deprecated tor v2 support - tor v2 config flag removal
  6. itest: migrate deprecated lnrpc Send* calls to routerrpc V2 - test harness
    and integration test updates

Breaking changes

This is a breaking change for any client that still uses the deprecated RPCs,
fields, or config flag listed above. All have had V2 / replacement equivalents
available for multiple releases.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request completes the deprecation cycle for several RPCs, configuration flags, and fields that were announced for removal in the 0.20 release. By removing these legacy components, the codebase is simplified and technical debt is reduced, while ensuring that users migrate to the more robust V2 alternatives.

Highlights

  • Removal of Deprecated RPCs: Removed several deprecated RPCs, including lnrpc.SendPayment, lnrpc.SendToRoute, and routerrpc.TrackPayment, along with their REST gateway equivalents. Callers are directed to use the V2 equivalents.
  • Removal of Deprecated Fields: Removed the outgoing_chan_id field from QueryRoutesRequest and SendPaymentRequest, requiring callers to use the multi-channel outgoing_chan_ids field.
  • Tor v2 Support Removal: Removed the --tor.v2 configuration flag and associated infrastructure, as Tor v2 onion services are obsolete.
  • Internal Cleanup and Testing: Cleaned up dead payment infrastructure in rpcserver.go and migrated integration tests to use the V2 RPC equivalents.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the severity-critical Requires expert review - security/consensus critical label May 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🔴 PR Severity: CRITICAL

Highest-severity file wins | 15 non-test/non-generated files | ~1,473 lines changed (excl. tests & generated)

🔴 Critical (2 files)
  • rpcserver.go - Core RPC server coordination (explicitly listed as critical)
  • server.go - Core server coordination (explicitly listed as critical)
🟠 High (3 files, plus 7 auto-generated excluded from count)
  • lnrpc/routerrpc/router_backend.go - RPC/API router backend logic
  • lnrpc/routerrpc/router_server.go - Router RPC server implementation
  • lnrpc/routerrpc/router_server_deprecated.go - Deprecated router RPC endpoints removed
  • (auto-generated, excluded: lnrpc/lightning.pb.go, lightning.pb.gw.go, lightning.pb.json.go, lightning_grpc.pb.go, routerrpc/router.pb.go, router.pb.json.go, router_grpc.pb.go)
🟡 Medium (9 files)
  • config.go - Root configuration file
  • lnd.go - Root entrypoint
  • lncfg/tor.go - lncfg package (Tor config)
  • lnrpc/lightning.proto - Lightning RPC proto definition
  • lnrpc/lightning.swagger.json - Swagger API spec
  • lnrpc/lightning.yaml - API YAML spec
  • lnrpc/routerrpc/router.proto - Router RPC proto definition
  • lnrpc/routerrpc/router.swagger.json - Router swagger spec
  • lnrpc/routerrpc/router.yaml - Router YAML spec
🟢 Low (7 files — excluded from severity calculation)
  • docs/release-notes/release-notes-0.21.0.md - Release notes
  • itest/lnd_channel_policy_test.go - Integration test
  • itest/lnd_routing_test.go - Integration test
  • lntest/harness_assertion.go - Test harness
  • lntest/rpc/lnd.go - Test RPC helper
  • config_test.go - Unit test
  • lnrpc/routerrpc/router_backend_test.go - Unit test

Analysis

This PR touches rpcserver.go (788 lines removed) and server.go, both of which are explicitly classified as CRITICAL core server coordination files. The changes appear to be a significant cleanup/removal of deprecated RPC endpoints — particularly in rpcserver.go (~788 lines removed) and lnrpc/routerrpc/router_server_deprecated.go (~114 lines removed), along with corresponding proto/swagger changes.

Even though most changes are deletions (3,055 deletions vs. 423 additions, net reduction of ~2,632 lines), removing RPC handlers from the core server warrants careful expert review to ensure no active functionality is inadvertently dropped and that all call sites have been migrated.

The >500 non-test/non-generated lines changed threshold for a severity bump is met (~1,473 lines), but the PR is already at the maximum CRITICAL level.


To override, add a severity-override-{critical,high,medium,low} label.
<!-- pr-severity-bot -->

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes deprecated Tor v2 support and several legacy payment and tracking RPCs, including SendPayment, SendPaymentSync, SendToRoute, and TrackPayment, along with associated configuration flags and test cases. The changes simplify the codebase by removing obsolete logic and updating integration tests to use V2 RPC equivalents. Review feedback suggests moving the QueryProbability function to router_server.go and deleting the now-redundant router_server_deprecated.go file, while also improving the function's documentation to comply with the LND style guide for exported functions.

Comment thread lnrpc/routerrpc/router_server_deprecated.go
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch 2 times, most recently from b6c6036 to 74f5520 Compare May 7, 2026 19:54
@github-actions github-actions Bot added severity-critical Requires expert review - security/consensus critical and removed severity-critical Requires expert review - security/consensus critical labels May 7, 2026
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from 74f5520 to a99d010 Compare May 8, 2026 13:03
@saubyk saubyk added this to v0.21 May 12, 2026
@saubyk saubyk moved this to In progress in v0.21 May 12, 2026
@saubyk saubyk requested review from yyforyongyu and ziggie1984 May 12, 2026 16:35
@erickcestari
Copy link
Copy Markdown
Collaborator Author

@claude Check that all deprecated features have been removed correctly.

@claude
Copy link
Copy Markdown

claude Bot commented May 13, 2026

Claude Code is working…

I'll analyze this and get back to you.

View job run

@ziggie1984
Copy link
Copy Markdown
Collaborator

This bot does not work on forked repos.

Copy link
Copy Markdown
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, left a few comments found by gpt

Comment thread lnrpc/routerrpc/router_backend.go
Comment thread lnrpc/routerrpc/router_backend.go
Comment thread docs/release-notes/release-notes-0.21.0.md
Comment thread docs/release-notes/release-notes-0.21.0.md Outdated
Comment thread itest/lnd_channel_policy_test.go
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from a99d010 to 95d7c04 Compare May 14, 2026 13:31
@erickcestari erickcestari requested a review from yyforyongyu May 14, 2026 13:35
@erickcestari
Copy link
Copy Markdown
Collaborator Author

Thanks for the review @yyforyongyu.

Here is a summary of the changes since the last review:

  • proto removal (4728515): dropped the now-orphan SendRequest/SendResponse/SendToRouteRequest messages from lightning.proto, regenerated pb.go. Removed /v1/channels/transaction-stream from LndClientStreamingURIs, updated docs/rest/websockets.md example, and removed stale SendPayment*/SendToRoute* doc bullets from lnrpc/README.md.
  • outgoing_chan_id (1d37383): non-zero deprecated outgoing_chan_id on QueryRoutesRequest/SendPaymentRequest is now explicitly rejected with an error instead of silently dropped.
  • tor v2 (72b4388): removed --tor.v2 from docs/configuring_tor.md and sample-lnd.conf; cleaned up tor/cmd_onion.go (dropped V2 OnionType, V2KeyParam, V2 branches in prepareKeyparam/AddOnion, updated RSA1024 → ED25519-V3 protocol example); updated tor/cmd_onion_test.go expectations.
  • itest (d0225e7): re-added the HtlcMinimumMsat == customMinHtlc assertion on the SendToRouteV2 failure path in lnd_channel_policy_test.go.
  • release notes (95d7c04): reworded the outgoing_chan_id bullet to reflect that the proto field is kept but non-zero values are rejected.

@ziggie1984
Copy link
Copy Markdown
Collaborator

ziggie1984 commented May 14, 2026

I double-checked the remaining matches after the latest update. Two leftovers still look worth addressing/clarifying:

  1. routerrpc.SendToRouteResponse still exists even though the deprecated routerrpc.SendToRoute RPC has been removed.

    • lnrpc/routerrpc/router.proto: message SendToRouteResponse
    • generated references remain in lnrpc/routerrpc/router.pb.go
    • I did not find a remaining RPC method that returns this message; SendToRouteV2 returns lnrpc.HTLCAttempt.
  2. Tor v2 onion-service creation/config is removed, but Tor v2 address parsing/storage compatibility remains.

    • tor/onionaddr.go: V2DecodedLen, V2Len
    • tor/tor.go: v2 onion parsing paths
    • additional compatibility paths remain in lnwire and graph DB address handling, for example graph/db/sql_store.go still stores/decodes addressTypeTorV2.

@ziggie1984
Copy link
Copy Markdown
Collaborator

ziggie1984 commented May 14, 2026

Open question: how do we want to handle the deprecated outgoing_chan_id proto fields?

This PR currently keeps the deprecated fields in the public proto surface and rejects non-zero values at runtime:

  • lnrpc.QueryRoutesRequest.outgoing_chan_id = 14
  • routerrpc.SendPaymentRequest.outgoing_chan_id = 8

I confirmed both are still present directly in the proto files:

  • lnrpc/lightning.proto: uint64 outgoing_chan_id = 14 [jstype = JS_STRING, deprecated = true];
  • lnrpc/routerrpc/router.proto: uint64 outgoing_chan_id = 8 [jstype = JS_STRING, deprecated = true];

Keeping them has the advantage that old clients get an explicit error instead of having the field silently ignored. But it also means the fields remain in generated clients, swagger, and API docs, so they are not fully removed from the proto surface.

Should we instead remove these fields from the messages and reserve their tag numbers?

For example:

message QueryRoutesRequest {
    reserved 14;
    ...
}

and:

message SendPaymentRequest {
    reserved 8;
    ...
}

There is precedent for reserved tags in the current codebase:

  • lnrpc/lightning.proto: reserved 11 in GetInfoResponse
  • lnrpc/lightning.proto: reserved 2 with the comment “Previously used for confirmation_height. Do not reuse.”
  • lnrpc/lightning.proto: reserved 3 in QueryRoutesRequest
  • lnrpc/routerrpc/router.proto: reserved 1 in QueryMissionControlResponse
  • lnrpc/routerrpc/router.proto: reserved 3, 4, 5, 6 in PairHistory
  • lnrpc/routerrpc/router.proto: reserved 3 in PairData
  • lnrpc/invoicesrpc/invoices.proto: reserved 1 in SubscribeSingleInvoiceRequest

The tradeoff is that deleting the fields means old binary gRPC clients that still send those tags may have them decoded as unknown fields, so the server may no longer be able to return a targeted “use outgoing_chan_ids” error. Keeping the fields allows that explicit rejection, but leaves deprecated fields in the API surface.

Which behavior do we want for the 0.21 removal?

I am for removing it completely.

@erickcestari
Copy link
Copy Markdown
Collaborator Author

Thanks for the review @ziggie1984 !

The summary of the changes after addressing your comments:

  • ec24f0a proto: removed orphan routerrpc.SendToRouteResponse; removed deprecated outgoing_chan_id field from lnrpc.QueryRoutesRequest (tag 14) and routerrpc.SendPaymentRequest (tag 8), reserving both tags; dropped the runtime fallback in router_backend.go; regenerated pb.go/swagger.
  • ffcc993 tor v2: dropped V2 onion encoder paths in lnwire.WriteOnionAddr, graph/db.encodeOnionAddr, graph/db.collectAddressRecords, and tor.OnionHostToFakeIP. Decoders kept for backwards-compat with existing DBs and peer gossip. Tests updated to V3 fixtures.
  • b512b99 docs: updated 0.21 release notes to reflect the proto field removal (vs runtime rejection), the SendToRouteResponse drop, and the asymmetric V2 encoder removal.

@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from b512b99 to 830c817 Compare May 14, 2026 17:39
@erickcestari
Copy link
Copy Markdown
Collaborator Author

It looks like my last push caused the CI to break. I'm working on the fix.

@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from 830c817 to 8ba2e0d Compare May 14, 2026 17:42
@saubyk saubyk added the backport-v0.21.x-branch This label triggers a backport to branch `v0.21.x-branch ` label May 14, 2026
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from 8ba2e0d to 6706f45 Compare May 14, 2026 17:50
@ziggie1984
Copy link
Copy Markdown
Collaborator

One more Tor-related edge case worth clarifying/fixing: restored onion keys are not validated as v3.

The new-key path now correctly creates v3 services because prepareKeyparam defaults to NEW:ED25519-V3. But if an OnionStore returns an existing private key, prepareKeyparam currently uses it directly:

case nil:
    keyParam = string(privateKey)

That means a restored key such as RSA1024:... can still be passed to Tor via ADD_ONION, even though --tor.v2, tor.V2, and V2KeyParam were removed.

This is about our own hidden service / watchtower hidden service restoration path, not about parsing other peers’ historical v2 onion addresses. The call path is roughly:

  • server.createNewHiddenService / watchtower.createNewHiddenService
  • tor.NewOnionFile(...) as the store
  • TorController.AddOnion
  • prepareKeyparam
  • stored key replaces NEW:ED25519-V3 if PrivateKey() succeeds

The default plaintext old-v2-key case is partially blocked now because OnionFile.PrivateKey() no longer treats RSA1024 as a valid plaintext key prefix. But encrypted old v2 keys, custom stores, or future store implementations can still return RSA1024:... after retrieval/decryption and bypass that check.

Proposal: fail strictly when a restored onion private key is not v3. For example, after loading/decrypting a stored key, reject anything that does not start with ED25519-V3 and return a clear error telling the user to remove the old onion key file if they want a new v3 service generated.

I think strict failure is safer than silently regenerating because regenerating would change our advertised onion identity automatically. For watchtower in particular, address stability can matter, so changing it should be an explicit user action rather than a hidden migration side effect.

A small unit test with a fake OnionStore returning RSA1024:... would lock this in.

Remove the compatibility fallback in QueryRoutes and ExtractPaymentIntent
that accepted the deprecated single outgoing_chan_id field alongside the
replacement outgoing_chan_ids. Callers must now use outgoing_chan_ids.

Update TestQueryRoutes and TestExtractPaymentIntent accordingly.
Remove the --tor.v2 config flag and all associated handling. Tor v2
onion services have been obsolete since October 2021 when the Tor
network dropped support for them.

Update config.go, lnd.go, and server.go to assume v3 when a tor hidden
service is configured.
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from d38f1d4 to b331ce7 Compare May 15, 2026 12:49
Remove SendToRoute and SendToRouteSync helpers from the test harness and
update integration tests to use routerrpc.SendToRouteV2:

- lnd_routing_test.go: collapse three SendToRoute test cases (sync,
  stream, v2) into a single test using SendToRouteV2; update
  testSendToRouteErrorPropagation to assert on Failure.Code instead of
  PaymentError string
- lnd_channel_policy_test.go: replace streaming SendToRoute with
  SendToRouteV2 and assert on HTLCAttempt.Failure instead of
  PaymentError string
Remove handler implementations and macaroon permission entries for the
now-deleted lnrpc RPCs: SendPayment, SendPaymentSync, SendToRoute, and
SendToRouteSync.

Also remove the dead payment infrastructure that was exclusively used by
these handlers: paymentStream, rpcPaymentRequest, rpcPaymentIntent,
extractPaymentIntent, dispatchPaymentIntent, sendPayment, and
sendPaymentSync.
…mpls

Remove the SendPayment, SendToRoute, and TrackPayment shim methods from
router_server_deprecated.go that delegated to their V2 counterparts.
Remove their macaroon permission entries from router_server.go and the
now-unused legacyTrackPaymentServer wrapper.
Remove the following deprecated RPC definitions that were announced for
removal in 0.21 via the 0.20 release notes:

lnrpc:
  - SendPayment (bidirectional streaming)
  - SendPaymentSync
  - SendToRoute (bidirectional streaming)
  - SendToRouteSync

routerrpc:
  - SendPayment (streaming)
  - SendToRoute
  - TrackPayment (streaming)

Also remove the now-unused PaymentState enum and PaymentStatus message
that were only used by the deprecated TrackPayment response stream, plus
the corresponding REST annotations from the yaml files. Regenerate all
protobuf, gRPC, REST gateway, JSON, and swagger files.
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from b331ce7 to c48f890 Compare May 15, 2026 13:22
@erickcestari erickcestari requested a review from yyforyongyu May 15, 2026 13:26
@erickcestari
Copy link
Copy Markdown
Collaborator Author

Thanks for the review @yyforyongyu . Your comments should be addressed now!

@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from c48f890 to 9464850 Compare May 15, 2026 13:38
@github-actions github-actions Bot added severity-critical Requires expert review - security/consensus critical and removed severity-critical Requires expert review - security/consensus critical labels May 15, 2026
…e notes

Add entries to the Breaking Changes section of the 0.21 release notes
covering the RPCs, fields, and config flags removed in this PR that were
announced for removal in 0.21 via the 0.20 release notes.
Drop the now-orphan routerrpc.SendToRouteResponse message that was only
referenced by the deleted routerrpc.SendToRoute RPC.

Also remove the deprecated outgoing_chan_id field from
lnrpc.QueryRoutesRequest (tag 14) and routerrpc.SendPaymentRequest
(tag 8); their tag numbers are now reserved. Callers must use the
multi-channel outgoing_chan_ids field introduced in 0.20.

Drop the compat fallback in router_backend.go that previously consumed
the field, and regenerate the affected pb.go/swagger artifacts.
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch 2 times, most recently from 79ae4a4 to a7a69d6 Compare May 15, 2026 18:59
Comment thread lnwire/node_announcement.go Outdated
Comment thread channeldb/codec.go Outdated
Comment thread tor/cmd_onion.go
Drop the v2 onion encoder branches from lnwire.WriteOnionAddr,
graph/db.encodeOnionAddr, graph/db.collectAddressRecords, and the
tor.OnionHostToFakeIP helper. lnd no longer produces v2 onion addresses
on any code path.

Decoders for v2 addresses are intentionally retained in lnwire,
graph/db, and tor so that existing graph databases and peer-announced
v2 addresses continue to deserialize. Update unit tests to use v3 onion
fixtures.
Stripping v2 entries inside NodeAnnouncement1.Decode mutated a signed
field before netann.ValidateNodeAnnSignature ran, so DataToSign emitted
bytes the peer never signed and the whole announcement was dropped with
an invalid-signature error. Restore the v2 byte path in WriteOnionAddr
and stop stripping in Decode; filter v2 only when converting the wire
message into a models.Node so storage/relay can still keep v2 out of
the address set we act on.

Add a netann regression test that signs a [v3, v2, ipv4] announcement,
round-trips it through Encode/Decode, and verifies signature validation
succeeds while NodeFromWireAnnouncement drops v2 from the resulting
Node.Addresses.
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from a7a69d6 to b15a8ed Compare May 18, 2026 13:41
@erickcestari
Copy link
Copy Markdown
Collaborator Author

Summary

Two commits on remove-deprecated-rpcs-20, both addressing the
signature-verification failure introduced when multi: remove tor v2 onion address encoder paths (30ed7a6) made the wire codec asymmetric
for v2 onion addresses.

17e65bb22 -- multi: keep wire codec faithful for legacy v2 onion addresses

Transient design. Restored byte-level fidelity in the wire codec but
still filtered v2 at storage entry.

  • lnwire/node_announcement.go -- removed the post-Decode v2 strip so
    DataToSign sees the original signed bytes.
  • lnwire/writer.go -- restored the v2 branch in WriteOnionAddr and
    deleted ErrV2OnionAddrNotSupported. Encode/DataToSign now round-trip
    v2.
  • lnwire/writer_test.go -- onion address v2 rejected -> onion address v2 with concrete expected bytes.
  • graph/db/models/node.go -- NodeFromWireAnnouncement strips v2 when
    copying msg.Addresses into the Node (filtering moved out of the codec
    but still pre-storage).
  • netann/node_announcement_test.go -- new regression test: signs a
    [v3, v2, ipv4] announcement, round-trips, verifies signature passes,
    asserts v2 dropped from Node.Addresses.

f8a4e4c4d -- multi: persist v2 onion addresses and filter at consumption sites

Pivot. Stops filtering at storage entry so we can reproduce signed
bytes after a restart, and moves the v2 drop to the dial site.

  • graph/db/models/node.go -- NodeFromWireAnnouncement no longer strips;
    Node.Addresses carries v2 into storage.
  • graph/db/addr.go -- restored the v2 branch in encodeOnionAddr so the
    DB persists v2. Deleted FilterSerializableAddrs. Added
    FilterReachableAddrs (the inverse intent: addresses we can dial
    today).
  • channeldb/codec.go, channeldb/nodes.go, graph/db/kv_store.go --
    dropped the FilterSerializableAddrs calls on every write path; the
    scalar net.Addr case in codec.go simplified back to plain
    SerializeAddr.
  • server.go::fetchNodeAdvertisedAddrs -- applies FilterReachableAddrs
    so the dialer skips v2.
  • channeldb/codec_test.go -- rewritten for the "preserve, don't filter"
    contract.
  • netann/node_announcement_test.go -- regression test updated: v2 must
    survive into Node.Addresses so re-broadcast can reproduce the signed
    bytes.

Net effect

Invariant: what the peer signed = what we store = what we re-emit. lnd
still never produces v2 itself (lncfg refuses it as input). v2 is
dropped only at the dial site, where Tor stopped serving v2 in October
2021 anyway.

If this is the desired behavior we want, I'll squash and rebase the commits.

@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from b15a8ed to a376b11 Compare May 18, 2026 14:41
Storing v2 entries faithfully is what lets us rebuild and re-broadcast
a peer's NodeAnnouncement after a restart with the exact bytes they
signed. Drop the strip in NodeFromWireAnnouncement, restore the v2
encoder branch in graph/db.encodeOnionAddr, and remove the
graphdb.FilterSerializableAddrs helper that was silently dropping v2
on every write path (channeldb codec, channeldb/nodes,
graph/db/kv_store).

Add graphdb.FilterReachableAddrs for the inverse intent: callers that
want to dial or surface the addresses should drop v2, since Tor stopped
serving v2 services in October 2021. Apply it in
server.fetchNodeAdvertisedAddrs so the dialer doesn't waste connection
attempts on v2 onions kept around purely for signed-bytes fidelity.

Update the netann regression test to assert v2 survives into the Node
(so signature reproduction works after a restart) and rewrite the
channeldb codec tests for the new "preserve, don't filter" contract.
@erickcestari erickcestari force-pushed the remove-deprecated-rpcs-20 branch from a376b11 to 37920fc Compare May 18, 2026 14:41
@erickcestari erickcestari requested a review from yyforyongyu May 18, 2026 14:41
@erickcestari
Copy link
Copy Markdown
Collaborator Author

I'm working on separating this PR into 2 different ones. One for the tor changes and another for the removal of the deprecated RPC. It's probably make it easier to review both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v0.21.x-branch This label triggers a backport to branch `v0.21.x-branch ` severity-critical Requires expert review - security/consensus critical

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

4 participants