Repository navigation
Conversation
… known channel A route hint reusing the short_channel_id of a known channel with different endpoints overwrote that channel's cltv_expiry_delta and fees in xpay route finding. Skip such localmods in gossmap_apply_localmods, and don't restore them in gossmap_remove_localmods. Fixes: ElementsProject#9672 Changelog-Fixed: xpay: a route hint reusing a known channel's short_channel_id no longer changes that channel's CLTV delay.
Author
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9672
Problem
add_routehintin xpay only drops a hint hop whose pubkey is our own. A hop that reuses theshort_channel_idof a channel we already know (with different endpoints) is turned intoaskrene-create-channel+askrene-update-channel.gossmap_local_addchanonly checks for duplicates among the localmods, so it records a new local channel. Thengossmap_apply_localmodsfinds the existing channel by scid and applies the hint's update to it. The known channel'scltv_expiry_delta(and fees) get overwritten, e.g. 6 becomes 1000 in the issue's example, and the hint's own edge is never created.Fix
In
gossmap_apply_localmods, when a mod was created bygossmap_local_addchanbut the scid already exists in the map, compare the endpoints in the local channel_announcement with the existing channel's. If they differ, skip the mod entirely so it can't modify the known channel.A new
skippedflag onstruct localmodmakesgossmap_remove_localmodsskip those mods too. Otherwise it would "restore"orig[]values that were never saved and corrupt the channel.A local channel whose endpoints match the existing channel is still applied as before (e.g. a payee hint describing a real public channel, or a layer overriding it).
Tests
common/test/run-gossmap_local-routehint.c, the test from the issue, plus a check thatgossmap_remove_localmodsleaves the channel unchanged.cltv_expiry_delta after hint: 1000, assertion fails.6, passes.make check-unitspasses, including all gossmap, askrene and xpay unit tests.check-whitespace,check-includes,check-amount-access,check-discouraged-functionspass.Not covered
A payee reachable only through such a colliding hint is still unroutable ("Unknown destination node"). Supporting that would need xpay to map the hint to a fresh fake scid for route finding and back to the real scid in the onion.