routing: persist mission control data
This commit is contained in:
14 files changed
+566
-28
No files matched your search
@@ -24,4 +24,8 @@ type RoutingConfig struct {
|
||||
// executing a payment attempt that fails. It is used to trade off
|
||||
// potentially better routes against their probability of succeeding.
|
||||
AttemptCost btcutil.Amount `long:"attemptcost" description:"The (virtual) cost in sats of a failed payment attempt"`
|
||||
|
||||
// MaxMcHistory defines the maximum number of payment results that
|
||||
// are held on disk by mission control.
|
||||
MaxMcHistory int `long:"maxmchistory" description:"the maximum number of payment results that are held on disk by mission control"`
|
||||
}
|
||||
@@ -49,6 +49,7 @@ func DefaultConfig() *Config {
|
||||
PenaltyHalfLife: routing.DefaultPenaltyHalfLife,
|
||||
AttemptCost: routing.DefaultPaymentAttemptPenalty.
|
||||
ToSatoshis(),
|
||||
MaxMcHistory: routing.DefaultMaxMcHistory,
|
||||
}
|
||||
|
||||
return &Config{
|
||||
@@ -63,5 +64,6 @@ func GetRoutingConfig(cfg *Config) *RoutingConfig {
|
||||
MinRouteProbability: cfg.MinRouteProbability,
|
||||
AttemptCost: cfg.AttemptCost,
|
||||
PenaltyHalfLife: cfg.PenaltyHalfLife,
|
||||
MaxMcHistory: cfg.MaxMcHistory,
|
||||
}
|
||||
}
|
||||
@@ -22,5 +22,6 @@ func GetRoutingConfig(cfg *Config) *RoutingConfig {
|
||||
AttemptCost: routing.DefaultPaymentAttemptPenalty.
|
||||
ToSatoshis(),
|
||||
PenaltyHalfLife: routing.DefaultPenaltyHalfLife,
|
||||
MaxMcHistory: routing.DefaultMaxMcHistory,
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ type MissionControl interface {
|
||||
|
||||
// ResetHistory resets the history of MissionControl returning it to a state as
|
||||
// if no payment attempts have been made.
|
||||
ResetHistory()
|
||||
ResetHistory() error
|
||||
|
||||
// GetHistorySnapshot takes a snapshot from the current mission control state
|
||||
// and actual probability estimates.
|
||||
|
||||
@@ -147,7 +147,9 @@ func (m *mockMissionControl) GetEdgeProbability(fromNode route.Vertex,
|
||||
return testMissionControlProb
|
||||
}
|
||||
|
||||
func (m *mockMissionControl) ResetHistory() {}
|
||||
func (m *mockMissionControl) ResetHistory() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockMissionControl) GetHistorySnapshot() *routing.MissionControlSnapshot {
|
||||
return nil
|
||||
|
||||
@@ -436,7 +436,10 @@ func marshallChannelUpdate(update *lnwire.ChannelUpdate) *ChannelUpdate {
|
||||
func (s *Server) ResetMissionControl(ctx context.Context,
|
||||
req *ResetMissionControlRequest) (*ResetMissionControlResponse, error) {
|
||||
|
||||
s.cfg.RouterBackend.MissionControl.ResetHistory()
|
||||
err := s.cfg.RouterBackend.MissionControl.ResetHistory()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &ResetMissionControlResponse{}, nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user