setchannel: add minhtlc

Suggested by @m-schmook, I realized that if we append it later I'll
never get it right: I expect parameters min and max, not max and min!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: you can now alter the `htlc_minimum_msat` and `htlc_maximum_msat` your node advertizes.
This commit is contained in:
Rusty Russell
2022-03-21 11:28:54 +10:30
parent f29890ed66
commit 999c734bb5
20 changed files with 186 additions and 43 deletions

View File

@@ -87,6 +87,7 @@ On success, an object containing **peers** is returned. It is an array of objec
- **spendable_msat** (msat, optional): total we could send through channel
- **receivable_msat** (msat, optional): total peer could send through channel
- **minimum_htlc_in_msat** (msat, optional): the minimum amount HTLC we accept
- **minimum_htlc_out_msat** (msat, optional): the minimum amount HTLC we will send
- **maximum_htlc_out_msat** (msat, optional): the maximum amount HTLC we will send
- **their_to_self_delay** (u32, optional): the number of blocks before they can take their funds if they unilateral close
- **our_to_self_delay** (u32, optional): the number of blocks before we can take our funds if we unilateral close
@@ -379,4 +380,4 @@ Main web site: <https://github.com/ElementsProject/lightning> Lightning
RFC site (BOLT \#9):
<https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md>
[comment]: # ( SHA256STAMP:8e30caf48aed46acc7c053a355867dc8b8624035dba4ea7668d30d86b8d827cd)
[comment]: # ( SHA256STAMP:147b7008c8f4acb031df625e0731614339a75ee5861cb9f40cd542b1017e3660)

View File

@@ -1,20 +1,24 @@
lightning-setchannel -- Command for configuring fees / maximum htlc on a lightning channel
lightning-setchannel -- Command for configuring fees / htlc range advertized for a channel
===========================================================================================
SYNOPSIS
--------
**setchannel** *id* [*feebase*] [*feeppm*] [*htlcmax*] [*enforcedelay*]
**setchannel** *id* [*feebase*] [*feeppm*] [*htlcmin*] [*htlcmax*] [*enforcedelay*]
DESCRIPTION
-----------
The **setchannel** RPC command sets channel specific routing fees, and
`htlc_maximum_msat` as defined in BOLT \#7. The channel has to be in
`htlc_minimum_msat` or `htlc_maximum_msat` as defined in BOLT \#7. The channel has to be in
normal or awaiting state. This can be checked by **listpeers**
reporting a *state* of CHANNELD\_NORMAL or CHANNELD\_AWAITING\_LOCKIN
for the channel.
These changes (for a public channel) will be broadcast to the rest of
the network (though many nodes limit the rate of such changes they
will accept: we allow 2 a day, with a few extra occasionally).
*id* is required and should contain a scid (short channel ID), channel
id or peerid (pubkey) of the channel to be modified. If *id* is set to
"all", the updates are applied to all channels in states
@@ -31,6 +35,13 @@ to any routed payment volume in satoshi. For example, if ppm is 1,000
and 1,000,000 satoshi is being routed through the channel, an
proportional fee of 1,000 satoshi is added, resulting in a 0.1% fee.
*htlcmin* is an optional value that limits how small an HTLC we will
send: if omitted, it is unchanged (the default is no lower limit). It
can be a whole number, or a whole number ending in *msat* or *sat*, or
a number with three decimal places ending in *sat*, or a number with 1
to 11 decimal places ending in *btc*. The peer also enforces a
minimum for the channel: setting it below will be ignored.
*htlcmax* is an optional value that limits how large an HTLC we will
send: if omitted, it is unchanged (the default is no effective
limit). It can be a whole number, or a whole number ending in *msat*
@@ -55,8 +66,11 @@ On success, an object containing **channels** is returned. It is an array of ob
- **channel_id** (hex): The channel_id of the channel (always 64 characters)
- **fee_base_msat** (msat): The resulting feebase (this is the BOLT #7 name)
- **fee_proportional_millionths** (u32): The resulting feeppm (this is the BOLT #7 name)
- **minimum_htlc_out_msat** (msat): The resulting htlcmin we will advertize (the BOLT #7 name is htlc_minimum_msat)
- **maximum_htlc_out_msat** (msat): The resulting htlcmax we will advertize (the BOLT #7 name is htlc_maximum_msat)
- **short_channel_id** (short_channel_id, optional): the short_channel_id (if locked in)
- the following warnings are possible:
- **warning_htlcmin_too_low**: The requested htlcmin was too low for this peer, so we set it to the minimum they will allow
[comment]: # (GENERATE-FROM-SCHEMA-END)
@@ -86,4 +100,4 @@ RESOURCES
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:25c6733af784e8a21a8eed4bcb0f12767ae49d16fe623187ae5313b5bb5cdd80)
[comment]: # ( SHA256STAMP:0f153e7dddce61bc921b3743472f11316c5984b9b1459cac1b201d6f51ec1be1)

View File

@@ -418,6 +418,10 @@
"type": "msat",
"description": "the minimum amount HTLC we accept"
},
"minimum_htlc_out_msat": {
"type": "msat",
"description": "the minimum amount HTLC we will send"
},
"maximum_htlc_out_msat": {
"type": "msat",
"description": "the maximum amount HTLC we will send"
@@ -776,6 +780,7 @@
"spendable_msat": {},
"receivable_msat": {},
"minimum_htlc_in_msat": {},
"minimum_htlc_out_msat": {},
"maximum_htlc_out_msat": {},
"spendable_msatoshi": {},
"receivable_msatoshi": {},
@@ -864,6 +869,7 @@
"spendable_msat": {},
"receivable_msat": {},
"minimum_htlc_in_msat": {},
"minimum_htlc_out_msat": {},
"maximum_htlc_out_msat": {},
"spendable_msatoshi": {},
"receivable_msatoshi": {},
@@ -953,6 +959,7 @@
"spendable_msat": {},
"receivable_msat": {},
"minimum_htlc_in_msat": {},
"minimum_htlc_out_msat": {},
"maximum_htlc_out_msat": {},
"spendable_msatoshi": {},
"receivable_msatoshi": {},
@@ -1041,6 +1048,7 @@
"spendable_msat": {},
"receivable_msat": {},
"minimum_htlc_in_msat": {},
"minimum_htlc_out_msat": {},
"maximum_htlc_out_msat": {},
"spendable_msatoshi": {},
"receivable_msatoshi": {},

View File

@@ -17,6 +17,7 @@
"channel_id",
"fee_base_msat",
"fee_proportional_millionths",
"minimum_htlc_out_msat",
"maximum_htlc_out_msat"
],
"properties": {
@@ -42,6 +43,14 @@
"type": "u32",
"description": "The resulting feeppm (this is the BOLT #7 name)"
},
"minimum_htlc_out_msat": {
"type": "msat",
"description": "The resulting htlcmin we will advertize (the BOLT #7 name is htlc_minimum_msat)"
},
"warning_htlcmin_too_low": {
"type": "string",
"description": "The requested htlcmin was too low for this peer, so we set it to the minimum they will allow"
},
"maximum_htlc_out_msat": {
"type": "msat",
"description": "The resulting htlcmax we will advertize (the BOLT #7 name is htlc_maximum_msat)"