Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_basic.py
Show First 20 Lines • Show All 335 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
txid = self.nodes[0].sendtoaddress(address_to_import, 1) | txid = self.nodes[0].sendtoaddress(address_to_import, 1) | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
self.sync_all([self.nodes[0:3]]) | self.sync_all([self.nodes[0:3]]) | ||||
# 2. Import address from node2 to node1 | # 2. Import address from node2 to node1 | ||||
self.nodes[1].importaddress(address_to_import) | self.nodes[1].importaddress(address_to_import) | ||||
# 3. Validate that the imported address is watch-only on node1 | # 3. Validate that the imported address is watch-only on node1 | ||||
assert(self.nodes[1].validateaddress(address_to_import)["iswatchonly"]) | assert(self.nodes[1].getaddressinfo(address_to_import)["iswatchonly"]) | ||||
# 4. Check that the unspents after import are not spendable | # 4. Check that the unspents after import are not spendable | ||||
assert_array_result(self.nodes[1].listunspent(), | assert_array_result(self.nodes[1].listunspent(), | ||||
{"address": address_to_import}, | {"address": address_to_import}, | ||||
{"spendable": False}) | {"spendable": False}) | ||||
# 5. Import private key of the previously imported address on node1 | # 5. Import private key of the previously imported address on node1 | ||||
priv_key = self.nodes[2].dumpprivkey(address_to_import) | priv_key = self.nodes[2].dumpprivkey(address_to_import) | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# With walletrejectlongchains we will not create the tx and store it in our wallet. | # With walletrejectlongchains we will not create the tx and store it in our wallet. | ||||
assert_raises_rpc_error(-4, "Transaction has too long of a mempool chain", | assert_raises_rpc_error(-4, "Transaction has too long of a mempool chain", | ||||
self.nodes[0].sendtoaddress, sending_addr, node0_balance - Decimal('0.01')) | self.nodes[0].sendtoaddress, sending_addr, node0_balance - Decimal('0.01')) | ||||
# Verify nothing new in wallet | # Verify nothing new in wallet | ||||
assert_equal(total_txs, len( | assert_equal(total_txs, len( | ||||
self.nodes[0].listtransactions("*", 99999))) | self.nodes[0].listtransactions("*", 99999))) | ||||
# Test getaddressinfo. Note that these addresses are taken from disablewallet.py | |||||
assert_raises_rpc_error(-5, "Invalid address", | |||||
self.nodes[0].getaddressinfo, "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy") | |||||
address_info = self.nodes[0].getaddressinfo( | |||||
"mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ") | |||||
assert_equal(address_info['address'], | |||||
"bchreg:qp8rs4qyd3aazk22eyzwg7fmdfzmxm02pywavdajx4") | |||||
assert_equal(address_info["scriptPubKey"], | |||||
"76a9144e3854046c7bd1594ac904e4793b6a45b36dea0988ac") | |||||
assert not address_info["ismine"] | |||||
assert not address_info["iswatchonly"] | |||||
assert not address_info["isscript"] | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
WalletTest().main() | WalletTest().main() |