refactor: move graph related DB code to graph/db from channeldb
This is a pure refactor commit. It moves over all the graph related CRUD code from `channeldb` to `graph/db`.
This commit is contained in:
57 files changed
+512
-299
No files matched your search
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
graphdb "github.com/lightningnetwork/lnd/graph/db"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -195,7 +196,7 @@ func (m *ChanStatusManager) start() error {
|
||||
// have been pruned from the channel graph but not yet from our
|
||||
// set of channels. We'll skip it as we can't determine its
|
||||
// initial state.
|
||||
case errors.Is(err, channeldb.ErrEdgeNotFound):
|
||||
case errors.Is(err, graphdb.ErrEdgeNotFound):
|
||||
log.Warnf("Unable to find channel policies for %v, "+
|
||||
"skipping. This is typical if the channel is "+
|
||||
"in the process of closing.", c.FundingOutpoint)
|
||||
@@ -580,7 +581,7 @@ func (m *ChanStatusManager) disableInactiveChannels() {
|
||||
// that the channel has been closed. Thus we remove the
|
||||
// outpoint from the set of tracked outpoints to prevent
|
||||
// further attempts.
|
||||
if errors.Is(err, channeldb.ErrEdgeNotFound) {
|
||||
if errors.Is(err, graphdb.ErrEdgeNotFound) {
|
||||
log.Debugf("Removing channel(%v) from "+
|
||||
"consideration for passive disabling",
|
||||
outpoint)
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
graphdb "github.com/lightningnetwork/lnd/graph/db"
|
||||
"github.com/lightningnetwork/lnd/graph/db/models"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -168,7 +169,7 @@ func (g *mockGraph) FetchChannelEdgesByOutpoint(
|
||||
|
||||
info, ok := g.chanInfos[*op]
|
||||
if !ok {
|
||||
return nil, nil, nil, channeldb.ErrEdgeNotFound
|
||||
return nil, nil, nil, graphdb.ErrEdgeNotFound
|
||||
}
|
||||
|
||||
pol1 := g.chanPols1[*op]
|
||||
@@ -697,7 +698,7 @@ var stateMachineTests = []stateMachineTest{
|
||||
// Request that they be enabled, which should return an
|
||||
// error as the graph doesn't have an edge for them.
|
||||
h.assertEnables(
|
||||
unknownChans, channeldb.ErrEdgeNotFound, false,
|
||||
unknownChans, graphdb.ErrEdgeNotFound, false,
|
||||
)
|
||||
// No updates should be sent as a result of the failure.
|
||||
h.assertNoUpdates(h.safeDisableTimeout)
|
||||
@@ -717,7 +718,7 @@ var stateMachineTests = []stateMachineTest{
|
||||
// Request that they be disabled, which should return an
|
||||
// error as the graph doesn't have an edge for them.
|
||||
h.assertDisables(
|
||||
unknownChans, channeldb.ErrEdgeNotFound, false,
|
||||
unknownChans, graphdb.ErrEdgeNotFound, false,
|
||||
)
|
||||
// No updates should be sent as a result of the failure.
|
||||
h.assertNoUpdates(h.safeDisableTimeout)
|
||||
@@ -747,7 +748,7 @@ var stateMachineTests = []stateMachineTest{
|
||||
|
||||
// Check that trying to enable the channel with unknown
|
||||
// edges results in a failure.
|
||||
h.assertEnables(newChans, channeldb.ErrEdgeNotFound, false)
|
||||
h.assertEnables(newChans, graphdb.ErrEdgeNotFound, false)
|
||||
|
||||
// Now, insert edge policies for the channel into the
|
||||
// graph, starting with the channel enabled, and mark
|
||||
@@ -794,7 +795,9 @@ var stateMachineTests = []stateMachineTest{
|
||||
|
||||
// Check that trying to enable the channel with unknown
|
||||
// edges results in a failure.
|
||||
h.assertDisables(rmChans, channeldb.ErrEdgeNotFound, false)
|
||||
h.assertDisables(
|
||||
rmChans, graphdb.ErrEdgeNotFound, false,
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user