Use same wallet descriptor as for the bdk-kotlin tests

This commit is contained in:
thunderbiscuit 2022-05-11 16:09:59 -04:00
parent 3ae2f48846
commit 29821069d8
No known key found for this signature in database
GPG Key ID: 88253696EB836462

View File

@ -1,8 +1,7 @@
import bdkpython as bdk import bdkpython as bdk
import unittest import unittest
# taken from bdk test suite @ https://github.com/bitcoindevkit/bdk/blob/master/src/descriptor/template.rs#L676 descriptor = "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)"
descriptor = "wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/0h/0h/0/*)"
db_config = bdk.DatabaseConfig.MEMORY() db_config = bdk.DatabaseConfig.MEMORY()
blockchain_config = bdk.BlockchainConfig.ELECTRUM( blockchain_config = bdk.BlockchainConfig.ELECTRUM(
bdk.ElectrumConfig( bdk.ElectrumConfig(
@ -27,7 +26,7 @@ class TestSimpleBip84Wallet(unittest.TestCase):
) )
address = wallet.get_new_address() address = wallet.get_new_address()
# print(f"New address is {address}") # print(f"New address is {address}")
assert address == "tb1qkmvk2nadgplmd57ztld8nf8v2yxkzmdvvztyse", f"Wrong address {address}, should be tb1qkmvk2nadgplmd57ztld8nf8v2yxkzmdvvztyse" assert address == "tb1qzg4mckdh50nwdm9hkzq06528rsu73hjxxzem3e", f"Wrong address {address}, should be tb1qzg4mckdh50nwdm9hkzq06528rsu73hjxxzem3e"
def test_wallet_balance(self): def test_wallet_balance(self):
wallet = bdk.Wallet( wallet = bdk.Wallet(
@ -39,7 +38,7 @@ class TestSimpleBip84Wallet(unittest.TestCase):
wallet.sync(blockchain, None) wallet.sync(blockchain, None)
balance = wallet.get_balance() balance = wallet.get_balance()
# print(f"Balance is {balance} sat") # print(f"Balance is {balance} sat")
assert balance > 0, "Balance is 0, send testnet coins to tb1qkmvk2nadgplmd57ztld8nf8v2yxkzmdvvztyse" assert balance > 0, "Balance is 0, send testnet coins to tb1qzg4mckdh50nwdm9hkzq06528rsu73hjxxzem3e"
if __name__ == '__main__': if __name__ == '__main__':