schema: update schema to remove bip86 and add mnemonic to expose secret
What changed, and why it matters
This commit is a routine cleanup of API documentation and test code. It removes an experimental 'bip86' address type option from the newaddr command and updates tests to use taproot (p2tr) addresses instead of older bech32 addresses. There is no security vulnerability here.
No security action required. Review as normal API/test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies JSON schema files for the newaddr RPC to drop the ‘bip86’ addresstype enum value and its example, leaving only bech32, p2tr, and all. It also updates tests/test_misc.py to rename test_bech32_funding to test_p2tr_funding and switch several newaddr(‘bech32’) calls to newaddr(‘p2tr’), with corresponding expected output adjustments. The commit message mentions generated files for an exposesecret schema change, but those are not visible in the diff.
Changed components
doc/schemas/newaddr.jsoncontrib/msggen/msggen/schema.jsontests/test_misc.pyInspect captured patch +15 / −40
diff --git a/contrib/msggen/msggen/schema.json b/contrib/msggen/msggen/schema.json
index d2a6f435..9a0c0266 100644
--- a/contrib/msggen/msggen/schema.json
+++ b/contrib/msggen/msggen/schema.json
@@ -27135,13 +27135,12 @@
"addresstype": {
"type": "string",
"description": [
- "It specifies the type of address wanted; currently *bech32* (e.g. `tb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg` on bitcoin testnet or `bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej` on bitcoin mainnet), *p2tr* taproot addresses, or *bip86* for BIP86-derived taproot addresses. The special value *all* generates all known address types for the same underlying key."
+ "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",
"enum": [
"bech32",
"p2tr",
- "bip86",
"all"
]
}
@@ -27155,7 +27154,7 @@
"added": "v23.08",
"type": "string",
"description": [
- "The taproot address (returned for both 'p2tr' and 'bip86' addresstype)."
+ "The taproot address."
]
},
"bech32": {
@@ -27203,18 +27202,6 @@
"response": {
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
}
- },
- {
- "request": {
- "id": "example:newaddr#3",
- "method": "newaddr",
- "params": {
- "addresstype": "bip86"
- }
- },
- "response": {
- "p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
- }
}
]
},
diff --git a/doc/schemas/newaddr.json b/doc/schemas/newaddr.json
index 684a6084..098a338c 100644
--- a/doc/schemas/newaddr.json
+++ b/doc/schemas/newaddr.json
@@ -17,13 +17,12 @@
"addresstype": {
"type": "string",
"description": [
- "It specifies the type of address wanted; currently *bech32* (e.g. `tb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg` on bitcoin testnet or `bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej` on bitcoin mainnet), *p2tr* taproot addresses, or *bip86* for BIP86-derived taproot addresses. The special value *all* generates all known address types for the same underlying key."
+ "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",
"enum": [
"bech32",
"p2tr",
- "bip86",
"all"
]
}
@@ -37,7 +36,7 @@
"added": "v23.08",
"type": "string",
"description": [
- "The taproot address (returned for both 'p2tr' and 'bip86' addresstype)."
+ "The taproot address."
]
},
"bech32": {
@@ -85,18 +84,6 @@
"response": {
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
}
- },
- {
- "request": {
- "id": "example:newaddr#3",
- "method": "newaddr",
- "params": {
- "addresstype": "bip86"
- }
- },
- "response": {
- "p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
- }
}
]
}
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 7a81d4a1..65b7ffbe 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -562,12 +562,12 @@ def test_htlc_in_timeout(node_factory, bitcoind, executor):
@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', 'must be on bitcoin network')
-def test_bech32_funding(node_factory, chainparams):
+def test_p2tr_funding(node_factory, chainparams):
# Don't get any funds from previous runs.
l1, l2 = node_factory.line_graph(2, opts={'random_hsm': True}, fundchannel=False)
- # fund a bech32 address and then open a channel with it
- res = l1.openchannel(l2, 25000, 'bech32')
+ # fund a p2tr address and then open a channel with it
+ res = l1.openchannel(l2, 25000, 'p2tr')
address = res['address']
assert address.startswith(chainparams['bip173_prefix'])
@@ -577,11 +577,11 @@ def test_bech32_funding(node_factory, chainparams):
wallettx = l1.bitcoin.rpc.getrawtransaction(wallettxid, True)
fundingtx = l1.bitcoin.rpc.decoderawtransaction(res['fundingtx'])
- def is_p2wpkh(output):
- return output['type'] == 'witness_v0_keyhash' and \
+ def is_p2tr(output):
+ return output['type'] == 'witness_v1_taproot' and \
address == scriptpubkey_addr(output)
- assert any(is_p2wpkh(output['scriptPubKey']) for output in wallettx['vout'])
+ assert any(is_p2tr(output['scriptPubKey']) for output in wallettx['vout'])
assert only_one(fundingtx['vin'])['txid'] == res['wallettxid']
@@ -644,7 +644,7 @@ def test_withdraw_misc(node_factory, bitcoind, chainparams):
dont_spend_outputs(l1, out['txid'])
# Now send some money to l2.
- waddr = l2.rpc.newaddr('bech32')['bech32']
+ waddr = l2.rpc.newaddr('p2tr')['p2tr']
out = l1.rpc.withdraw(waddr, amount)
bitcoind.generate_block(1)
@@ -732,7 +732,7 @@ def test_withdraw_misc(node_factory, bitcoind, chainparams):
l1.rpc.unreserveinputs(bitcoind.rpc.createpsbt(inputs, []))
# Test withdrawal to self.
- l1.rpc.withdraw(l1.rpc.newaddr('bech32')['bech32'], 'all', minconf=0)
+ l1.rpc.withdraw(l1.rpc.newaddr('p2tr')['p2tr'], 'all', minconf=0)
bitcoind.generate_block(1)
assert l1.db_query('SELECT COUNT(*) as c FROM outputs WHERE status=0')[0]['c'] == 1
@@ -747,12 +747,13 @@ def test_withdraw_misc(node_factory, bitcoind, chainparams):
sync_blockheight(bitcoind, [l1])
assert account_balance(l1, 'wallet') == 0
+ # randomHsm now uses p2tr addresses and have a different transaction weight than non-p2tr addresses
external_moves = [
{'type': 'chain_mvt', 'credit_msat': 2000000000, 'debit_msat': 0, 'tags': ['deposit']},
{'type': 'chain_mvt', 'credit_msat': 2000000000, 'debit_msat': 0, 'tags': ['deposit']},
{'type': 'chain_mvt', 'credit_msat': 2000000000, 'debit_msat': 0, 'tags': ['deposit']},
{'type': 'chain_mvt', 'credit_msat': 2000000000, 'debit_msat': 0, 'tags': ['deposit']},
- {'type': 'chain_mvt', 'credit_msat': 11957393000, 'debit_msat': 0, 'tags': ['deposit']},
+ {'type': 'chain_mvt', 'credit_msat': 11960055000, 'debit_msat': 0, 'tags': ['deposit']},
]
check_coin_moves(l1, 'external', external_moves, chainparams)
@@ -1342,7 +1343,7 @@ def test_blockchaintrack(node_factory, bitcoind):
"""Check that we track the blockchain correctly across reorgs
"""
l1 = node_factory.get_node(random_hsm=True)
- addr = l1.rpc.newaddr(addresstype='all')['bech32']
+ addr = l1.rpc.newaddr(addresstype='all')['p2tr']
######################################################################
# First failure scenario: rollback on startup doesn't work,
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.