Skip to content

Accept onion failure without a channel_update - #2854

Merged
t-bast merged 2 commits into
masterfrom
failure-onion-optional-update
Jun 4, 2024
Merged

t-bast merged 2 commits into
masterfrom
failure-onion-optional-update

Conversation

@t-bast

@t-bast t-bast commented May 7, 2024

Copy link
Copy Markdown
Member

lightning/bolts#1163 makes the channel update in onion failures optional. One reason for this change is that it can be a privacy issue: by applying a channel_update received from an payment attempt, you may reveal that you are the sender. Another reason is that some nodes have been omitting that field for years (which was arguably a bug), and it's better to be able to correctly handle such failures.

lightning/bolts#1163 makes the channel update in
onion failures optional. One reason for this change is that it can be a
privacy issue: by applying a `channel_update` received from an payment
attempt, you may reveal that you are the sender. Another reason is that
some nodes have been omitting that field for years (which was arguably
a bug), and it's better to be able to correctly handle such failures.
pm47
pm47 previously approved these changes Jun 4, 2024
@t-bast
t-bast merged commit 414f728 into master Jun 4, 2024
@t-bast
t-bast deleted the failure-onion-optional-update branch June 4, 2024 14:48
daywalker90 added a commit to daywalker90/lightning that referenced this pull request Sep 24, 2026
BOLT ElementsProject#1173 made channel_update optional in UPDATE-flagged failure
messages; nodes are expected to transition away from including it
because applying onion-embedded updates to the gossip graph is a
fingerprinting vulnerability.

We already sent len=0 for private channels and effectively for all
channeld-originated failures since the append-after-len0 bug (Oct
2023).  Formalize: always send len=0.  Remove
channel_update_for_error and channel_gossip_update_for_error.

test_pay_error_update_fees now injects a fee_insufficient failure
with a real channel_update via plugin, since CLN-to-CLN no longer
carries one on the wire.

