routing/test: extract mission control test parameters
This commit is contained in:
parent
21a40daf58
commit
37ef46bc48
@ -32,6 +32,9 @@ var (
|
|||||||
mcTestTime = time.Date(2018, time.January, 9, 14, 00, 00, 0, time.UTC)
|
mcTestTime = time.Date(2018, time.January, 9, 14, 00, 00, 0, time.UTC)
|
||||||
mcTestNode1 = mcTestRoute.Hops[0].PubKeyBytes
|
mcTestNode1 = mcTestRoute.Hops[0].PubKeyBytes
|
||||||
mcTestNode2 = mcTestRoute.Hops[1].PubKeyBytes
|
mcTestNode2 = mcTestRoute.Hops[1].PubKeyBytes
|
||||||
|
|
||||||
|
testPenaltyHalfLife = 30 * time.Minute
|
||||||
|
testAprioriHopProbability = 0.8
|
||||||
)
|
)
|
||||||
|
|
||||||
type mcTestContext struct {
|
type mcTestContext struct {
|
||||||
@ -73,8 +76,8 @@ func (ctx *mcTestContext) restartMc() {
|
|||||||
mc, err := NewMissionControl(
|
mc, err := NewMissionControl(
|
||||||
ctx.db,
|
ctx.db,
|
||||||
&MissionControlConfig{
|
&MissionControlConfig{
|
||||||
PenaltyHalfLife: 30 * time.Minute,
|
PenaltyHalfLife: testPenaltyHalfLife,
|
||||||
AprioriHopProbability: 0.8,
|
AprioriHopProbability: testAprioriHopProbability,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -142,7 +145,7 @@ func TestMissionControl(t *testing.T) {
|
|||||||
|
|
||||||
// As we reported with a min penalization amt, a lower amt than reported
|
// As we reported with a min penalization amt, a lower amt than reported
|
||||||
// should be unaffected.
|
// should be unaffected.
|
||||||
ctx.expectP(500, 0.8)
|
ctx.expectP(500, testAprioriHopProbability)
|
||||||
|
|
||||||
// Edge decay started.
|
// Edge decay started.
|
||||||
ctx.now = testTime.Add(30 * time.Minute)
|
ctx.now = testTime.Add(30 * time.Minute)
|
||||||
@ -192,7 +195,7 @@ func TestMissionControlChannelUpdate(t *testing.T) {
|
|||||||
ctx.reportFailure(
|
ctx.reportFailure(
|
||||||
0, lnwire.NewFeeInsufficient(0, lnwire.ChannelUpdate{}),
|
0, lnwire.NewFeeInsufficient(0, lnwire.ChannelUpdate{}),
|
||||||
)
|
)
|
||||||
ctx.expectP(0, 0.8)
|
ctx.expectP(0, testAprioriHopProbability)
|
||||||
|
|
||||||
// Report another failure for the same channel. We expect it to be
|
// Report another failure for the same channel. We expect it to be
|
||||||
// pruned.
|
// pruned.
|
||||||
|
Loading…
Reference in New Issue
Block a user