Files
plm-lottery/tests/unit/test_hd.py
T
davideandClaude Sonnet 5 df72367f02 Implement full MVP: auth, HD wallet, Electrum client, deposits, bets, round/draw engine, payout, withdrawals, RBF, admin+audit
All 10 build-order stages complete and unit-tested (49 tests). Verified live on
mainnet: registration/address derivation, deposit crediting, a real 10 PLM bet
(broadcast + confirmed + change credited). A full round close->draw->payout
cycle was triggered live and was in progress at commit time. Withdrawal and RBF
bump are unit-tested but not yet exercised against a live broadcast. Known gaps
(scheduler doesn't resume mid-flight rounds after restart, payout has no retry,
no deployment setup, etc.) are documented in CLAUDE.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-20 23:52:20 +02:00

22 lines
669 B
Python

from embit.bip32 import HDKey
from app.wallet.plm_network import PLM_MAINNET
def test_p2wpkh_address_uses_plm_hrp():
from embit import script
root = HDKey.from_seed(b"\x01" * 32, version=PLM_MAINNET["xprv"])
child = root.derive("m/84h/746h/0h/0/0")
address = script.p2wpkh(child.to_public()).address(network=PLM_MAINNET)
assert address.startswith("plm1q")
def test_derivation_is_deterministic():
root = HDKey.from_seed(b"\x02" * 32, version=PLM_MAINNET["xprv"])
a = root.derive("m/84h/746h/0h/0/5").sec()
b = root.derive("m/84h/746h/0h/0/5").sec()
c = root.derive("m/84h/746h/0h/0/6").sec()
assert a == b
assert a != c