From 304fe5f03306ecd5275a985bffb31b3774a63485 Mon Sep 17 00:00:00 2001 From: eugene Date: Tue, 29 Aug 2023 11:56:44 -0400 Subject: [PATCH 1/2] htlcswitch/hop: use InvalidOnionVersion for replayed packets The link will send an update_fail_malformed_htlc, so we need to set the BADONION bit. Since there isn't a replay-specific error, we set the failure code to InvalidOnionVersion which has the BADONION bit. --- htlcswitch/hop/iterator.go | 9 ++++++++- itest/lnd_misc_test.go | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htlcswitch/hop/iterator.go b/htlcswitch/hop/iterator.go index 14f11c5673..b5c7d0c834 100644 --- a/htlcswitch/hop/iterator.go +++ b/htlcswitch/hop/iterator.go @@ -364,7 +364,14 @@ func (p *OnionProcessor) DecodeHopIterators(id []byte, if replays.Contains(uint16(i)) { log.Errorf("unable to process onion packet: %v", sphinx.ErrReplayedPacket) - resp.FailCode = lnwire.CodeTemporaryChannelFailure + + // We set FailCode to CodeInvalidOnionVersion even + // though the ephemeral key isn't the problem. We need + // to set the BADONION bit since we're sending back a + // malformed packet, but as there isn't a specific + // failure code for replays, we reuse one of the + // failure codes that has BADONION. + resp.FailCode = lnwire.CodeInvalidOnionVersion continue } diff --git a/itest/lnd_misc_test.go b/itest/lnd_misc_test.go index bd71fa8423..62a568e297 100644 --- a/itest/lnd_misc_test.go +++ b/itest/lnd_misc_test.go @@ -219,7 +219,7 @@ func testSphinxReplayPersistence(ht *lntest.HarnessTest) { // Assert that Fred receives the expected failure after Carol sent a // duplicate packet that fails due to sphinx replay detection. ht.AssertPaymentStatusFromStream(payStream, lnrpc.Payment_FAILED) - ht.AssertLastHTLCError(fred, lnrpc.Failure_INVALID_ONION_KEY) + ht.AssertLastHTLCError(fred, lnrpc.Failure_INVALID_ONION_VERSION) // Since the payment failed, the balance should still be left // unaltered. From 4f371884660b71322fefe715d87b03e4fbdefd6c Mon Sep 17 00:00:00 2001 From: eugene Date: Fri, 6 Oct 2023 13:23:55 -0400 Subject: [PATCH 2/2] release-notes: update for 0.17.1 --- docs/release-notes/release-notes-0.17.1.md | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docs/release-notes/release-notes-0.17.1.md diff --git a/docs/release-notes/release-notes-0.17.1.md b/docs/release-notes/release-notes-0.17.1.md new file mode 100644 index 0000000000..7af034b195 --- /dev/null +++ b/docs/release-notes/release-notes-0.17.1.md @@ -0,0 +1,48 @@ +# Release Notes +- [Bug Fixes](#bug-fixes) +- [New Features](#new-features) + - [Functional Enhancements](#functional-enhancements) + - [RPC Additions](#rpc-additions) + - [lncli Additions](#lncli-additions) +- [Improvements](#improvements) + - [Functional Updates](#functional-updates) + - [RPC Updates](#rpc-updates) + - [lncli Updates](#lncli-updates) + - [Breaking Changes](#breaking-changes) + - [Performance Improvements](#performance-improvements) + - [Technical and Architectural Updates](#technical-and-architectural-updates) + - [BOLT Spec Updates](#bolt-spec-updates) + - [Testing](#testing) + - [Database](#database) + - [Code Health](#code-health) + - [Tooling and Documentation](#tooling-and-documentation) + +# Bug Fixes + +* [LND now sets the `BADONION`](https://github.com/lightningnetwork/lnd/pull/7937) + bit when sending `update_fail_malformed_htlc`. This avoids a force close + with other implementations. + +# New Features +## Functional Enhancements +## RPC Additions +## lncli Additions + +# Improvements +## Functional Updates +## RPC Updates +## lncli Updates +## Code Health +## Breaking Changes +## Performance Improvements + +# Technical and Architectural Updates +## BOLT Spec Updates +## Testing +## Database +## Code Health +## Tooling and Documentation + +# Contributors (Alphabetical Order) + +* Eugene Siegel \ No newline at end of file