[bug]: RBF coop close silently ignores a requested delivery address that conflicts with the upfront shutdown script (classic close returns an error)

Open
#11,468 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #11475 by @lmtlssss — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
go

Research direction

Start with the SendShutdown transition and env.LocalUpfrontShutdown.Alt(msg.DeliveryAddr) in lnwallet/chancloser/rbf_coop_transitions.go, then compare with chooseDeliveryScript and ErrUpfrontShutdownScriptMismatch in peer/brontide.go. Done means the RBF closer rejects or warns on a requested address that differs from the upfront script, matching the classic path, with tests covering both cases. The issue leaves open whether to error or warn, so confirm that with maintainers first.

Written by the indexing model from the issue text.

Description

bug needs triage
Pre-Submission Checklist
  • I have searched the existing issues and believe this is a new bug.
  • I am not asking a question about how to use lnd, but reporting a bug (otherwise open a discussion).
Bug Details & Steps to Reproduce
Background

When a channel was opened with an upfront_shutdown_script, BOLT 2 requires the shutdown message to carry that committed script (02-peer-protocol.md: "if it sent a non-zero-length shutdown_scriptpubkey in open_channel or accept_channel: MUST send the same value in scriptpubkey"). So the correct on-chain behaviour, in both close flows, is that cooperative-close funds go to the upfront script. That part is fine.

The inconsistency is in how the two coop-close implementations treat an operator who asks, via CloseChannel, to close out to a different address than the upfront script.

Behaviour

Both paths are reached from rpcServer.CloseChannel, which only decodes the delivery_address and checks it is for the active network; it does not compare it against the channel's upfront script.

  • Classic closer: chooseDeliveryScript (peer/brontide.go) compares the requested address against the upfront script and, when they differ, returns chancloser.ErrUpfrontShutdownScriptMismatch. The RPC fails with a clear error, so the operator learns the request could not be honoured.

  • RBF closer: the SendShutdown transition uses env.LocalUpfrontShutdown.Alt(msg.DeliveryAddr) (lnwallet/chancloser/rbf_coop_transitions.go). When an upfront script is set, Alt returns it and the requested delivery_address is dropped with no comparison and no error. The close proceeds to the upfront script and the RPC succeeds, so the operator is not told their requested address was ignored.

(The existing ErrUpfrontShutdownScriptMismatch check in the RBF code validates the remote peer's script against the peer's upfront, via validateRemoteDeliveryScript — a different check from the local requested address.)

Expected Behavior

For consistency, the RBF closer should treat a non-matching requested delivery address the same way the classic closer does: return ErrUpfrontShutdownScriptMismatch (or at least surface a warning) when a delivery_address that differs from the upfront script is requested, rather than silently using the upfront script.

Dominant language
Go
Stars
8.2k
Forks
2.3k
Avg merge
1d 11h
Merged PRs (30d)
103

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lightningnetwork/lnd

All issues in lightningnetwork/lnd

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.