Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routerrpc: add queryprob rpc #3556

Merged
merged 5 commits into from
Oct 31, 2019

Conversation

joostjager
Copy link
Contributor

@joostjager joostjager commented Sep 30, 2019

In #3462, we removed probability reporting for querymc. This PR brings it back as a separate rpc for which a specific amount needs to be given.

In addition to the probability, it also returns the raw data for the requested pair. An example use case for this is to get a sense for the freshness of a pair and use this to decide whether to do a prepay probe for a route.

@joostjager joostjager force-pushed the query-mc-prob branch 2 times, most recently from b1e9859 to 9ec1007 Compare September 30, 2019 18:56
@Roasbeef Roasbeef added enhancement Improvements to existing features / behaviour mission control rpc Related to the RPC interface labels Oct 3, 2019
@joostjager joostjager force-pushed the query-mc-prob branch 4 times, most recently from 2ea9411 to 8644ceb Compare October 24, 2019 11:53
@joostjager joostjager self-assigned this Oct 24, 2019
@joostjager joostjager added this to the 0.9.0 milestone Oct 24, 2019
Copy link
Collaborator

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a few small nits about naming but overall a pretty straightforward.

cmd/lncli/cmd_query_mc_probability.go Outdated Show resolved Hide resolved
cmd/lncli/cmd_query_mc_probability.go Outdated Show resolved Hide resolved
@@ -125,7 +125,24 @@ type timedPairResult struct {
// timestamp is the time when this result was obtained.
timestamp time.Time

pairResult
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that these field are replicated both here and in pairResult, can this struct type be removed now?

}

if !data.Timestamp.IsZero() {
rpcData.Timestamp = data.Timestamp.Unix()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't do Unix() also when zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a very negative number. The beginning of time.Time is far before 1970.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch, TIL

cmd/lncli/cmd_query_mc_probability.go Outdated Show resolved Hide resolved
double probability = 1 [json_name = "probability"];

/// The historical data for the requested pair.
PairData history = 2 [json_name = "history"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the reason for PairData to reuse it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

This prepares for decoupling the result interpretation of a single
payment attempt from the information stored in mission control memory
on the history of a node pair. A planned follow-up where we store both
the last success and last failure requires this decoupling.
Prepares for this data structure being accessed in mission control rpc
implementations.
With a separate proto message, it becomes possible to also return the
pair data for a single pair. This prepares for the new mc probability
querying rpc.
Probabilities are no longer returned for querymc calls. To still provide
some insight into the mission control internals, this commit adds a new
rpc that calculates a success probability estimate for a specific node
pair and amount.
Copy link
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty straightforward diff, only exposing state that already exists within MC. LGTM 🎅

@joostjager joostjager changed the title routerrpc: add querymcprob rpc routerrpc: add queryprob rpc Oct 29, 2019
Copy link
Collaborator

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, adding approval post new changes being pushed to see whether my grey tick changes, but I don't think my review will count towards approvals: "At least 2 approving reviews are required by reviewers with write access".

@joostjager joostjager merged commit fcf81ed into lightningnetwork:master Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features / behaviour mission control rpc Related to the RPC interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants