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>
This commit is contained in:
Rusty Russell
2025-11-03 20:31:03 +10:30
parent 1e7ffeb89d
commit c9fdf60ac1
4 changed files with 14 additions and 4 deletions

View File

@@ -27137,7 +27137,7 @@
"description": [
"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."
],
"default": "*bech32* address",
"default": "*p2tr* address",
"enum": [
"bech32",
"p2tr",

View File

@@ -21,7 +21,8 @@ hidden: false
| 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` |
| 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) |
| 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 |
| encrypted_hsm | Config | v25.12 | v26.12 | `hsm-passphrase` is a name which also makes sense for modern hsm_secrets which use BIP 39 |
| encrypted_hsm | Config | v25.12 | v26.12 | `hsm-passphrase` is a name which also makes sense for modern hsm_secrets which use BIP 39 |
| 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). |
Inevitably there are features which need to change: either to be generalized, or removed when they can no longer be supported.

View File

@@ -19,7 +19,7 @@
"description": [
"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."
],
"default": "*bech32* address",
"default": "*p2tr* address",
"enum": [
"bech32",
"p2tr",

View File

@@ -149,10 +149,19 @@ static struct command_result *json_newaddr(struct command *cmd,
char *bech32, *p2tr;
if (!param(cmd, buffer, params,
p_opt_def("addresstype", param_newaddr, &addrtype, ADDR_BECH32),
p_opt("addresstype", param_newaddr, &addrtype),
NULL))
return command_param_failed();
if (!addrtype) {
addrtype = tal(cmd, enum addrtype);
if (command_deprecated_in_ok(cmd, "addresstype.defaultbech32",
"v25.12", "v26.12"))
*addrtype = ADDR_ALL;
else
*addrtype = ADDR_P2TR;
}
if (!newaddr_inner(cmd, &pubkey, *addrtype)) {
return command_fail(cmd, LIGHTNINGD, "Keys exhausted ");
};