test: use ExtendedPrivateKey in wallet_send.py
What changed, and why it matters
This commit changes only a test file. It replaces a hard-coded Bitcoin testnet extended private key with a freshly generated one using a test helper. There is no change to production wallet code, no bug fix, and no security-relevant behavior change.
No action required. This is a benign test-only refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In test/functional/wallet_send.py, the hard-coded tprv/tpub pair is removed in favor of ExtendedPrivateKey.generate() from the test framework. The generated xpriv and xpub are then used in the same importdescriptors call. This is a test-hygiene refactor to avoid static keys in tests; it does not alter node or wallet logic.
Changed components
test/functional/wallet_send.pyInspect captured patch +4 / −2
diff --git a/test/functional/wallet_send.py b/test/functional/wallet_send.py
index 062c360f..8440044f 100755
--- a/test/functional/wallet_send.py
+++ b/test/functional/wallet_send.py
@@ -8,6 +8,7 @@ from decimal import Decimal, getcontext
from itertools import product
from test_framework.descriptors import descsum_create
+from test_framework.extendedkey import ExtendedPrivateKey
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_not_equal,
@@ -204,8 +205,9 @@ class WalletSendTest(BitcoinTestFramework):
# w2 contains the private keys for w3
self.nodes[1].createwallet(wallet_name="w2", blank=True)
w2 = self.nodes[1].get_wallet_rpc("w2")
- xpriv = "tprv8ZgxMBicQKsPfHCsTwkiM1KT56RXbGGTqvc2hgqzycpwbHqqpcajQeMRZoBD35kW4RtyCemu6j34Ku5DEspmgjKdt2qe4SvRch5Kk8B8A2v"
- xpub = "tpubD6NzVbkrYhZ4YkEfMbRJkQyZe7wTkbTNRECozCtJPtdLRn6cT1QKb8yHjwAPcAr26eHBFYs5iLiFFnCbwPRsncCKUKCfubHDMGKzMVcN1Jg"
+ extendedkey = ExtendedPrivateKey.generate()
+ xpriv = extendedkey.to_string()
+ xpub = extendedkey.pubkey().to_string()
w2.importdescriptors([{
"desc": descsum_create("wpkh(" + xpriv + "/0/0/*)"),
"timestamp": "now",
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.