Skip to content

Commit

Permalink
lightningd: don't make htlc_timeout_satoshis/htlc_success_satoshis ze…
Browse files Browse the repository at this point in the history
…ro if we support anchors.

It depends on whether we negotiated anchors: just document that this
field doesn't apply for anchors (it becomes zero by the end of this
patch series, which is weird).

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jun 29, 2023
1 parent 47fd31e commit e47e51e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
6 changes: 3 additions & 3 deletions doc/lightning-feerates.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ On success, an object is returned, containing:
- **opening\_channel\_satoshis** (u64): Estimated cost of typical channel open
- **mutual\_close\_satoshis** (u64): Estimated cost of typical channel close
- **unilateral\_close\_satoshis** (u64): Estimated cost of typical (non-anchor) unilateral close (without HTLCs)
- **htlc\_timeout\_satoshis** (u64): Estimated cost of typical HTLC timeout transaction
- **htlc\_success\_satoshis** (u64): Estimated cost of typical HTLC fulfillment transaction
- **htlc\_timeout\_satoshis** (u64): Estimated cost of typical HTLC timeout transaction (non-anchors)
- **htlc\_success\_satoshis** (u64): Estimated cost of typical HTLC fulfillment transaction (non-anchors)

The following warnings may also be returned:

Expand Down Expand Up @@ -141,4 +141,4 @@ RESOURCES

Main web site: <https://github.com/ElementsProject/lightning>

[comment]: # ( SHA256STAMP:4921275aec48da8b9ddcba5d4237efa72f06b6e005008f2c3aa7029d3bd187fd)
[comment]: # ( SHA256STAMP:195f8f4cc16197a62269ca1cda77e9d8788ff0c0c49a9d9d45067f6a578c22fd)
4 changes: 2 additions & 2 deletions doc/schemas/feerates.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@
},
"htlc_timeout_satoshis": {
"type": "u64",
"description": "Estimated cost of typical HTLC timeout transaction"
"description": "Estimated cost of typical HTLC timeout transaction (non-anchors)"
},
"htlc_success_satoshis": {
"type": "u64",
"description": "Estimated cost of typical HTLC fulfillment transaction"
"description": "Estimated cost of typical HTLC fulfillment transaction (non-anchors)"
}
}
}
Expand Down
11 changes: 2 additions & 9 deletions lightningd/chaintopology.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,11 +701,6 @@ static struct command_result *json_feerates(struct command *cmd,
json_object_end(response);

if (!missing) {
/* It actually is negotiated per-channel... */
bool anchor_outputs
= feature_offered(cmd->ld->our_features->bits[INIT_FEATURE],
OPT_ANCHOR_OUTPUTS);

json_object_start(response, "onchain_fee_estimates");
/* eg 020000000001016f51de645a47baa49a636b8ec974c28bdff0ac9151c0f4eda2dbe3b41dbe711d000000001716001401fad90abcd66697e2592164722de4a95ebee165ffffffff0240420f00000000002200205b8cd3b914cf67cdd8fa6273c930353dd36476734fbd962102c2df53b90880cdb73f890000000000160014c2ccab171c2a5be9dab52ec41b825863024c54660248304502210088f65e054dbc2d8f679de3e40150069854863efa4a45103b2bb63d060322f94702200d3ae8923924a458cffb0b7360179790830027bb6b29715ba03e12fc22365de1012103d745445c9362665f22e0d96e9e766f273f3260dea39c8a76bfa05dd2684ddccf00000000 == weight 702 */
json_add_num(response, "opening_channel_satoshis",
Expand All @@ -717,14 +712,12 @@ static struct command_result *json_feerates(struct command *cmd,
json_add_u64(response, "unilateral_close_satoshis",
unilateral_feerate(cmd->ld->topology) * 598 / 1000);

/* This really depends on whether we *negotiated*
* option_anchor_outputs for a particular channel! */
json_add_u64(response, "htlc_timeout_satoshis",
htlc_timeout_fee(htlc_resolution_feerate(cmd->ld->topology),
anchor_outputs).satoshis /* Raw: estimate */);
false).satoshis /* Raw: estimate */);
json_add_u64(response, "htlc_success_satoshis",
htlc_success_fee(htlc_resolution_feerate(cmd->ld->topology),
anchor_outputs).satoshis /* Raw: estimate */);
false).satoshis /* Raw: estimate */);
json_object_end(response);
}

Expand Down

0 comments on commit e47e51e

Please sign in to comment.