Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_descriptor.py
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
send_wrpc.walletlock() | send_wrpc.walletlock() | ||||
assert 'hdmasterfingerprint' in send_wrpc.getaddressinfo( | assert 'hdmasterfingerprint' in send_wrpc.getaddressinfo( | ||||
send_wrpc.getnewaddress()) | send_wrpc.getnewaddress()) | ||||
info3 = send_wrpc.getaddressinfo(addr) | info3 = send_wrpc.getaddressinfo(addr) | ||||
assert_equal(info2['desc'], info3['desc']) | assert_equal(info2['desc'], info3['desc']) | ||||
self.log.info( | self.log.info( | ||||
"Test that getnewaddress still works after keypool is exhausted in an encrypted wallet") | "Test that getnewaddress still works after keypool is exhausted in an encrypted wallet") | ||||
for i in range(0, 500): | for _ in range(500): | ||||
send_wrpc.getnewaddress() | send_wrpc.getnewaddress() | ||||
self.log.info( | self.log.info( | ||||
"Test that unlock is needed when deriving only hardened keys in an encrypted wallet") | "Test that unlock is needed when deriving only hardened keys in an encrypted wallet") | ||||
send_wrpc.walletpassphrase('pass', 10) | send_wrpc.walletpassphrase('pass', 10) | ||||
send_wrpc.importdescriptors([{ | send_wrpc.importdescriptors([{ | ||||
"desc": "sh(pkh(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/*h))#45ls09gz", | "desc": "sh(pkh(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/*h))#45ls09gz", | ||||
"timestamp": "now", | "timestamp": "now", | ||||
"range": [0, 10], | "range": [0, 10], | ||||
"active": True | "active": True | ||||
}]) | }]) | ||||
send_wrpc.walletlock() | send_wrpc.walletlock() | ||||
# Exhaust keypool of 100 | # Exhaust keypool of 100 | ||||
for i in range(0, 100): | for _ in range(100): | ||||
send_wrpc.getnewaddress() | send_wrpc.getnewaddress() | ||||
# This should now error | # This should now error | ||||
assert_raises_rpc_error(-12, | assert_raises_rpc_error(-12, | ||||
"Keypool ran out, please call keypoolrefill first", | "Keypool ran out, please call keypoolrefill first", | ||||
send_wrpc.getnewaddress, | send_wrpc.getnewaddress, | ||||
'') | '') | ||||
self.log.info("Test born encrypted wallets") | self.log.info("Test born encrypted wallets") | ||||
Show All 29 Lines |