contractcourt: use chanstate Store in breach arb
What changed, and why it matters
This is a small internal code cleanup change in LND's contract court. It swaps a broad database dependency for a narrower interface that only exposes what the breach arbitrator actually needs: reading closed channels and marking a channel fully closed. There is no direct security fix, new feature, or behavior change visible in the diff. It reduces the code's attack surface by limiting what the breach arbitrator can access, but the change alone does not close any known vulnerability.
No immediate action required. Treat as routine refactoring. Review whether the chanstate.ClosedChannelStore interface correctly exposes only MarkChanFullyClosed and closed-channel reads, and verify that downstream implementations satisfy the interface without introducing new behavior.
Security signals we found
Dependency narrowing reduces privilege/attack surface of the breach arbitrator
No functional change or vulnerability fix is present in the diff
No incident, CVE, or security advisory is referenced in the commit or supplied materials
Evidence from the diff
The commit refactors BreachConfig.DB from a concrete *channeldb.ChannelStateDB to the chanstate.ClosedChannelStore interface. The comment is updated to reflect that only closed-channel access is required. The diff shows only an import change and a type/comment change; no call sites, logic, or data flows are modified. This is a dependency-narrowing refactor that improves encapsulation and testability.
Changed components
contractcourt/breach_arbitrator.goBreachConfig structInspect captured patch +4 / −5
diff --git a/contractcourt/breach_arbitrator.go b/contractcourt/breach_arbitrator.go
index 6e12086..2c12f25 100644
--- a/contractcourt/breach_arbitrator.go
+++ b/contractcourt/breach_arbitrator.go
@@ -14,7 +14,7 @@ import (
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/chainntnfs"
- "github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
graphdb "github.com/lightningnetwork/lnd/graph/db"
"github.com/lightningnetwork/lnd/input"
@@ -140,10 +140,9 @@ type BreachConfig struct {
// a close type to be included in the channel close summary.
CloseLink func(*wire.OutPoint, ChannelCloseType)
- // DB provides access to the user's channels, allowing the breach
- // arbiter to determine the current state of a user's channels, and how
- // it should respond to channel closure.
- DB *channeldb.ChannelStateDB
+ // DB provides access to the user's closed channels, allowing the breach
+ // arbiter to determine how it should respond to channel closure.
+ DB chanstate.ClosedChannelStore
// Estimator is used by the breach arbiter to determine an appropriate
// fee level when generating, signing, and broadcasting sweep
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.