regtest inherits chains parameters from testnet (saves flash space)
What changed, and why it matters
This commit is a small code cleanup. It makes the 'regtest' (regression test) Bitcoin network settings inherit from 'testnet' instead of duplicating the same values. The only unique setting kept for regtest is its special Bech32 address prefix ('bcrt'). There is no security issue here.
No security action needed. Treat as normal refactoring/optimization.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors BitcoinRegtest to subclass BitcoinTestnet rather than ChainsBase. It removes duplicated SLIP-132 version bytes, base58 version bytes, and BIP-44 coin type, all of which are identical between Bitcoin testnet and regtest. The only regtest-specific override retained is bech32_hrp = ‘bcrt’. This is a straightforward deduplication that saves flash space and reduces maintenance risk; it does not change any runtime behavior or cryptographic parameters.
Changed components
shared/chains.pyInspect captured patch +1 / −16
diff --git a/shared/chains.py b/shared/chains.py
index 1a9a7e8..9d53847 100644
--- a/shared/chains.py
+++ b/shared/chains.py
@@ -353,26 +353,11 @@ class BitcoinTestnet(ChainsBase):
b44_cointype = 1
-class BitcoinRegtest(ChainsBase):
+class BitcoinRegtest(BitcoinTestnet):
ctype = 'XRT'
name = 'Bitcoin Regtest'
-
- slip132 = {
- AF_CLASSIC: Slip132Version(0x043587cf, 0x04358394, 't'),
- AF_P2WPKH_P2SH: Slip132Version(0x044a5262, 0x044a4e28, 'u'),
- AF_P2WPKH: Slip132Version(0x045f1cf6, 0x045f18bc, 'v'),
- AF_P2WSH_P2SH: Slip132Version(0x024289ef, 0x024285b5, 'U'),
- AF_P2WSH: Slip132Version(0x02575483, 0x02575048, 'V'),
- }
-
bech32_hrp = 'bcrt'
- b58_addr = bytes([111])
- b58_script = bytes([196])
- b58_privkey = bytes([239])
-
- b44_cointype = 1
-
def get_chain(short_name):
# lookup object from name: 'BTC' or 'XTN'
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.