test: use ExtendedPrivateKey in wallet_fundrawtransaction.py
What changed, and why it matters
This is a minor test-only cleanup. It replaces a hardcoded example private key in a test script with a freshly generated random one. There is no change to the actual Bitcoin Core software that users run, and no security vulnerability is being fixed or introduced.
No action needed. This is a benign test refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies test/functional/wallet_fundrawtransaction.py to import ExtendedPrivateKey from test_framework.extendedkey and use ExtendedPrivateKey.generate().to_string() instead of a literal tprv… extended private key string when constructing wallet descriptors for a functional test. The change is purely in test infrastructure and does not touch consensus, networking, wallet logic, or any runtime code path.
Changed components
test/functional/wallet_fundrawtransaction.pyInspect captured patch +3 / −2
diff --git a/test/functional/wallet_fundrawtransaction.py b/test/functional/wallet_fundrawtransaction.py
index 02227029..77ccac60 100755
--- a/test/functional/wallet_fundrawtransaction.py
+++ b/test/functional/wallet_fundrawtransaction.py
@@ -11,6 +11,7 @@ from math import ceil
from test_framework.address import address_to_scriptpubkey
from test_framework.descriptors import descsum_create
+from test_framework.extendedkey import ExtendedPrivateKey
from test_framework.messages import (
COIN,
CTransaction,
@@ -612,12 +613,12 @@ class RawTransactionsTest(BitcoinTestFramework):
with WalletUnlock(wallet, "test"):
wallet.importdescriptors([{
- 'desc': descsum_create('wpkh(tprv8ZgxMBicQKsPdYeeZbPSKd2KYLmeVKtcFA7kqCxDvDR13MQ6us8HopUR2wLcS2ZKPhLyKsqpDL2FtL73LMHcgoCL7DXsciA8eX8nbjCR2eG/0h/*h)'),
+ 'desc': descsum_create(f'wpkh({ExtendedPrivateKey.generate().to_string()}/0h/*h)'),
'timestamp': 'now',
'active': True
},
{
- 'desc': descsum_create('wpkh(tprv8ZgxMBicQKsPdYeeZbPSKd2KYLmeVKtcFA7kqCxDvDR13MQ6us8HopUR2wLcS2ZKPhLyKsqpDL2FtL73LMHcgoCL7DXsciA8eX8nbjCR2eG/1h/*h)'),
+ 'desc': descsum_create(f'wpkh({ExtendedPrivateKey.generate().to_string()}/1h/*h)'),
'timestamp': 'now',
'active': True,
'internal': True
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.