-
Notifications
You must be signed in to change notification settings - Fork 912
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
add max_total_htlc_out to listpeerchannels #7193
base: master
Are you sure you want to change the base?
Conversation
181d591
to
44dd453
Compare
a9fd4c2
to
fae9328
Compare
fae9328
to
6e05ed4
Compare
fbd7ec6
to
f5c08b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise
f5c08b9
to
1f6d416
Compare
I noticed that to make this PR complete. I should also include this field in the |
1f6d416
to
891a176
Compare
Generally exposing these calculated values has proven to be a mistake. We should expose the peers' max_htlc_value_in_flight_msat ( |
There is already one field
|
f77f0d2
to
5498491
Compare
Unfortunately, deprecate the old name (we usually give these things a year), and use the BOLT name. Sorry you stepped in this! |
5498491
to
436d847
Compare
All right. Now |
436d847
to
e017937
Compare
Rebased. |
e017937
to
80013e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something about the description text is off, but i'm not sure which it is.
@@ -155,7 +162,7 @@ gossmods_from_listpeerchannels_(const tal_t *ctx, | |||
/* We add both directions */ | |||
cb(mods, self, &dst, &scidd, capacity_msat, | |||
htlc_min[LOCAL], htlc_max[LOCAL], | |||
spendable, fee_base[LOCAL], fee_proportional[LOCAL], | |||
spendable, max_total_out_htlc, fee_base[LOCAL], fee_proportional[LOCAL], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm my understanding: max_total_out_htlc
is the total amount that we can receive, so it gets added as the total max on the local receiving channel; max_total_in_htlc
is the total amount we can send, so it gets added to the REMOTE
set.
maybe renaming these would make this clearer? max_total_out
seems to imply amount we can receive and vice versa for total_in
lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rustyrussell: help!
From the spec BOLT02:
A sending node:
- if the total value of offered HTLCs would exceed the remote's `max_htlc_value_in_flight_msat`:
- MUST NOT add an HTLC.
A receiving node:
- if a sending node adds more than receiver `max_value_in_flight_msat` worth of offered HTLCs to its local commitment transaction:
- SHOULD send a `warning` and close the connection, or send an `error` and fail the channel.
My interpretation is that our_max_value_in_flight_msat
limits how much can we receive, and their_max_value_in_flight_max
limits how much can we send.
@@ -109,6 +114,8 @@ gossmods_from_listpeerchannels_(const tal_t *ctx, | |||
JSON_SCAN(json_to_int, &scidd.dir), | |||
JSON_SCAN(json_to_msat, &spendable), | |||
JSON_SCAN(json_to_msat, &receivable), | |||
JSON_SCAN(json_to_msat, &max_total_in_htlc), | |||
JSON_SCAN(json_to_msat, &max_total_out_htlc), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how often does this get updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The max_htlc_value_in_flight
pair is fixed for the entire lifetime of the channel.
The gossmod_from_listpeerchannels
is called to parse the response from listpeerchannels
.
In askrene
or renepay
this is expected to happen once per rpc call.
@@ -23999,7 +23999,25 @@ | |||
"max_total_htlc_in_msat": { | |||
"type": "msat", | |||
"description": [ | |||
"Max amount accept in a single payment." | |||
"Max amount accept in a single payment. This field is deprecated, use instead our_max_htlc_value_in_flight_msat" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this commit should be squashed into the commit where these fields are originally introduced/added to the RPC (the first one in the series, in this case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's complicated. These are autogenerated, if you ask me I wouldn't have these files into the source code cause no human wrote them. I add them as a separate commit to make it easier to rebase on the master branch in case someone else has also modified them.
My usual rebase when changing schemas is
- soft reset the last commit (with the autogenerated files, very annoying),
- rebase
- then generate those files again and commit
"type": "msat", | ||
"added": "v24.11", | ||
"description": [ | ||
"Cap on total value of outstanding HTLCs offered by the remote node. This limits the total amount in flight we can send through this channel." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion to make this more readable: cap on total value of outstanding HTLCs offered to the remote node (from our balance).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though now that i've written these out, i feel like the their
part of the max htlc value in flight name is confusing, since it's our balance that's in flight? something about this seems wrong. Either the modifier "this limits the total amount in flight we can send" is wrong or their max in flight
is incorrect?
we can't add more HTLCs to be sent to the peer, because they don't want to let X% of their balance be committed as HTLCs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is weird. It is like our_max_value...
is telling the peer "please don't try to send me more than this
or I will not accept it". The prefix their_
and our_
refers to who set the configuration value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description is a sentence taken from BOLT02.
"type": "msat", | ||
"added": "v24.11", | ||
"description": [ | ||
"Cap on total value of outstanding HTLCs offered by the local node. This limits the total amount in flight we can receive through this channel." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion to make this more readable: cap on total value of outstanding HTLCs offered to the local node (from peer's balance).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this also work?
our_max_htlc_value_in_flight_msat
: Cap on total value of outstanding HTLCs we accept from the remote node.
Changelog-Added: JSON-RPC: `listpeerchannels` new output fields `their_max_total_htlc_out_msat` and `our_max_total_htlc_out_msat` as the value of `max_htlc_value_in_flight` (as of BOLT02) set by the local and remote nodes on channel creation. Changelog-Deprecated: JSON-RPC: `listpeerchannels` value `max_total_htlc_in_msat`: use `our_max_total_htlc_out_msat` instead to follow spec naming convention.
The parameter max_htlc_value_in_flight_msat stablished by peers on channel opening (BOLT02) can now be retrived from the gossmods_from_listpeerchannels API. Adapted the corresponding callback functions in renepay and askrene to take into account that value as a constraint to the value we can send through a channel. Changelog-Add: fetch max_htlc_value_in_flight_msat from gossmods_listpeerchannels API Signed-off-by: Lagrang3 <[email protected]>
Changelog-None Signed-off-by: Lagrang3 <[email protected]>
80013e7
to
ed35ad8
Compare
CI is failing on
I don't know what else, besides changing the schema, needs to be done to add new fields to RPC commands. |
Add to
listpeerchannels
a couple of fieldstheir_max_total_htlc_out_msat
andour_max_total_htlc_out_msat
, the channel open configuration value specifiedin BOLT02 that limits the exposure to HTLCs.
This field is relevant to
renepay
andaskrene
as discussed in #7159 (comment), since the payment plugin needs to know how much can be sent at a time through each local channel, besidesspendable_msat
.