What changed, and why it matters
This commit is a straightforward internal code cleanup: it changes the lnwallet package to use the OpenChannel type from a dedicated chanstate package instead of getting it indirectly through the channeldb package. There is no change to user-facing behavior, network protocol handling, cryptographic operations, or database logic. It is purely a refactoring move to make the code's type ownership clearer.
No security action required. Treat as normal refactoring/dependency-hygiene commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch updates lnwallet (and its tests) to reference chanstate.OpenChannel rather than channeldb.OpenChannel. Function signatures, struct fields, channel types, and comments are updated accordingly. The channeldb import remains for database APIs and other aliases. No logic changes, no new validation, no security-relevant behavior modifications.
Changed components
lnwallet/aux_leaf_store.golnwallet/channel.golnwallet/channel_test.golnwallet/commitment.golnwallet/reservation.golnwallet/taproot_test_vectors_test.golnwallet/test_utils.golnwallet/transactions_test.golnwallet/wallet.goInspect captured patch +59 / −46
diff --git a/lnwallet/aux_leaf_store.go b/lnwallet/aux_leaf_store.go
index fb645b1..e4c2233 100644
--- a/lnwallet/aux_leaf_store.go
+++ b/lnwallet/aux_leaf_store.go
@@ -5,6 +5,7 @@ import (
"github.com/btcsuite/btcd/chainhash/v2"
"github.com/btcsuite/btcd/wire/v2"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lntypes"
@@ -55,7 +56,7 @@ type CommitAuxLeaves struct {
}
// AuxChanState is a struct that holds certain fields of the
-// channeldb.OpenChannel struct that are used by the aux components. The data
+// chanstate.OpenChannel struct that are used by the aux components. The data
// is copied over to prevent accidental mutation of the original channel state.
type AuxChanState struct {
// ChanType denotes which type of channel this is.
@@ -110,7 +111,7 @@ type AuxChanState struct {
}
// NewAuxChanState creates a new AuxChanState from the given channel state.
-func NewAuxChanState(chanState *channeldb.OpenChannel) AuxChanState {
+func NewAuxChanState(chanState *chanstate.OpenChannel) AuxChanState {
peerPub := chanState.IdentityPub.SerializeCompressed()
return AuxChanState{
@@ -202,7 +203,7 @@ type AuxLeafStore interface {
// auxLeavesFromView is used to derive the set of commit aux leaves (if any),
// that are needed to create a new commitment transaction using the original
// (unfiltered) htlc view.
-func auxLeavesFromView(leafStore AuxLeafStore, chanState *channeldb.OpenChannel,
+func auxLeavesFromView(leafStore AuxLeafStore, chanState *chanstate.OpenChannel,
prevBlob fn.Option[tlv.Blob], originalView *HtlcView,
whoseCommit lntypes.ChannelParty, ourBalance,
theirBalance lnwire.MilliSatoshi,
@@ -225,7 +226,7 @@ func auxLeavesFromView(leafStore AuxLeafStore, chanState *channeldb.OpenChannel,
// updateAuxBlob is a helper function that attempts to update the aux blob
// given the prior and current state information.
-func updateAuxBlob(leafStore AuxLeafStore, chanState *channeldb.OpenChannel,
+func updateAuxBlob(leafStore AuxLeafStore, chanState *chanstate.OpenChannel,
prevBlob fn.Option[tlv.Blob], nextViewUnfiltered *HtlcView,
whoseCommit lntypes.ChannelParty, ourBalance,
theirBalance lnwire.MilliSatoshi,
diff --git a/lnwallet/channel.go b/lnwallet/channel.go
index 73446c8..ea243dd 100644
--- a/lnwallet/channel.go
+++ b/lnwallet/channel.go
@@ -24,6 +24,7 @@ import (
"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/graph/db/models"
"github.com/lightningnetwork/lnd/input"
@@ -793,7 +794,7 @@ type LightningChannel struct {
// state, which we are able to broadcast safely.
commitChains lntypes.Dual[*commitmentChain]
- channelState *channeldb.OpenChannel
+ channelState *chanstate.OpenChannel
commitBuilder *CommitmentBuilder
@@ -951,7 +952,7 @@ func defaultChannelOpts() *channelOpts {
// automatically persist pertinent state to the database in an efficient
// manner.
func NewLightningChannel(signer input.Signer,
- state *channeldb.OpenChannel,
+ state *chanstate.OpenChannel,
sigPool *SigPool, chanOpts ...ChannelOpt) (*LightningChannel, error) {
opts := defaultChannelOpts()
@@ -2093,7 +2094,9 @@ type BreachRetribution struct {
// nil, then the revocation log will be checked to see if it contains the info
// required to construct the BreachRetribution. If the revocation log is missing
// the required fields then ErrRevLogDataMissing will be returned.
-func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
+//
+//nolint:funlen
+func NewBreachRetribution(chanState *chanstate.OpenChannel, stateNum uint64,
breachHeight uint32, spendTx *wire.MsgTx,
leafStore fn.Option[AuxLeafStore],
auxResolver fn.Option[AuxContractResolver]) (*BreachRetribution,
@@ -2393,7 +2396,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
// createHtlcRetribution is a helper function to construct an HtlcRetribution
// based on the passed params.
-func createHtlcRetribution(chanState *channeldb.OpenChannel,
+func createHtlcRetribution(chanState *chanstate.OpenChannel,
keyRing *CommitmentKeyRing, commitHash chainhash.Hash,
commitmentSecret *btcec.PrivateKey, leaseExpiry uint32,
htlc *channeldb.HTLCEntry,
@@ -2520,7 +2523,7 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel,
// see if these fields are present there. If they are not, then
// ErrRevLogDataMissing is returned.
func createBreachRetribution(revokedLog *channeldb.RevocationLog,
- spendTx *wire.MsgTx, chanState *channeldb.OpenChannel,
+ spendTx *wire.MsgTx, chanState *chanstate.OpenChannel,
keyRing *CommitmentKeyRing, commitmentSecret *btcec.PrivateKey,
leaseExpiry uint32,
auxLeaves fn.Option[CommitAuxLeaves]) (*BreachRetribution, int64, int64,
@@ -2637,7 +2640,7 @@ func createBreachRetribution(revokedLog *channeldb.RevocationLog,
// BreachRetribution using a ChannelCommitment. Returns the constructed
// retribution, our amount, their amount, and a possible non-nil error.
func createBreachRetributionLegacy(revokedLog *channeldb.ChannelCommitment,
- chanState *channeldb.OpenChannel, keyRing *CommitmentKeyRing,
+ chanState *chanstate.OpenChannel, keyRing *CommitmentKeyRing,
commitmentSecret *btcec.PrivateKey,
ourScript, theirScript input.ScriptDescriptor,
leaseExpiry uint32) (*BreachRetribution, int64, int64, error) {
@@ -2990,7 +2993,7 @@ func (lc *LightningChannel) fetchCommitmentView(
// fundingTxIn returns the funding output as a transaction input. The input
// returned by this function uses a max sequence number, so it isn't able to be
// used with RBF by default.
-func fundingTxIn(chanState *channeldb.OpenChannel) wire.TxIn {
+func fundingTxIn(chanState *chanstate.OpenChannel) wire.TxIn {
return *wire.NewTxIn(&chanState.FundingOutpoint, nil, nil)
}
@@ -3246,7 +3249,7 @@ func (lc *LightningChannel) fetchParent(entry *paymentDescriptor,
// configured reserve. It also uses the balance delta for the party, to account
// for entry amounts that have been processed already.
func balanceAboveReserve(party lntypes.ChannelParty, delta int64,
- channel *channeldb.OpenChannel) bool {
+ channel *chanstate.OpenChannel) bool {
// We're going to access the channel state, so let's make sure we're
// holding the lock.
@@ -3335,7 +3338,7 @@ func (lc *LightningChannel) evaluateNoOpHtlc(entry *paymentDescriptor,
// signature can be submitted to the sigPool to generate all the signatures
// asynchronously and in parallel.
func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
- chanState *channeldb.OpenChannel, leaseExpiry uint32,
+ chanState *chanstate.OpenChannel, leaseExpiry uint32,
remoteCommitView *commitment,
leafStore fn.Option[AuxLeafStore]) ([]SignJob, []AuxSigJob,
chan struct{}, error) {
@@ -4965,7 +4968,7 @@ func (lc *LightningChannel) recordSettlement(
// directly into the pool of workers.
//
//nolint:funlen
-func genHtlcSigValidationJobs(chanState *channeldb.OpenChannel,
+func genHtlcSigValidationJobs(chanState *chanstate.OpenChannel,
localCommitmentView *commitment, keyRing *CommitmentKeyRing,
htlcSigs []lnwire.Sig, leaseExpiry uint32,
leafStore fn.Option[AuxLeafStore], auxSigner fn.Option[AuxSigner],
@@ -6756,10 +6759,10 @@ func (lc *LightningChannel) ChannelPoint() wire.OutPoint {
return lc.channelState.FundingOutpoint
}
-// ChannelState returns a copy of the internal channeldb.OpenChannel state
+// ChannelState returns a copy of the internal chanstate.OpenChannel state
// struct. Modifications to the returned struct will not be reflected within
// the LightningChannel.
-func (lc *LightningChannel) ChannelState() *channeldb.OpenChannel {
+func (lc *LightningChannel) ChannelState() *chanstate.OpenChannel {
return lc.channelState.Copy()
}
@@ -7069,7 +7072,7 @@ type UnilateralCloseSummary struct {
// happen in case we have lost state) it should be set to an empty struct, in
// which case we will attempt to sweep the non-HTLC output using the passed
// commitPoint.
-func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, //nolint:funlen
+func NewUnilateralCloseSummary(chanState *chanstate.OpenChannel,
signer input.Signer, commitSpend *chainntnfs.SpendDetail,
remoteCommit channeldb.ChannelCommitment, commitPoint *btcec.PublicKey,
leafStore fn.Option[AuxLeafStore],
@@ -7410,7 +7413,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
commitTxHeight uint32, htlc *channeldb.HTLC, keyRing *CommitmentKeyRing,
feePerKw chainfee.SatPerKWeight, csvDelay, leaseExpiry uint32,
whoseCommit lntypes.ChannelParty, isCommitFromInitiator bool,
- chanType channeldb.ChannelType, chanState *channeldb.OpenChannel,
+ chanType channeldb.ChannelType, chanState *chanstate.OpenChannel,
auxLeaves fn.Option[CommitAuxLeaves],
auxResolver fn.Option[AuxContractResolver],
) (*OutgoingHtlcResolution, error) {
@@ -7784,7 +7787,7 @@ func newIncomingHtlcResolution(signer input.Signer,
commitTxHeight uint32, htlc *channeldb.HTLC, keyRing *CommitmentKeyRing,
feePerKw chainfee.SatPerKWeight, csvDelay, leaseExpiry uint32,
whoseCommit lntypes.ChannelParty, isCommitFromInitiator bool,
- chanType channeldb.ChannelType, chanState *channeldb.OpenChannel,
+ chanType channeldb.ChannelType, chanState *chanstate.OpenChannel,
auxLeaves fn.Option[CommitAuxLeaves],
auxResolver fn.Option[AuxContractResolver],
) (*IncomingHtlcResolution, error) {
@@ -8169,7 +8172,7 @@ func extractHtlcResolutions(feePerKw chainfee.SatPerKWeight,
localChanCfg, remoteChanCfg *channeldb.ChannelConfig,
commitTx *wire.MsgTx, commitTxHeight uint32,
chanType channeldb.ChannelType, isCommitFromInitiator bool,
- leaseExpiry uint32, chanState *channeldb.OpenChannel,
+ leaseExpiry uint32, chanState *chanstate.OpenChannel,
auxLeaves fn.Option[CommitAuxLeaves],
auxResolver fn.Option[AuxContractResolver]) (*HtlcResolutions, error) {
@@ -8383,7 +8386,7 @@ func (lc *LightningChannel) ForceClose(opts ...ForceCloseOpt) (
// NewLocalForceCloseSummary generates a LocalForceCloseSummary from the given
// channel state. The passed commitTx must be a fully signed commitment
// transaction corresponding to localCommit.
-func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
+func NewLocalForceCloseSummary(chanState *chanstate.OpenChannel,
signer input.Signer, commitTx *wire.MsgTx, commitTxHeight uint32,
stateNum uint64, leafStore fn.Option[AuxLeafStore],
auxResolver fn.Option[AuxContractResolver]) (*LocalForceCloseSummary,
@@ -9038,7 +9041,7 @@ func (lc *LightningChannel) NewAnchorResolutions() (*AnchorResolutions,
// NewAnchorResolution returns the information that is required to sweep the
// local anchor.
-func NewAnchorResolution(chanState *channeldb.OpenChannel,
+func NewAnchorResolution(chanState *chanstate.OpenChannel,
commitTx *wire.MsgTx, keyRing *CommitmentKeyRing,
whoseCommit lntypes.ChannelParty) (*AnchorResolution, error) {
@@ -10081,7 +10084,7 @@ func (lc *LightningChannel) IsPending() bool {
}
// State provides access to the channel's internal state.
-func (lc *LightningChannel) State() *channeldb.OpenChannel {
+func (lc *LightningChannel) State() *chanstate.OpenChannel {
return lc.channelState
}
diff --git a/lnwallet/channel_test.go b/lnwallet/channel_test.go
index f48f3d7..5fd8cc0 100644
--- a/lnwallet/channel_test.go
+++ b/lnwallet/channel_test.go
@@ -26,6 +26,7 @@ import (
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/graph/db/models"
"github.com/lightningnetwork/lnd/input"
@@ -9268,7 +9269,7 @@ func TestEvaluateView(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
isInitiator := test.channelInitiator == lntypes.Local
lc := LightningChannel{
- channelState: &channeldb.OpenChannel{
+ channelState: &chanstate.OpenChannel{
IsInitiator: isInitiator,
TotalMSatSent: 0,
TotalMSatReceived: 0,
@@ -10060,7 +10061,7 @@ func testGetDustSum(t *testing.T, chantype channeldb.ChannelType) {
// deriveDummyRetributionParams is a helper function that derives a list of
// dummy params to assist retribution creation related tests.
-func deriveDummyRetributionParams(chanState *channeldb.OpenChannel) (uint32,
+func deriveDummyRetributionParams(chanState *chanstate.OpenChannel) (uint32,
*CommitmentKeyRing, chainhash.Hash) {
config := chanState.RemoteChanCfg
diff --git a/lnwallet/commitment.go b/lnwallet/commitment.go
index ddb22c0..78b8212 100644
--- a/lnwallet/commitment.go
+++ b/lnwallet/commitment.go
@@ -11,6 +11,7 @@ import (
"github.com/btcsuite/btcd/txscript/v2"
"github.com/btcsuite/btcd/wire/v2"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lntypes"
@@ -635,7 +636,7 @@ type CommitmentBuilder struct {
// chanState is the underlying channel's state struct, used to
// determine the type of channel we are dealing with, and relevant
// parameters.
- chanState *channeldb.OpenChannel
+ chanState *chanstate.OpenChannel
// obfuscator is a 48-bit state hint that's used to obfuscate the
// current state number on the commitment transactions.
@@ -647,7 +648,7 @@ type CommitmentBuilder struct {
}
// NewCommitmentBuilder creates a new CommitmentBuilder from chanState.
-func NewCommitmentBuilder(chanState *channeldb.OpenChannel,
+func NewCommitmentBuilder(chanState *chanstate.OpenChannel,
leafStore fn.Option[AuxLeafStore]) *CommitmentBuilder {
// The anchor channel type MUST be tweakless.
@@ -665,7 +666,9 @@ func NewCommitmentBuilder(chanState *channeldb.OpenChannel,
// createStateHintObfuscator derives and assigns the state hint obfuscator for
// the channel, which is used to encode the commitment height in the sequence
// number of commitment transaction inputs.
-func createStateHintObfuscator(state *channeldb.OpenChannel) [StateHintSize]byte {
+func createStateHintObfuscator(
+ state *chanstate.OpenChannel) [StateHintSize]byte {
+
if state.IsInitiator {
return DeriveStateHintObfuscator(
state.LocalChanCfg.PaymentBasePoint.PubKey,
@@ -1320,7 +1323,7 @@ func addHTLC(commitTx *wire.MsgTx, whoseCommit lntypes.ChannelParty,
// output scripts and compares them against the outputs inside the commitment
// to find the match.
func findOutputIndexesFromRemote(revocationPreimage *chainhash.Hash,
- chanState *channeldb.OpenChannel,
+ chanState *chanstate.OpenChannel,
leafStore fn.Option[AuxLeafStore]) (uint32, uint32, error) {
// Init the output indexes as empty.
diff --git a/lnwallet/reservation.go b/lnwallet/reservation.go
index 61addc1..a2c1165 100644
--- a/lnwallet/reservation.go
+++ b/lnwallet/reservation.go
@@ -12,6 +12,7 @@ import (
"github.com/btcsuite/btcd/chainhash/v2"
"github.com/btcsuite/btcd/wire/v2"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
@@ -248,7 +249,7 @@ type ChannelReservation struct {
ourContribution *ChannelContribution
theirContribution *ChannelContribution
- partialState *channeldb.OpenChannel
+ partialState *chanstate.OpenChannel
nodeAddr net.Addr
// The ID of this reservation, used to uniquely track the reservation
@@ -494,7 +495,7 @@ func NewChannelReservation(capacity, localFundingAmt btcutil.Amount,
FundingAmount: theirBalance.ToSatoshis(),
ChannelConfig: &channeldb.ChannelConfig{},
},
- partialState: &channeldb.OpenChannel{
+ partialState: &chanstate.OpenChannel{
ChanType: chanType,
ChainHash: *chainHash,
IsPending: true,
@@ -777,11 +778,11 @@ func (r *ChannelReservation) OurSignatures() ([]*input.Script,
// confirmations. Once the method unblocks, a LightningChannel instance is
// returned, marking the channel available for updates.
func (r *ChannelReservation) CompleteReservation(fundingInputScripts []*input.Script,
- commitmentSig input.Signature) (*channeldb.OpenChannel, error) {
+ commitmentSig input.Signature) (*chanstate.OpenChannel, error) {
// TODO(roasbeef): add flag for watch or not?
errChan := make(chan error, 1)
- completeChan := make(chan *channeldb.OpenChannel, 1)
+ completeChan := make(chan *chanstate.OpenChannel, 1)
r.wallet.msgChan <- &addCounterPartySigsMsg{
pendingFundingID: r.reservationID,
@@ -805,11 +806,11 @@ func (r *ChannelReservation) CompleteReservation(fundingInputScripts []*input.Sc
// will be populated.
func (r *ChannelReservation) CompleteReservationSingle(
fundingPoint *wire.OutPoint, commitSig input.Signature,
- auxFundingDesc fn.Option[AuxFundingDesc]) (*channeldb.OpenChannel,
+ auxFundingDesc fn.Option[AuxFundingDesc]) (*chanstate.OpenChannel,
error) {
errChan := make(chan error, 1)
- completeChan := make(chan *channeldb.OpenChannel, 1)
+ completeChan := make(chan *chanstate.OpenChannel, 1)
r.wallet.msgChan <- &addSingleFunderSigsMsg{
pendingFundingID: r.reservationID,
@@ -903,7 +904,7 @@ func (r *ChannelReservation) Cancel() error {
}
// ChanState the current open channel state.
-func (r *ChannelReservation) ChanState() *channeldb.OpenChannel {
+func (r *ChannelReservation) ChanState() *chanstate.OpenChannel {
r.RLock()
defer r.RUnlock()
diff --git a/lnwallet/taproot_test_vectors_test.go b/lnwallet/taproot_test_vectors_test.go
index 23c72c4..57b7027 100644
--- a/lnwallet/taproot_test_vectors_test.go
+++ b/lnwallet/taproot_test_vectors_test.go
@@ -20,6 +20,7 @@ import (
"github.com/btcsuite/btcd/txscript/v2"
"github.com/btcsuite/btcd/wire/v2"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
@@ -891,7 +892,7 @@ func createTaprootTestChannelsForVectors(tc *taprootTestContext,
shortChanID := lnwire.NewShortChanIDFromInt(0xdeadbeef)
- remoteChannelState := &channeldb.OpenChannel{
+ remoteChannelState := &chanstate.OpenChannel{
LocalChanCfg: remoteCfg,
RemoteChanCfg: localCfg,
IdentityPub: tc.remoteFundingPrivkey.PubKey(),
@@ -908,7 +909,7 @@ func createTaprootTestChannelsForVectors(tc *taprootTestContext,
Db: dbRemote.ChannelStateDB(),
FundingTxn: fundingTx,
}
- localChannelState := &channeldb.OpenChannel{
+ localChannelState := &chanstate.OpenChannel{
LocalChanCfg: localCfg,
RemoteChanCfg: remoteCfg,
IdentityPub: tc.localFundingPrivkey.PubKey(),
diff --git a/lnwallet/test_utils.go b/lnwallet/test_utils.go
index 5723be7..22f8861 100644
--- a/lnwallet/test_utils.go
+++ b/lnwallet/test_utils.go
@@ -16,6 +16,7 @@ import (
"github.com/btcsuite/btcd/chainhash/v2"
"github.com/btcsuite/btcd/wire/v2"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
@@ -308,7 +309,7 @@ func CreateTestChannels(t *testing.T, chanType channeldb.ChannelType,
binary.BigEndian.Uint64(chanIDBytes[:]),
)
- aliceChannelState := &channeldb.OpenChannel{
+ aliceChannelState := &chanstate.OpenChannel{
LocalChanCfg: aliceCfg,
RemoteChanCfg: bobCfg,
IdentityPub: aliceKeys[0].PubKey(),
@@ -325,7 +326,7 @@ func CreateTestChannels(t *testing.T, chanType channeldb.ChannelType,
Db: dbAlice.ChannelStateDB(),
FundingTxn: testTx,
}
- bobChannelState := &channeldb.OpenChannel{
+ bobChannelState := &chanstate.OpenChannel{
LocalChanCfg: bobCfg,
RemoteChanCfg: aliceCfg,
IdentityPub: bobKeys[0].PubKey(),
diff --git a/lnwallet/transactions_test.go b/lnwallet/transactions_test.go
index 6f941ad..1ae21d8 100644
--- a/lnwallet/transactions_test.go
+++ b/lnwallet/transactions_test.go
@@ -21,6 +21,7 @@ import (
"github.com/btcsuite/btcd/txscript/v2"
"github.com/btcsuite/btcd/wire/v2"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
@@ -967,7 +968,7 @@ func createTestChannelsForVectors(tc *testContext, chanType channeldb.ChannelTyp
binary.BigEndian.Uint64(chanIDBytes[:]),
)
- remoteChannelState := &channeldb.OpenChannel{
+ remoteChannelState := &chanstate.OpenChannel{
LocalChanCfg: remoteCfg,
RemoteChanCfg: localCfg,
IdentityPub: remoteDummy2.PubKey(),
@@ -984,7 +985,7 @@ func createTestChannelsForVectors(tc *testContext, chanType channeldb.ChannelTyp
Db: dbRemote.ChannelStateDB(),
FundingTxn: tc.fundingTx.MsgTx(),
}
- localChannelState := &channeldb.OpenChannel{
+ localChannelState := &chanstate.OpenChannel{
LocalChanCfg: localCfg,
RemoteChanCfg: remoteCfg,
IdentityPub: localDummy2.PubKey(),
diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go
index 6ae922c..54efab6 100644
--- a/lnwallet/wallet.go
+++ b/lnwallet/wallet.go
@@ -23,6 +23,7 @@ import (
"github.com/btcsuite/btcd/wire/v2"
"github.com/btcsuite/btcwallet/wallet"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
@@ -335,7 +336,7 @@ type addCounterPartySigsMsg struct {
// This channel is used to return the completed channel after the wallet
// has completed all of its stages in the funding process.
- completeChan chan *channeldb.OpenChannel
+ completeChan chan *chanstate.OpenChannel
// NOTE: In order to avoid deadlocks, this channel MUST be buffered.
err chan error
@@ -364,7 +365,7 @@ type addSingleFunderSigsMsg struct {
// This channel is used to return the completed channel after the wallet
// has completed all of its stages in the funding process.
- completeChan chan *channeldb.OpenChannel
+ completeChan chan *chanstate.OpenChannel
// NOTE: In order to avoid deadlocks, this channel MUST be buffered.
err chan error
@@ -1152,7 +1153,7 @@ func (l *LightningWallet) CurrentNumAnchorChans() (int, error) {
}
var numAnchors int
- cntChannel := func(c *channeldb.OpenChannel) {
+ cntChannel := func(c *chanstate.OpenChannel) {
// We skip private channels, as we assume they won't be used
// for routing.
if c.ChannelFlags&lnwire.FFAnnounceChannel == 0 {
@@ -2601,7 +2602,7 @@ func initStateHints(commit1, commit2 *wire.MsgTx,
// ValidateChannel will attempt to fully validate a newly mined channel, given
// its funding transaction and existing channel state. If this method returns
// an error, then the mined channel is invalid, and shouldn't be used.
-func (l *LightningWallet) ValidateChannel(channelState *channeldb.OpenChannel,
+func (l *LightningWallet) ValidateChannel(channelState *chanstate.OpenChannel,
fundingTx *wire.MsgTx) error {
var chanOpts []ChannelOpt
Why this scored 15/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.