From 733ab2e6f07bf23f8a8787cdac998ef510b7b818 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 17 May 2022 10:11:01 +0930 Subject: [PATCH 1/2] connectd: remove enable-autotor-v2-mode option Changelog-Removed: lightningd: removed `enable-autotor-v2-mode` option (deprecated v0.10.1) Signed-off-by: Rusty Russell --- connectd/connectd.c | 4 +--- connectd/connectd.h | 3 --- connectd/connectd_wire.csv | 1 - connectd/tor_autoservice.c | 31 +++++++++++-------------------- connectd/tor_autoservice.h | 3 +-- doc/lightning-listconfigs.7 | 3 +-- doc/lightning-listconfigs.7.md | 1 - lightningd/connect_control.c | 1 - lightningd/lightningd.h | 3 --- lightningd/options.c | 9 --------- lightningd/plugin.c | 2 +- 11 files changed, 15 insertions(+), 46 deletions(-) diff --git a/connectd/connectd.c b/connectd/connectd.c index deb604f45216..e20bf7f7f2ae 100644 --- a/connectd/connectd.c +++ b/connectd/connectd.c @@ -1437,8 +1437,7 @@ setup_listeners(const tal_t *ctx, toraddr = tor_autoservice(tmpctx, &proposed_wireaddr[i], tor_password, - localaddr, - daemon->use_v3_autotor); + localaddr); if (!(proposed_listen_announce[i] & ADDR_ANNOUNCE)) { continue; @@ -1534,7 +1533,6 @@ static void connect_init(struct daemon *daemon, const u8 *msg) &proxyaddr, &daemon->always_use_proxy, &daemon->dev_allow_localhost, &daemon->use_dns, &tor_password, - &daemon->use_v3_autotor, &daemon->timeout_secs, &daemon->websocket_helper, &daemon->websocket_port, diff --git a/connectd/connectd.h b/connectd/connectd.h index f820ca2d1c6b..72161b1220bf 100644 --- a/connectd/connectd.h +++ b/connectd/connectd.h @@ -206,9 +206,6 @@ struct daemon { /* File descriptors to listen on once we're activated. */ const struct listen_fd **listen_fds; - /* Allow to define the default behavior of tor services calls*/ - bool use_v3_autotor; - /* Our features, as lightningd told us */ struct feature_set *our_features; diff --git a/connectd/connectd_wire.csv b/connectd/connectd_wire.csv index 67af1dca055f..91d0fdb6d821 100644 --- a/connectd/connectd_wire.csv +++ b/connectd/connectd_wire.csv @@ -18,7 +18,6 @@ msgdata,connectd_init,use_tor_proxy_always,bool, msgdata,connectd_init,dev_allow_localhost,bool, msgdata,connectd_init,use_dns,bool, msgdata,connectd_init,tor_password,wirestring, -msgdata,connectd_init,use_v3_autotor,bool, msgdata,connectd_init,timeout_secs,u32, msgdata,connectd_init,websocket_helper,wirestring, msgdata,connectd_init,websocket_port,u16, diff --git a/connectd/tor_autoservice.c b/connectd/tor_autoservice.c index a790c8615815..33b6b970f6ab 100644 --- a/connectd/tor_autoservice.c +++ b/connectd/tor_autoservice.c @@ -86,7 +86,6 @@ static void discard_remaining_response(struct rbuf *rbuf) static struct wireaddr *make_onion(const tal_t *ctx, struct rbuf *rbuf, const struct wireaddr *local, - bool use_v3_autotor, u16 port) { char *line; @@ -101,25 +100,18 @@ static struct wireaddr *make_onion(const tal_t *ctx, if (!strstarts(line, "VERSION Tor=")) continue; - if (use_v3_autotor) - if (strstr(line, "\"0.0") || - strstr(line, "\"0.1") || - strstr(line, "\"0.2") || - strstr(line, "\"0.3")) { - use_v3_autotor = false; - status_unusual("Autotor: fallback to try a V2 onion service, your Tor version is smaller than 0.4.x.x"); - } - }; + if (strstr(line, "\"0.0") || + strstr(line, "\"0.1") || + strstr(line, "\"0.2") || + strstr(line, "\"0.3")) { + status_failed(STATUS_FAIL_INTERNAL_ERROR, + "Autotor: your Tor version is smaller than 0.4.x.x"); + } + } - if (!use_v3_autotor) { - tor_send_cmd(rbuf, - tal_fmt(tmpctx, "ADD_ONION NEW:RSA1024 Port=%d,%s Flags=DiscardPK,Detach", - port, fmt_wireaddr(tmpctx, local))); - } else { - tor_send_cmd(rbuf, + tor_send_cmd(rbuf, tal_fmt(tmpctx, "ADD_ONION NEW:ED25519-V3 Port=%d,%s Flags=DiscardPK,Detach", port, fmt_wireaddr(tmpctx, local))); - } while ((line = tor_response_line(rbuf)) != NULL) { const char *name; @@ -268,8 +260,7 @@ static void negotiate_auth(struct rbuf *rbuf, const char *tor_password) struct wireaddr *tor_autoservice(const tal_t *ctx, const struct wireaddr_internal *tor_serviceaddr, const char *tor_password, - const struct wireaddr *laddr, - const bool use_v3_autotor) + const struct wireaddr *laddr) { int fd; struct wireaddr *onion; @@ -290,7 +281,7 @@ struct wireaddr *tor_autoservice(const tal_t *ctx, rbuf_init(&rbuf, fd, buffer, tal_count(buffer), buf_resize); negotiate_auth(&rbuf, tor_password); - onion = make_onion(ctx, &rbuf, laddr, use_v3_autotor, tor_serviceaddr->u.torservice.port); + onion = make_onion(ctx, &rbuf, laddr, tor_serviceaddr->u.torservice.port); /*on the other hand we can stay connected until ln finish to keep onion alive and then vanish */ //because when we run with Detach flag as we now do every start of LN creates a new addr while the old diff --git a/connectd/tor_autoservice.h b/connectd/tor_autoservice.h index 8bdb8bb9d435..dce91a637e49 100644 --- a/connectd/tor_autoservice.h +++ b/connectd/tor_autoservice.h @@ -9,8 +9,7 @@ struct wireaddr *tor_autoservice(const tal_t *ctx, const struct wireaddr_internal *tor_serviceaddr, const char *tor_password, - const struct wireaddr *localaddr, - const bool use_v3_autotor); + const struct wireaddr *localaddr); struct wireaddr *tor_fixed_service(const tal_t *ctx, const struct wireaddr_internal *tor_serviceaddr, diff --git a/doc/lightning-listconfigs.7 b/doc/lightning-listconfigs.7 index e781d0019d63..79e81678371f 100644 --- a/doc/lightning-listconfigs.7 +++ b/doc/lightning-listconfigs.7 @@ -261,7 +261,6 @@ On failure, one of the following error codes may be returned: "autolisten": true, "proxy": "127.0.0.1:9050", "disable-dns": "false", - "enable-autotor-v2-mode": "false", "encrypted-hsm": false, "rpc-file-mode": "0600", "log-level": "DEBUG", @@ -282,4 +281,4 @@ Vincenzo Palazzo \fI wrote the initial versi Main web site: \fIhttps://github.com/ElementsProject/lightning\fR -\" SHA256STAMP:8d8f73010f55f3af6e050c944cf7670109224b3cf3166cc754047f6e20beef20 +\" SHA256STAMP:c55d5a93c5917bbab0be1633f0f9f06196cfdde6b79434ef012e9dfc2fbbcca9 diff --git a/doc/lightning-listconfigs.7.md b/doc/lightning-listconfigs.7.md index 5b285b663c47..823ee79ba8fe 100644 --- a/doc/lightning-listconfigs.7.md +++ b/doc/lightning-listconfigs.7.md @@ -188,7 +188,6 @@ EXAMPLE JSON RESPONSE "autolisten": true, "proxy": "127.0.0.1:9050", "disable-dns": "false", - "enable-autotor-v2-mode": "false", "encrypted-hsm": false, "rpc-file-mode": "0600", "log-level": "DEBUG", diff --git a/lightningd/connect_control.c b/lightningd/connect_control.c index 144f777100b3..0fe75804896b 100644 --- a/lightningd/connect_control.c +++ b/lightningd/connect_control.c @@ -554,7 +554,6 @@ int connectd_init(struct lightningd *ld) ld->proxyaddr, ld->always_use_proxy || ld->pure_tor_setup, IFDEV(ld->dev_allow_localhost, false), ld->config.use_dns, ld->tor_service_password ? ld->tor_service_password : "", - ld->config.use_v3_autotor, ld->config.connection_timeout_secs, websocket_helper_path, ld->websocket_port, diff --git a/lightningd/lightningd.h b/lightningd/lightningd.h index ae74a635f978..5e3a1edb70b0 100644 --- a/lightningd/lightningd.h +++ b/lightningd/lightningd.h @@ -62,9 +62,6 @@ struct config { /* Minimal amount of effective funding_satoshis for accepting channels */ u64 min_capacity_sat; - /* Allow to define the default behavior of tor services calls*/ - bool use_v3_autotor; - /* This is the key we use to encrypt `hsm_secret`. */ struct secret *keypass; diff --git a/lightningd/options.c b/lightningd/options.c index 826b87b6400a..34e6f6db4cf9 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -793,8 +793,6 @@ static const struct config testnet_config = { /* Sets min_effective_htlc_capacity - at 1000$/BTC this is 10ct */ .min_capacity_sat = 10000, - .use_v3_autotor = true, - /* 1 minute should be enough for anyone! */ .connection_timeout_secs = 60, @@ -859,9 +857,6 @@ static const struct config mainnet_config = { /* Sets min_effective_htlc_capacity - at 1000$/BTC this is 10ct */ .min_capacity_sat = 10000, - /* Allow to define the default behavior of tor services calls*/ - .use_v3_autotor = true, - /* 1 minute should be enough for anyone! */ .connection_timeout_secs = 60, @@ -1168,10 +1163,6 @@ static void register_opts(struct lightningd *ld) opt_register_early_noarg("--disable-dns", opt_set_invbool, &ld->config.use_dns, "Disable DNS lookups of peers"); - if (deprecated_apis) - opt_register_noarg("--enable-autotor-v2-mode", opt_set_invbool, &ld->config.use_v3_autotor, - opt_hidden); - opt_register_noarg("--encrypted-hsm", opt_set_hsm_password, ld, "Set the password to encrypt hsm_secret with. If no password is passed through command line, " "you will be prompted to enter it."); diff --git a/lightningd/plugin.c b/lightningd/plugin.c index e0dff81885af..1497439cc323 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -1853,7 +1853,7 @@ plugin_populate_init_request(struct plugin *plugin, struct jsonrpc_request *req) json_add_string(req->stream, "network", chainparams->network_name); if (ld->proxyaddr) { json_add_address(req->stream, "proxy", ld->proxyaddr); - json_add_bool(req->stream, "torv3-enabled", ld->config.use_v3_autotor); + json_add_bool(req->stream, "torv3-enabled", true); json_add_bool(req->stream, "always_use_proxy", ld->always_use_proxy); if (deprecated_apis) json_add_bool(req->stream, "use_proxy_always", From ffa6e0d9ce4cfd002e47e9bf94b589f7d2dc6e85 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 17 May 2022 10:17:34 +0930 Subject: [PATCH 2/2] lightningd: remove various deprecated JSON fields. Signed-off-by: Rusty Russell 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) --- cln-grpc/proto/node.proto | 1 + cln-grpc/src/convert.rs | 1 + cln-rpc/src/model.rs | 2 ++ doc/lightning-listpeers.7.md | 4 +-- doc/lightning-listtransactions.7.md | 2 +- doc/schemas/listpeers.schema.json | 32 +++--------------------- doc/schemas/listtransactions.schema.json | 3 --- lightningd/peer_control.c | 24 ------------------ wallet/walletrpc.c | 2 -- 9 files changed, 10 insertions(+), 61 deletions(-) diff --git a/cln-grpc/proto/node.proto b/cln-grpc/proto/node.proto index 9ac4dddab75f..bf66a9baa930 100644 --- a/cln-grpc/proto/node.proto +++ b/cln-grpc/proto/node.proto @@ -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; diff --git a/cln-grpc/src/convert.rs b/cln-grpc/src/convert.rs index d1ae7f309843..a7be55089482 100644 --- a/cln-grpc/src/convert.rs +++ b/cln-grpc/src/convert.rs @@ -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? diff --git a/cln-rpc/src/model.rs b/cln-rpc/src/model.rs index d5286569aa1c..db51cb0e5cdb 100644 --- a/cln-rpc/src/model.rs +++ b/cln-rpc/src/model.rs @@ -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, #[serde(alias = "features")] pub features: Vec, #[serde(alias = "to_us_msat", skip_serializing_if = "Option::is_none")] diff --git a/doc/lightning-listpeers.7.md b/doc/lightning-listpeers.7.md index 849b808c1814..31c3d204c8c8 100644 --- a/doc/lightning-listpeers.7.md +++ b/doc/lightning-listpeers.7.md @@ -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 @@ -380,4 +380,4 @@ Main web site: Lightning RFC site (BOLT \#9): -[comment]: # ( SHA256STAMP:6b0ec5c899c8685487190209f594635030205a275e1dc6d61a7b057adbf66192) +[comment]: # ( SHA256STAMP:4f76b5ac19d3dfdaf3d04f5dd5de2312a2ab0ccffe779508c416aaf6e644612a) diff --git a/doc/lightning-listtransactions.7.md b/doc/lightning-listtransactions.7.md index 767a92bde531..157fc0126b0d 100644 --- a/doc/lightning-listtransactions.7.md +++ b/doc/lightning-listtransactions.7.md @@ -104,4 +104,4 @@ RESOURCES --------- Main web site: -[comment]: # ( SHA256STAMP:ba0624377601e6e90c2ca90b709fd076f3ed0f2b813f73553ec6b935eeec54a1) +[comment]: # ( SHA256STAMP:bd9c33dd27be0f25b0212b4115714768ffbec2ff6e72f083613a4464a3f98bc0) diff --git a/doc/schemas/listpeers.schema.json b/doc/schemas/listpeers.schema.json index d35091182c1c..f50cef596c9c 100644 --- a/doc/schemas/listpeers.schema.json +++ b/doc/schemas/listpeers.schema.json @@ -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", @@ -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" @@ -765,8 +754,6 @@ "closer": {}, "features": {}, "funding": {}, - "funding_allocation_msat": {}, - "funding_msat": {}, "to_us_msat": {}, "min_to_us_msat": {}, "max_to_us_msat": {}, @@ -817,7 +804,6 @@ "last_feerate": {}, "next_feerate": {}, "inflight": {}, - "last_tx_fee": {}, "last_tx_fee_msat": {}, "direction": {}, "close_to_addr": { @@ -854,8 +840,6 @@ "closer": {}, "features": {}, "funding": {}, - "funding_allocation_msat": {}, - "funding_msat": {}, "to_us_msat": {}, "min_to_us_msat": {}, "max_to_us_msat": {}, @@ -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" @@ -944,8 +925,6 @@ "closer": {}, "features": {}, "funding": {}, - "funding_allocation_msat": {}, - "funding_msat": {}, "to_us_msat": {}, "min_to_us_msat": {}, "max_to_us_msat": {}, @@ -995,7 +974,6 @@ "initial_feerate": {}, "last_feerate": {}, "next_feerate": {}, - "last_tx_fee": {}, "close_to_addr": {}, "last_tx_fee_msat": {}, "direction": { @@ -1033,8 +1011,6 @@ "closer": {}, "features": {}, "funding": {}, - "funding_allocation_msat": {}, - "funding_msat": {}, "to_us_msat": {}, "min_to_us_msat": {}, "max_to_us_msat": {}, @@ -1082,7 +1058,6 @@ "out_msatoshi_fulfilled": {}, "htlcs": {}, "inflight": {}, - "last_tx_fee": {}, "close_to_addr": {}, "direction": {}, "last_tx_fee_msat": {}, @@ -1129,7 +1104,6 @@ "connected": {}, "htlcs": {}, "log": {}, - "last_tx_fee": {}, "netaddr": { "type": "array", "minItems": 1, diff --git a/doc/schemas/listtransactions.schema.json b/doc/schemas/listtransactions.schema.json index a5c5d5e5f70d..0b41b17c779f 100644 --- a/doc/schemas/listtransactions.schema.json +++ b/doc/schemas/listtransactions.schema.json @@ -134,9 +134,6 @@ "type": "u32", "description": "the 0-based output number" }, - "satoshis": { - "deprecated": true - }, "msat": { "type": "msat", "description": "the amount of the output" diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 7994e6fbb6b5..eb6fd2074c0c 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -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; @@ -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)); } @@ -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)) @@ -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); diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index fb2d3815b22c..9d7ad17027d9 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -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