graph/db: thread context through FetchChannelEdgesByID
This commit is contained in:
14 files changed
+93
-42
No files matched your search
@@ -2199,7 +2199,9 @@ func runRouteFailMaxHTLC(t *testing.T, useCache bool) {
|
||||
// Next, update the middle edge policy to only allow payments up to 100k
|
||||
// msat.
|
||||
graph := ctx.testGraphInstance.graph
|
||||
_, midEdge, _, err := graph.FetchChannelEdgesByID(firstToSecondID)
|
||||
_, midEdge, _, err := graph.FetchChannelEdgesByID(
|
||||
t.Context(), firstToSecondID,
|
||||
)
|
||||
require.NoError(t, err, "unable to fetch channel edges by ID")
|
||||
midEdge.MessageFlags = 1
|
||||
midEdge.MaxHTLC = payAmt - 1
|
||||
@@ -2243,7 +2245,9 @@ func runRouteFailDisabledEdge(t *testing.T, useCache bool) {
|
||||
// path finding, as we don't consider the disable flag for local
|
||||
// channels (and roasbeef is the source).
|
||||
roasToPham := uint64(999991)
|
||||
_, e1, e2, err := graph.graph.FetchChannelEdgesByID(roasToPham)
|
||||
_, e1, e2, err := graph.graph.FetchChannelEdgesByID(
|
||||
t.Context(), roasToPham,
|
||||
)
|
||||
require.NoError(t, err, "unable to fetch edge")
|
||||
e1.ChannelFlags |= lnwire.ChanUpdateDisabled
|
||||
e1.LastUpdate = e1.LastUpdate.Add(time.Second)
|
||||
@@ -2266,7 +2270,9 @@ func runRouteFailDisabledEdge(t *testing.T, useCache bool) {
|
||||
// Now, we'll modify the edge from phamnuwen -> sophon, to read that
|
||||
// it's disabled.
|
||||
phamToSophon := uint64(99999)
|
||||
_, e, _, err := graph.graph.FetchChannelEdgesByID(phamToSophon)
|
||||
_, e, _, err := graph.graph.FetchChannelEdgesByID(
|
||||
t.Context(), phamToSophon,
|
||||
)
|
||||
require.NoError(t, err, "unable to fetch edge")
|
||||
e.ChannelFlags |= lnwire.ChanUpdateDisabled
|
||||
e.LastUpdate = e.LastUpdate.Add(time.Second)
|
||||
@@ -2349,7 +2355,9 @@ func runPathSourceEdgesBandwidth(t *testing.T, useCache bool) {
|
||||
// Finally, set the roasbeef->songoku bandwidth, but also set its
|
||||
// disable flag.
|
||||
bandwidths.hints[roasToSongoku] = 2 * payAmt
|
||||
_, e1, e2, err := graph.graph.FetchChannelEdgesByID(roasToSongoku)
|
||||
_, e1, e2, err := graph.graph.FetchChannelEdgesByID(
|
||||
t.Context(), roasToSongoku,
|
||||
)
|
||||
require.NoError(t, err, "unable to fetch edge")
|
||||
e1.ChannelFlags |= lnwire.ChanUpdateDisabled
|
||||
e1.LastUpdate = e1.LastUpdate.Add(time.Second)
|
||||
|
||||
@@ -454,7 +454,7 @@ func TestChannelUpdateValidation(t *testing.T) {
|
||||
|
||||
// Assert that the initially configured fee is retrieved correctly.
|
||||
_, e1, e2, err := ctx.graph.FetchChannelEdgesByID(
|
||||
lnwire.NewShortChanIDFromInt(1).ToUint64(),
|
||||
t.Context(), lnwire.NewShortChanIDFromInt(1).ToUint64(),
|
||||
)
|
||||
require.NoError(t, err, "cannot retrieve channel")
|
||||
|
||||
@@ -526,7 +526,7 @@ func TestChannelUpdateValidation(t *testing.T) {
|
||||
require.Error(t, err, "expected route to fail with channel update")
|
||||
|
||||
_, e1, e2, err = ctx.graph.FetchChannelEdgesByID(
|
||||
lnwire.NewShortChanIDFromInt(1).ToUint64(),
|
||||
t.Context(), lnwire.NewShortChanIDFromInt(1).ToUint64(),
|
||||
)
|
||||
require.NoError(t, err, "cannot retrieve channel")
|
||||
|
||||
@@ -548,7 +548,7 @@ func TestChannelUpdateValidation(t *testing.T) {
|
||||
// This time a valid signature was supplied and the policy change should
|
||||
// have been applied to the graph.
|
||||
_, e1, e2, err = ctx.graph.FetchChannelEdgesByID(
|
||||
lnwire.NewShortChanIDFromInt(1).ToUint64(),
|
||||
t.Context(), lnwire.NewShortChanIDFromInt(1).ToUint64(),
|
||||
)
|
||||
require.NoError(t, err, "cannot retrieve channel")
|
||||
|
||||
@@ -589,7 +589,7 @@ func TestSendPaymentErrorRepeatedFeeInsufficient(t *testing.T) {
|
||||
// to sophon. We'll obtain this as we'll need to to generate the
|
||||
// FeeInsufficient error that we'll send back.
|
||||
_, _, edgeUpdateToFail, err := ctx.graph.FetchChannelEdgesByID(
|
||||
songokuSophonChanID,
|
||||
t.Context(), songokuSophonChanID,
|
||||
)
|
||||
require.NoError(t, err, "unable to fetch chan id")
|
||||
|
||||
@@ -936,7 +936,9 @@ func TestSendPaymentErrorNonFinalTimeLockErrors(t *testing.T) {
|
||||
chanID := ctx.getChannelIDFromAlias(t, "roasbeef", "songoku")
|
||||
roasbeefSongoku := lnwire.NewShortChanIDFromInt(chanID)
|
||||
|
||||
_, _, edgeUpdateToFail, err := ctx.graph.FetchChannelEdgesByID(chanID)
|
||||
_, _, edgeUpdateToFail, err := ctx.graph.FetchChannelEdgesByID(
|
||||
t.Context(), chanID,
|
||||
)
|
||||
require.NoError(t, err, "unable to fetch chan id")
|
||||
|
||||
errChanUpdate := lnwire.ChannelUpdate1{
|
||||
|
||||
Reference in new issue
Block a user