Skip to content

Commit c9fdf60

Browse files
committed
wallet: make p2tr the default address for newaddr.
Of course we still have to return a `bech32` for the deprecation period. Changelog-Added: JSON-RPC: `newaddr` will now return a `p2tr` field by default. Changelog-Deprecated: JSON-RPC: `newaddr` returning a `bech32` field if `addresstype` is not specified (use `p2tr`). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 1e7ffeb commit c9fdf60

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

contrib/msggen/msggen/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27137,7 +27137,7 @@
2713727137
"description": [
2713827138
"It specifies the type of address wanted; currently *bech32* (e.g. `tb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg` on bitcoin testnet or `bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej` on bitcoin mainnet), or *p2tr* taproot addresses. The special value *all* generates all known address types for the same underlying key."
2713927139
],
27140-
"default": "*bech32* address",
27140+
"default": "*p2tr* address",
2714127141
"enum": [
2714227142
"bech32",
2714327143
"p2tr",

doc/developers-guide/deprecated-features.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ hidden: false
2121
| channel_state_changed.null_scid | Notification Field | v25.09 | v26.09 | In channel_state_changed notification, `short_channel_id` will be missing instead of `null` |
2222
| notification.payload | Notification Field | v25.09 | v26.09 | Notifications from plugins used to have fields in `payload` sub-object, now they are not (just like normal notifications) |
2323
| pay_notifications.raw_fields | Field | v25.09 | v26.09 | `channel_hint_update`, `pay_failure` and `pay_success` notifications now wrap members in an object of the same name |
24-
| encrypted_hsm | Config | v25.12 | v26.12 | `hsm-passphrase` is a name which also makes sense for modern hsm_secrets which use BIP 39 |
24+
| encrypted_hsm | Config | v25.12 | v26.12 | `hsm-passphrase` is a name which also makes sense for modern hsm_secrets which use BIP 39 |
25+
| newaddr.addresstype.defaultbech32 | Parameter | v25.12 | v26.12 | Use `p2tr` in the response (present since v23.08 if `addresstype` is `p2tr`, and always present since v24.12). |
2526

2627
Inevitably there are features which need to change: either to be generalized, or removed when they can no longer be supported.
2728

doc/schemas/newaddr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"description": [
2020
"It specifies the type of address wanted; currently *bech32* (e.g. `tb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg` on bitcoin testnet or `bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej` on bitcoin mainnet), or *p2tr* taproot addresses. The special value *all* generates all known address types for the same underlying key."
2121
],
22-
"default": "*bech32* address",
22+
"default": "*p2tr* address",
2323
"enum": [
2424
"bech32",
2525
"p2tr",

wallet/walletrpc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,19 @@ static struct command_result *json_newaddr(struct command *cmd,
149149
char *bech32, *p2tr;
150150

151151
if (!param(cmd, buffer, params,
152-
p_opt_def("addresstype", param_newaddr, &addrtype, ADDR_BECH32),
152+
p_opt("addresstype", param_newaddr, &addrtype),
153153
NULL))
154154
return command_param_failed();
155155

156+
if (!addrtype) {
157+
addrtype = tal(cmd, enum addrtype);
158+
if (command_deprecated_in_ok(cmd, "addresstype.defaultbech32",
159+
"v25.12", "v26.12"))
160+
*addrtype = ADDR_ALL;
161+
else
162+
*addrtype = ADDR_P2TR;
163+
}
164+
156165
if (!newaddr_inner(cmd, &pubkey, *addrtype)) {
157166
return command_fail(cmd, LIGHTNINGD, "Keys exhausted ");
158167
};

0 commit comments

Comments
 (0)