Skip to content

Commit

Permalink
multi: query probabilities for blinded paths from new MC namespace
Browse files Browse the repository at this point in the history
Start querying blinded path probabilites from the new MC namespace where
the results of successful blinded path receives will be written to.
  • Loading branch information
ellemouton committed Aug 15, 2024
1 parent 0eb2638 commit 31fbfb3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions routing/missioncontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ const (
// control name space. This is used as the sub-bucket key within the
// top level DB bucket to store mission control results.
DefaultMissionControlNamespace = "default"

// BlindedPathMissionControlNamespace is the name of the mission control
// namespace where results from successful blinded path receives will
// be stored.
BlindedPathMissionControlNamespace = "blinded-paths"
)

var (
Expand Down
11 changes: 9 additions & 2 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5829,6 +5829,14 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
"be included in each path")
}

blindedPathMC, err := r.server.missionController.GetNamespacedStore(
routing.BlindedPathMissionControlNamespace,
)
if err != nil {
return nil, fmt.Errorf("could not initialise mission control "+
"in the blinded paths namespace: %w", err)
}

addInvoiceCfg := &invoicesrpc.AddInvoiceConfig{
AddInvoice: r.server.invoices.AddInvoice,
IsChannelActive: r.server.htlcSwitch.HasActiveLink,
Expand Down Expand Up @@ -5867,8 +5875,7 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
[]*route.Route, error) {

return r.server.chanRouter.FindBlindedPaths(
r.selfNode, amt,
r.server.defaultMC.GetProbability,
r.selfNode, amt, blindedPathMC.GetProbability,
blindingRestrictions,
)
},
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
}

blindedPathMC, err := s.missionController.GetNamespacedStore(
"blinded-path",
routing.BlindedPathMissionControlNamespace,
)
if err != nil {
return nil, fmt.Errorf("can't create mission control in the "+
Expand Down

0 comments on commit 31fbfb3

Please sign in to comment.