add max_total_htlc_out to listpeerchannels - #7193
Conversation
181d591 to
44dd453
Compare
a9fd4c2 to
fae9328
Compare
fae9328 to
6e05ed4
Compare
fbd7ec6 to
f5c08b9
Compare
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
niftynei
left a comment
There was a problem hiding this comment.
something about the description text is off, but i'm not sure which it is.
| 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.
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.
@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.
| 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.
how often does this get updated?
There was a problem hiding this comment.
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.
| "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.
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.
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.
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.
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.
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.
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.
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.
Could this also work?
our_max_htlc_value_in_flight_msat: Cap on total value of outstanding HTLCs we accept from the remote node.
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. |
|
OK, rebasing now. I actually did the deprecation, too:
|
ed35ad8 to
6b7a91e
Compare
05e3230 to
a01f8f5
Compare
a01f8f5 to
1820423
Compare
|
Damn, I accidentally pushed master to this branch. Now it's closed, and I can't re-push. Opening a new one :( |
Add to
listpeerchannelsa couple of fieldstheir_max_total_htlc_out_msatandour_max_total_htlc_out_msat, the channel open configuration value specifiedin BOLT02 that limits the exposure to HTLCs.
This field is relevant to
renepayandaskreneas 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.