Receive-side compatibility with len=0 UPDATE failures (oldest safe
versions):
  lnd: temporary_channel_failure only, since ~2017
        (lightningnetwork/lnd#216, 98956bc2); other UPDATE codes
        still fail wire decode
  LDK: v0.0.115 (Apr 2023, lightningdevkit/rust-lightning#2220,
        67ad6c4) for temporary_channel_failure; v0.0.124 (Sep 2024,
        lightningdevkit/rust-lightning#3083, 24c2468) for all
        UPDATE codes
  eclair: v0.11.0 (Dec 2024, ACINQ/eclair#2854, 414f728)
  CLN: 2020-06-23 (ElementsProject#3781, c100de6)
        application-logic safety

Changelog-Changed: Protocol: onion failure messages no longer include
channel_update (BOLT ElementsProject#1173).
daywalker90 added a commit to daywalker90/lightning that referenced this pull request Sep 24, 2026
BOLT ElementsProject#1173 made channel_update optional in UPDATE-flagged failure
messages; nodes are expected to transition away from including it
because applying onion-embedded updates to the gossip graph is a
fingerprinting vulnerability.

We already sent len=0 for private channels since 2022-02.  For
channeld-originated failures, rcvd_htlc_reply has been appending the
channel_update *after* a message that already ended with the zero
length field (since 222da7f, Oct 2023): receivers parsed len=0 and
silently dropped the trailing update, so those failures were already
effectively len=0 on the wire.  Formalize that: always send len=0
and stop building the update for failures.  Remove
channel_update_for_error and channel_gossip_update_for_error.

test_pay_error_update_fees now injects a fee_insufficient failure
with a real channel_update via plugin, since CLN-to-CLN no longer
carries one on the wire.

Receive-side compatibility with len=0 UPDATE failures (oldest safe
versions):
  lnd: temporary_channel_failure only, since ~2017
        (lightningnetwork/lnd#216, 98956bc2); other UPDATE codes
        still fail wire decode
  LDK: v0.0.115 (Apr 2023, lightningdevkit/rust-lightning#2220,
        67ad6c4) for temporary_channel_failure; v0.0.124 (Sep 2024,
        lightningdevkit/rust-lightning#3083, 24c2468) for all
        UPDATE codes
  eclair: v0.11.0 (Dec 2024, ACINQ/eclair#2854, 414f728)
  CLN: 2020-06-23 (ElementsProject#3781, c100de6)
        application-logic safety

Changelog-Changed: Protocol: onion failure messages no longer include
channel_update (BOLT ElementsProject#1173).
daywalker90 added a commit to daywalker90/lightning that referenced this pull request Sep 28, 2026
BOLT ElementsProject#1173 made channel_update optional in UPDATE-flagged failure
messages; nodes are expected to transition away from including it
because applying onion-embedded updates to the gossip graph is a
fingerprinting vulnerability.

We already sent len=0 for private channels since 2022-02.  For
channeld-originated failures, rcvd_htlc_reply has been appending the
channel_update *after* a message that already ended with the zero
length field (since 222da7f, Oct 2023): receivers parsed len=0 and
silently dropped the trailing update, so those failures were already
effectively len=0 on the wire.  Formalize that: always send len=0
and stop building the update for failures.  Remove
channel_update_for_error and channel_gossip_update_for_error.

Tests that relied on CLN sending the update (test_pay_error_update_fees,
test_xpay_error_update_fees, test_xpay_get_error_with_update and
renepay's test_fees) now inject a real channel_update through an inline
plugin, simulating a peer that still sends one (lnd/eclair); helpers
live in tests/utils.py.

Receive-side compatibility with len=0 UPDATE failures (oldest safe
versions):
  lnd: temporary_channel_failure only, since ~2017
        (lightningnetwork/lnd#216, 98956bc2); other UPDATE codes
        still fail wire decode
  LDK: v0.0.115 (Apr 2023, lightningdevkit/rust-lightning#2220,
        67ad6c4) for temporary_channel_failure; v0.0.124 (Sep 2024,
        lightningdevkit/rust-lightning#3083, 24c2468) for all
        UPDATE codes
  eclair: v0.11.0 (Dec 2024, ACINQ/eclair#2854, 414f728)
  CLN: 2020-06-23 (ElementsProject#3781, c100de6)
        application-logic safety

Changelog-Changed: Protocol: onion failure messages no longer include
channel_update (BOLT ElementsProject#1173).
daywalker90 added a commit to daywalker90/lightning that referenced this pull request Sep 28, 2026
BOLT ElementsProject#1173 made channel_update optional in UPDATE-flagged failure
messages; nodes are expected to transition away from including it
because applying onion-embedded updates to the gossip graph is a
fingerprinting vulnerability.

We already sent len=0 for private channels since 2022-02.  For
channeld-originated failures, rcvd_htlc_reply has been appending the
channel_update *after* a message that already ended with the zero
length field (since 222da7f, Oct 2023): receivers parsed len=0 and
silently dropped the trailing update, so those failures were already
effectively len=0 on the wire.  Formalize that: always send len=0
and stop building the update for failures.  Remove
channel_update_for_error and channel_gossip_update_for_error.

That helper also lazily disabled a channel in our own gossip when a
forward failed on a disconnected peer.  Preserve that behaviour
explicitly (BOLT #7 allows disabling on loss of connectivity):
disable in channel_gossip_channel_disconnect(), re-enable in
channel_gossip_channel_reestablished(), and treat a disconnected peer
as disabled in the generic channel_should_enable() callers.

Tests that relied on CLN sending the update (test_pay_error_update_fees,
test_xpay_error_update_fees, test_xpay_get_error_with_update and
renepay's test_fees) now inject a real channel_update through an inline
plugin, simulating a peer that still sends one (lnd/eclair); helpers
live in tests/utils.py.  test_gossip_disable_channels now actually
checks the disabled/enabled bit.

Receive-side compatibility with len=0 UPDATE failures (oldest safe
versions):
  lnd: temporary_channel_failure only, since ~2017
        (lightningnetwork/lnd#216, 98956bc2); other UPDATE codes
        still fail wire decode
  LDK: v0.0.115 (Apr 2023, lightningdevkit/rust-lightning#2220,
        67ad6c4) for temporary_channel_failure; v0.0.124 (Sep 2024,
        lightningdevkit/rust-lightning#3083, 24c2468) for all
        UPDATE codes
  eclair: v0.11.0 (Dec 2024, ACINQ/eclair#2854, 414f728)
  CLN: 2020-06-23 (ElementsProject#3781, c100de6)
        application-logic safety

Changelog-Changed: Protocol: onion failure messages no longer include
channel_update (BOLT ElementsProject#1173).
daywalker90 added a commit to daywalker90/lightning that referenced this pull request Sep 28, 2026
BOLT ElementsProject#1173 made channel_update optional in UPDATE-flagged failure
messages; nodes are expected to transition away from including it
because applying onion-embedded updates to the gossip graph is a
fingerprinting vulnerability.

We already sent len=0 for private channels since 2022-02.  For
channeld-originated failures, rcvd_htlc_reply has been appending the
channel_update *after* a message that already ended with the zero
length field (since 222da7f, Oct 2023): receivers parsed len=0 and
silently dropped the trailing update, so those failures were already
effectively len=0 on the wire.  Formalize that: always send len=0
and stop building the update for failures.  Remove
channel_update_for_error and channel_gossip_update_for_error.

That helper also lazily disabled a channel in our own gossip when a
forward failed on a disconnected peer.  Preserve that behaviour
explicitly (BOLT #7 allows disabling on loss of connectivity):
disable in channel_gossip_channel_disconnect(), re-enable in
channel_gossip_channel_reestablished(), and treat a disconnected peer
as disabled in the generic channel_should_enable() callers.

Tests that relied on CLN sending the update (test_pay_error_update_fees,
test_xpay_error_update_fees, test_xpay_get_error_with_update and
renepay's test_fees) now inject a real channel_update through an inline
plugin, simulating a peer that still sends one (lnd/eclair); helpers
live in tests/utils.py.  test_gossip_disable_channels now actually
checks the disabled/enabled bit.

Receive-side compatibility with len=0 UPDATE failures (oldest safe
versions):
  lnd: temporary_channel_failure only, since ~2017
        (lightningnetwork/lnd#216, 98956bc2); other UPDATE codes
        still fail wire decode
  LDK: v0.0.115 (Apr 2023, lightningdevkit/rust-lightning#2220,
        67ad6c4) for temporary_channel_failure; v0.0.124 (Sep 2024,
        lightningdevkit/rust-lightning#3083, 24c2468) for all
        UPDATE codes
  eclair: v0.11.0 (Dec 2024, ACINQ/eclair#2854, 414f728)
  CLN: 2020-06-23 (ElementsProject#3781, c100de6)
        application-logic safety

Changelog-Changed: Protocol: onion failure messages no longer include
channel_update (BOLT ElementsProject#1173).
daywalker90 added a commit to daywalker90/lightning that referenced this pull request Sep 28, 2026
BOLT ElementsProject#1173 made channel_update optional in UPDATE-flagged failure
messages; nodes are expected to transition away from including it
because applying onion-embedded updates to the gossip graph is a
fingerprinting vulnerability.

We already sent len=0 for private channels since 2022-02.  For
channeld-originated failures, rcvd_htlc_reply has been appending the
channel_update *after* a message that already ended with the zero
length field (since 222da7f, Oct 2023): receivers parsed len=0 and
silently dropped the trailing update, so those failures were already
effectively len=0 on the wire.  Formalize that: always send len=0
and stop building the update for failures.  Remove
channel_update_for_error and channel_gossip_update_for_error.

That helper also lazily disabled a channel in our own gossip when a
forward failed on a disconnected peer.  Preserve that behaviour
explicitly (BOLT #7 allows disabling on loss of connectivity):
disable in channel_gossip_channel_disconnect(), re-enable in
channel_gossip_channel_reestablished(), and treat a disconnected peer
as disabled in the generic channel_should_enable() callers.

Tests that relied on CLN sending the update (test_pay_error_update_fees,
test_xpay_error_update_fees, test_xpay_get_error_with_update and
renepay's test_fees) now inject a real channel_update through an inline
plugin, simulating a peer that still sends one (lnd/eclair); helpers
live in tests/utils.py.  test_gossip_disable_channels now actually
checks the disabled/enabled bit.  Regenerate the doc schema examples,
since the listsendpays erroronion changes.

Receive-side compatibility with len=0 UPDATE failures (oldest safe
versions):
  lnd: temporary_channel_failure only, since ~2017
        (lightningnetwork/lnd#216, 98956bc2); other UPDATE codes
        still fail wire decode
  LDK: v0.0.115 (Apr 2023, lightningdevkit/rust-lightning#2220,
        67ad6c4) for temporary_channel_failure; v0.0.124 (Sep 2024,
        lightningdevkit/rust-lightning#3083, 24c2468) for all
        UPDATE codes
  eclair: v0.11.0 (Dec 2024, ACINQ/eclair#2854, 414f728)
  CLN: 2020-06-23 (ElementsProject#3781, c100de6)
        application-logic safety

Changelog-Changed: Protocol: onion failure messages no longer include
channel_update (BOLT ElementsProject#1173).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants