Skip to content

Commit

Permalink
lightningd: remove various deprecated JSON fields.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
Changelog-Removed: JSON-RPC: removed `listtransactions` `outputs` `satoshis` field (deprecated v0.10.1)
Changelog-Removed: JSON-RPC: removed `listpeers` `channels` deprecated fields (deprecated v0.10.1)
Changelog-Removed: JSON-RPC: removed `listpeers` `channels` `closer` now omitted, rather than `null` (deprecated v0.10.1)
  • Loading branch information
rustyrussell committed May 17, 2022
1 parent 733ab2e commit ffa6e0d
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 61 deletions.
1 change: 1 addition & 0 deletions cln-grpc/proto/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ message ListpeersPeersChannels {
optional bytes close_to = 14;
optional bool private = 15;
ChannelSide opener = 16;
optional ChannelSide closer = 17;
repeated string features = 18;
optional Amount to_us_msat = 20;
optional Amount min_to_us_msat = 21;
Expand Down
1 change: 1 addition & 0 deletions cln-grpc/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ impl From<&responses::ListpeersPeersChannels> for pb::ListpeersPeersChannels {
close_to: c.close_to.as_ref().map(|v| hex::decode(&v).unwrap()), // Rule #2 for type hex?
private: c.private.clone(), // Rule #2 for type boolean?
opener: c.opener as i32,
closer: c.closer.map(|v| v as i32),
features: c.features.iter().map(|i| i.into()).collect(), // Rule #3 for type ListpeersPeersChannelsFeatures
to_us_msat: c.to_us_msat.map(|f| f.into()), // Rule #2 for type msat?
min_to_us_msat: c.min_to_us_msat.map(|f| f.into()), // Rule #2 for type msat?
Expand Down
2 changes: 2 additions & 0 deletions cln-rpc/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,8 @@ pub mod responses {
// Path `ListPeers.peers[].channels[].opener`
#[serde(rename = "opener")]
pub opener: ChannelSide,
#[serde(skip_serializing_if = "Option::is_none")]
pub closer: Option<ChannelSide>,
#[serde(alias = "features")]
pub features: Vec<String>,
#[serde(alias = "to_us_msat", skip_serializing_if = "Option::is_none")]
Expand Down
4 changes: 2 additions & 2 deletions doc/lightning-listpeers.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ On success, an object containing **peers** is returned. It is an array of objec
- **scratch_txid** (txid): The commitment transaction txid we would use if we went onchain now
- **close_to** (hex, optional): scriptPubkey which we have to close to if we mutual close
- **private** (boolean, optional): if False, we will not announce this channel
- **closer** (string, optional): Who initiated the channel close (`null` is deprecated!) (one of "local", "remote", *null*)
- **closer** (string, optional): Who initiated the channel close (one of "local", "remote")
- **funding** (object, optional):
- **local_msat** (msat): Amount of channel we funded
- **remote_msat** (msat): Amount of channel they funded
Expand Down Expand Up @@ -380,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:6b0ec5c899c8685487190209f594635030205a275e1dc6d61a7b057adbf66192)
[comment]: # ( SHA256STAMP:4f76b5ac19d3dfdaf3d04f5dd5de2312a2ab0ccffe779508c416aaf6e644612a)
2 changes: 1 addition & 1 deletion doc/lightning-listtransactions.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ RESOURCES
---------

Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:ba0624377601e6e90c2ca90b709fd076f3ed0f2b813f73553ec6b935eeec54a1)
[comment]: # ( SHA256STAMP:bd9c33dd27be0f25b0212b4115714768ffbec2ff6e72f083613a4464a3f98bc0)
32 changes: 3 additions & 29 deletions doc/schemas/listpeers.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,12 @@
"description": "Who initiated the channel"
},
"closer": {
"FIXME": "deprecated_apis turns off null!",
"type": [
"string",
"null"
],
"type": "string",
"enum": [
"local",
"remote",
null
"remote"
],
"description": "Who initiated the channel close (`null` is deprecated!)"
"description": "Who initiated the channel close"
},
"features": {
"type": "array",
Expand Down Expand Up @@ -360,12 +355,6 @@
}
}
},
"funding_allocation_msat": {
"deprecated": true
},
"funding_msat": {
"deprecated": true
},
"to_us_msat": {
"type": "msat",
"description": "how much of channel is owed to us"
Expand Down Expand Up @@ -765,8 +754,6 @@
"closer": {},
"features": {},
"funding": {},
"funding_allocation_msat": {},
"funding_msat": {},
"to_us_msat": {},
"min_to_us_msat": {},
"max_to_us_msat": {},
Expand Down Expand Up @@ -817,7 +804,6 @@
"last_feerate": {},
"next_feerate": {},
"inflight": {},
"last_tx_fee": {},
"last_tx_fee_msat": {},
"direction": {},
"close_to_addr": {
Expand Down Expand Up @@ -854,8 +840,6 @@
"closer": {},
"features": {},
"funding": {},
"funding_allocation_msat": {},
"funding_msat": {},
"to_us_msat": {},
"min_to_us_msat": {},
"max_to_us_msat": {},
Expand Down Expand Up @@ -907,9 +891,6 @@
"next_feerate": {},
"close_to_addr": {},
"direction": {},
"last_tx_fee": {
"deprecated": true
},
"last_tx_fee_msat": {
"type": "msat",
"description": "fee attached to this the current tx"
Expand Down Expand Up @@ -944,8 +925,6 @@
"closer": {},
"features": {},
"funding": {},
"funding_allocation_msat": {},
"funding_msat": {},
"to_us_msat": {},
"min_to_us_msat": {},
"max_to_us_msat": {},
Expand Down Expand Up @@ -995,7 +974,6 @@
"initial_feerate": {},
"last_feerate": {},
"next_feerate": {},
"last_tx_fee": {},
"close_to_addr": {},
"last_tx_fee_msat": {},
"direction": {
Expand Down Expand Up @@ -1033,8 +1011,6 @@
"closer": {},
"features": {},
"funding": {},
"funding_allocation_msat": {},
"funding_msat": {},
"to_us_msat": {},
"min_to_us_msat": {},
"max_to_us_msat": {},
Expand Down Expand Up @@ -1082,7 +1058,6 @@
"out_msatoshi_fulfilled": {},
"htlcs": {},
"inflight": {},
"last_tx_fee": {},
"close_to_addr": {},
"direction": {},
"last_tx_fee_msat": {},
Expand Down Expand Up @@ -1129,7 +1104,6 @@
"connected": {},
"htlcs": {},
"log": {},
"last_tx_fee": {},
"netaddr": {
"type": "array",
"minItems": 1,
Expand Down
3 changes: 0 additions & 3 deletions doc/schemas/listtransactions.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@
"type": "u32",
"description": "the 0-based output number"
},
"satoshis": {
"deprecated": true
},
"msat": {
"type": "msat",
"description": "the amount of the output"
Expand Down
24 changes: 0 additions & 24 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ static void json_add_channel(struct lightningd *ld,
struct channel_stats channel_stats;
struct amount_msat funding_msat, peer_msats, our_msats;
struct amount_sat peer_funded_sats;
struct peer *p = channel->peer;
struct state_change_entry *state_changes;
u32 feerate;

Expand All @@ -639,9 +638,6 @@ static void json_add_channel(struct lightningd *ld,
bitcoin_txid(channel->last_tx, &txid);

json_add_txid(response, "scratch_txid", &txid);
if (deprecated_apis)
json_add_amount_sat_only(response, "last_tx_fee",
bitcoin_tx_compute_fee(channel->last_tx));
json_add_amount_sat_only(response, "last_tx_fee_msat",
bitcoin_tx_compute_fee(channel->last_tx));
}
Expand Down Expand Up @@ -746,8 +742,6 @@ static void json_add_channel(struct lightningd *ld,
if (channel->closer != NUM_SIDES)
json_add_string(response, "closer", channel->closer == LOCAL ?
"local" : "remote");
else if (deprecated_apis)
json_add_null(response, "closer");

json_array_start(response, "features");
if (channel_has(channel, OPT_STATIC_REMOTEKEY))
Expand Down Expand Up @@ -781,24 +775,6 @@ static void json_add_channel(struct lightningd *ld,
our_msats = AMOUNT_MSAT(0);
}

if (deprecated_apis) {
json_object_start(response, "funding_allocation_msat");
json_add_u64(response, node_id_to_hexstr(tmpctx, &p->id),
peer_msats.millisatoshis); /* Raw: JSON field */
json_add_u64(response, node_id_to_hexstr(tmpctx, &ld->id),
our_msats.millisatoshis); /* Raw: JSON field */
json_object_end(response);

json_object_start(response, "funding_msat");
json_add_sat_only(response,
node_id_to_hexstr(tmpctx, &p->id),
peer_funded_sats);
json_add_sat_only(response,
node_id_to_hexstr(tmpctx, &ld->id),
channel->our_funds);
json_object_end(response);
}

json_object_start(response, "funding");
json_add_sat_only(response, "local_msat", channel->our_funds);
json_add_sat_only(response, "remote_msat", peer_funded_sats);
Expand Down
2 changes: 0 additions & 2 deletions wallet/walletrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,6 @@ static void json_transaction_details(struct json_stream *response,
json_object_start(response, NULL);

json_add_u32(response, "index", i);
if (deprecated_apis)
json_add_amount_sat_only(response, "satoshis", sat);
json_add_amount_sat_only(response, "msat", sat);

#if EXPERIMENTAL_FEATURES
Expand Down

0 comments on commit ffa6e0d

Please sign in to comment.