mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-27 22:53:43 +01:00
routing+server: define PaymentSessionSource
This commit is contained in:
@@ -84,12 +84,25 @@ func createTestCtxFromGraphInstance(startingHeight uint32, graphInstance *testGr
|
||||
// be populated.
|
||||
chain := newMockChain(startingHeight)
|
||||
chainView := newMockChainView(chain)
|
||||
|
||||
selfNode, err := graphInstance.graph.SourceNode()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
mc := NewMissionControl(
|
||||
graphInstance.graph, selfNode,
|
||||
func(e *channeldb.ChannelEdgeInfo) lnwire.MilliSatoshi {
|
||||
return lnwire.NewMSatFromSatoshis(e.Capacity)
|
||||
},
|
||||
)
|
||||
router, err := New(Config{
|
||||
Graph: graphInstance.graph,
|
||||
Chain: chain,
|
||||
ChainView: chainView,
|
||||
Payer: &mockPaymentAttemptDispatcher{},
|
||||
Control: makeMockControlTower(),
|
||||
MissionControl: mc,
|
||||
ChannelPruneExpiry: time.Hour * 24,
|
||||
GraphPruneInterval: time.Hour * 2,
|
||||
QueryBandwidth: func(e *channeldb.ChannelEdgeInfo) lnwire.MilliSatoshi {
|
||||
@@ -807,7 +820,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
|
||||
return preImage, nil
|
||||
})
|
||||
|
||||
ctx.router.missionControl.ResetHistory()
|
||||
ctx.router.cfg.MissionControl.(*MissionControl).ResetHistory()
|
||||
|
||||
// When we try to dispatch that payment, we should receive an error as
|
||||
// both attempts should fail and cause both routes to be pruned.
|
||||
@@ -822,7 +835,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
|
||||
t.Fatalf("expected UnknownNextPeer instead got: %v", err)
|
||||
}
|
||||
|
||||
ctx.router.missionControl.ResetHistory()
|
||||
ctx.router.cfg.MissionControl.(*MissionControl).ResetHistory()
|
||||
|
||||
// Next, we'll modify the SendToSwitch method to indicate that luo ji
|
||||
// wasn't originally online. This should also halt the send all
|
||||
@@ -865,7 +878,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
|
||||
ctx.aliases))
|
||||
}
|
||||
|
||||
ctx.router.missionControl.ResetHistory()
|
||||
ctx.router.cfg.MissionControl.(*MissionControl).ResetHistory()
|
||||
|
||||
// Finally, we'll modify the SendToSwitch function to indicate that the
|
||||
// roasbeef -> luoji channel has insufficient capacity. This should
|
||||
|
||||
Reference in New Issue
Block a user