Skip to content

routing: track amt ranges in mission control#3493

Merged
joostjager merged 2 commits intolightningnetwork:masterfrom
joostjager:small-successes
Nov 22, 2019
Merged

routing: track amt ranges in mission control#3493
joostjager merged 2 commits intolightningnetwork:masterfrom
joostjager:small-successes

Conversation

@joostjager
Copy link
Contributor

@joostjager joostjager commented Sep 12, 2019

Previously we tracked the last result for a node connection only. This could lead to the situation where a meaningful observation would be overwritten by a far less meaningful one. For example: a failure for 100.000 sats is overwritten by a success for 100 sats.

Besides better route selection in general, this also helps with building the bos node score list.

Probing with minimal amounts in particular will likely wipe out useful history for more representative amounts.

This PR changes mission control to track both that the success and the last failure. This creates three amount ranges for which probabilities are calculated differently:

  • <=successAmt: return a high probability (default 0.95)
  • successAmt+1 to failAmt-1: in this range, we don't have much information. Return the a priori (default 0.6)
  • >=failAmt: penalize the connection and decay over time back to the a priori

@joostjager joostjager added incomplete WIP PR, not fully finalized, but light review possible blocked labels Sep 12, 2019
@joostjager joostjager force-pushed the small-successes branch 6 times, most recently from 883f699 to 6846bc7 Compare September 26, 2019 15:06
@joostjager joostjager changed the title routing: track amt ranges in mission control [don't review] routing: track amt ranges in mission control Sep 26, 2019
@joostjager joostjager force-pushed the small-successes branch 2 times, most recently from fca612e to a39b10d Compare September 27, 2019 10:35
@joostjager joostjager requested a review from halseth September 27, 2019 10:36
@joostjager joostjager force-pushed the small-successes branch 2 times, most recently from d138b83 to 33c1eaf Compare September 30, 2019 08:33
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't SuccessTIme be used here,, similar to how FailTIme.IsZero is checked below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The condition can actually be removed. If there is no success recorded (or pushed down by an amt independent failure), successAmt will be zero and amt is always greater than zero.

@joostjager joostjager force-pushed the small-successes branch 3 times, most recently from 3532f2c to 370c5fc Compare September 30, 2019 18:57
@joostjager joostjager requested a review from halseth September 30, 2019 18:58
@joostjager joostjager removed the incomplete WIP PR, not fully finalized, but light review possible label Sep 30, 2019
@joostjager joostjager added this to the 0.9 milestone Oct 8, 2019
@Roasbeef Roasbeef requested a review from carlaKC October 23, 2019 00:20
@Roasbeef
Copy link
Member

Can be rebased now that the dependent PR is merged.

@joostjager joostjager self-assigned this Oct 23, 2019
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this the amount that most recently failed, as in attempted to be forwarded= failed? Not clear from the comment what this represents, but I'm lacking a bit of context on this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean with 'attempted to be forwarded= failed'. But this is (usually) the amount of the last failure.

Comments fixed to explain this better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, now seeing that this refers to the first commit. Removed the "(attempted to be)" part. It may not be that helpful, because there is also a success boolean in this struct.

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: does this need a newline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which newline exactly do you mean?

Copy link
Collaborator

Choose a reason for hiding this comment

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

All the params can fit on one line within 80 char limit
m.setLastPairResult(pair.From, pair.To, result.timeReply, &pairResult)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also with our standard tab size 8?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there an argument that scaling down the success amount makes sense, since larger success amounts may deplete the outgoing capacity on a channel? As is, a single large payment "vouches" for all amounts below it succeeding, even though we may not necessarily be seeing payments of this magnitude.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Imo we should stay away from that kind of inference. There may be private channels that shadow a single public channel, which interferes with assumptions of that kind.

@joostjager joostjager added mission control payments Related to invoices/payments routing and removed blocked labels Oct 31, 2019
@joostjager joostjager force-pushed the small-successes branch 2 times, most recently from b63db30 to f897cd5 Compare November 19, 2019 14:05
@joostjager joostjager requested a review from carlaKC November 19, 2019 14:05
@joostjager joostjager force-pushed the small-successes branch 2 times, most recently from 617d59b to 6f76da1 Compare November 19, 2019 14:44
@joostjager joostjager requested a review from carlaKC November 20, 2019 13:42
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.

Happy with the logic as is, but I think it's worth adding a comment on TimedPairResult's SuccessTime to explicitly indicate that it is not necessarily matched with the SuccessAmount.

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.

Mostly some questions and nits, nothing really blocking. Agree that adding some comments to TimedPairResult would be useful. Good PR :)

@joostjager joostjager force-pushed the small-successes branch 2 times, most recently from 9212050 to e4b5b16 Compare November 21, 2019 09:48
@joostjager joostjager requested a review from halseth November 21, 2019 09:55
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.

LGTM 💯

@joostjager joostjager merged commit 43d2e75 into lightningnetwork:master Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mission control payments Related to invoices/payments routing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants