diff --git a/cln-grpc/proto/node.proto b/cln-grpc/proto/node.proto index e2a8d0b72..dca6d7e71 100644 Binary files a/cln-grpc/proto/node.proto and b/cln-grpc/proto/node.proto differ diff --git a/cln-rpc/src/model.rs b/cln-rpc/src/model.rs index 9d8150536..3c7124b5f 100644 Binary files a/cln-rpc/src/model.rs and b/cln-rpc/src/model.rs differ diff --git a/contrib/pyln-testing/pyln/testing/node_pb2.py b/contrib/pyln-testing/pyln/testing/node_pb2.py index bb105f8bd..bef1498d0 100644 Binary files a/contrib/pyln-testing/pyln/testing/node_pb2.py and b/contrib/pyln-testing/pyln/testing/node_pb2.py differ diff --git a/doc/lightning-newaddr.7.md b/doc/lightning-newaddr.7.md index 164c4325f..3de7419b4 100644 --- a/doc/lightning-newaddr.7.md +++ b/doc/lightning-newaddr.7.md @@ -4,7 +4,7 @@ lightning-newaddr -- Command for generating a new address to be used by Core Lig SYNOPSIS -------- -**newaddr** [ *addresstype* ] +**newaddr** [*addresstype*] DESCRIPTION ----------- @@ -14,12 +14,10 @@ subsequently be used to fund channels managed by the Core Lightning node. The funding transaction needs to be confirmed before funds can be used. -*addresstype* specifies the type of address wanted; i.e. *p2sh-segwit* -(e.g. `2MxaozoqWwiUcuD9KKgUSrLFDafLqimT9Ta` on bitcoin testnet or -`3MZxzq3jBSKNQ2e7dzneo9hy4FvNzmMmt3` on bitcoin mainnet) or *bech32* +*addresstype* specifies the type of address wanted; currently *bech32* (e.g. `tb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg` on bitcoin testnet or `bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej` on -bitcoin mainnet). The special value *all* generates both address types +bitcoin mainnet). The special value *all* generates all known address types for the same underlying key. If no *addresstype* is specified the address generated is a *bech32* address. @@ -33,7 +31,7 @@ RETURN VALUE On success, an object is returned, containing: - **bech32** (string, optional): The bech32 (native segwit) address -- **p2sh-segwit** (string, optional): The p2sh-wrapped address +- **p2sh-segwit** (string, optional): The p2sh-wrapped address **deprecated, removal in v23.11** [comment]: # (GENERATE-FROM-SCHEMA-END) @@ -58,4 +56,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:8ed49212ffddf29077007efe38a6b6446cc9c351cb24a1454030526c89407175) +[comment]: # ( SHA256STAMP:9d8dc613c005127a0807f2c8b26b0a96ddc5bf3ebdfa59c3f95a888476c0ce2a) diff --git a/doc/schemas/newaddr.request.json b/doc/schemas/newaddr.request.json index 7140f97bf..add617e4b 100644 --- a/doc/schemas/newaddr.request.json +++ b/doc/schemas/newaddr.request.json @@ -8,7 +8,6 @@ "type": "string", "enum": [ "bech32", - "p2sh-segwit", "all" ] } diff --git a/doc/schemas/newaddr.schema.json b/doc/schemas/newaddr.schema.json index 8bfa737a9..7f0212760 100644 --- a/doc/schemas/newaddr.schema.json +++ b/doc/schemas/newaddr.schema.json @@ -9,6 +9,7 @@ "description": "The bech32 (native segwit) address" }, "p2sh-segwit": { + "deprecated": "v23.02", "type": "string", "description": "The p2sh-wrapped address" } diff --git a/tests/test_misc.py b/tests/test_misc.py index e8ee161e6..ca5a47d32 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1856,14 +1856,11 @@ def test_bad_onion_immediate_peer(node_factory, bitcoind): def test_newaddr(node_factory, chainparams): l1 = node_factory.get_node() - p2sh = l1.rpc.newaddr('p2sh-segwit') - assert 'bech32' not in p2sh - assert p2sh['p2sh-segwit'].startswith(chainparams['p2sh_prefix']) bech32 = l1.rpc.newaddr('bech32') assert 'p2sh-segwit' not in bech32 assert bech32['bech32'].startswith(chainparams['bip173_prefix']) both = l1.rpc.newaddr('all') - assert both['p2sh-segwit'].startswith(chainparams['p2sh_prefix']) + assert 'p2sh-segwit' not in both assert both['bech32'].startswith(chainparams['bip173_prefix']) diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index 30b737880..f02d380ec 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -77,12 +77,13 @@ encode_pubkey_to_addr(const tal_t *ctx, } enum addrtype { + /* Deprecated! */ ADDR_P2SH_SEGWIT = 1, ADDR_BECH32 = 2, ADDR_ALL = (ADDR_P2SH_SEGWIT + ADDR_BECH32) }; -/* Extract bool indicating "p2sh-segwit" or "bech32" */ +/* Extract bool indicating "bech32" */ static struct command_result *param_newaddr(struct command *cmd, const char *name, const char *buffer, @@ -90,7 +91,7 @@ static struct command_result *param_newaddr(struct command *cmd, enum addrtype **addrtype) { *addrtype = tal(cmd, enum addrtype); - if (json_tok_streq(buffer, tok, "p2sh-segwit")) + if (deprecated_apis && json_tok_streq(buffer, tok, "p2sh-segwit")) **addrtype = ADDR_P2SH_SEGWIT; else if (json_tok_streq(buffer, tok, "bech32")) **addrtype = ADDR_BECH32; @@ -98,7 +99,7 @@ static struct command_result *param_newaddr(struct command *cmd, **addrtype = ADDR_ALL; else return command_fail(cmd, JSONRPC2_INVALID_PARAMS, - "'%s' should be 'bech32', 'p2sh-segwit' or 'all', not '%.*s'", + "'%s' should be 'bech32', or 'all', not '%.*s'", name, tok->end - tok->start, buffer + tok->start); return NULL; } @@ -131,7 +132,7 @@ static struct command_result *json_newaddr(struct command *cmd, b32script = scriptpubkey_p2wpkh(tmpctx, &pubkey); if (*addrtype & ADDR_BECH32) txfilter_add_scriptpubkey(cmd->ld->owned_txfilter, b32script); - if (*addrtype & ADDR_P2SH_SEGWIT) + if (deprecated_apis && (*addrtype & ADDR_P2SH_SEGWIT)) txfilter_add_scriptpubkey(cmd->ld->owned_txfilter, scriptpubkey_p2sh(tmpctx, b32script)); @@ -145,7 +146,7 @@ static struct command_result *json_newaddr(struct command *cmd, response = json_stream_success(cmd); if (*addrtype & ADDR_BECH32) json_add_string(response, "bech32", bech32); - if (*addrtype & ADDR_P2SH_SEGWIT) + if (deprecated_apis && (*addrtype & ADDR_P2SH_SEGWIT)) json_add_string(response, "p2sh-segwit", p2sh); return command_success(cmd, response); } @@ -154,8 +155,8 @@ static const struct json_command newaddr_command = { "newaddr", "bitcoin", json_newaddr, - "Get a new {bech32, p2sh-segwit} (or all) address to fund a channel (default is bech32)", false, - "Generates a new address (or both) that belongs to the internal wallet. Funds sent to these addresses will be managed by lightningd. Use `withdraw` to withdraw funds to an external wallet." + "Get a new {bech32} (or all) address to fund a channel", false, + "Generates a new address that belongs to the internal wallet. Funds sent to these addresses will be managed by lightningd. Use `withdraw` to withdraw funds to an external wallet." }; AUTODATA(json_command, &newaddr_command);