Skip to content

Commit 01aa683

Browse files
committed
Add a testcase for xpub derivation
1 parent b8ce968 commit 01aa683

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_from_xpublic_key.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55

66
from hdwallet import HDWallet
7+
from hdwallet.utils import generate_entropy
78

89
# Test Values
910
base_path: str = os.path.dirname(__file__)
@@ -81,3 +82,11 @@ def test_from_xpublic_key():
8182
del dumps["xpublic_key_hex"]
8283

8384
assert hdwallet.dumps() == dumps
85+
86+
def test_derivation_from_xpublic_key():
87+
hdwallet: HDWallet = HDWallet().from_entropy(generate_entropy())
88+
wallet1: HDWallet = hdwallet.from_path("m/1'/2'/3'")
89+
xpub: str = wallet1.xpublic_key()
90+
wallet2: HDWallet = HDWallet().from_xpublic_key(xpub)
91+
assert wallet1.xpublic_key() == wallet2.xpublic_key()
92+
assert wallet1.from_path("m/1/2/3").xpublic_key() == wallet2.from_path("m/1/2/3").xpublic_key()

0 commit comments

Comments
 (0)