(self)
| 61 | assert_equal(result[0]['error']['message'], error_message) |
| 62 | |
| 63 | def run_test(self): |
| 64 | self.log.info("Mining blocks...") |
| 65 | self.generate(self.nodes[0], 1, sync_fun=self.no_op) |
| 66 | self.generate(self.nodes[1], 1, sync_fun=self.no_op) |
| 67 | timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime'] |
| 68 | |
| 69 | node0_address1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress()) |
| 70 | |
| 71 | # Check only one address |
| 72 | assert_equal(node0_address1['ismine'], True) |
| 73 | |
| 74 | # Node 1 sync test |
| 75 | assert_equal(self.nodes[1].getblockcount(), 1) |
| 76 | |
| 77 | # Address Test - before import |
| 78 | address_info = self.nodes[1].getaddressinfo(node0_address1['address']) |
| 79 | assert_equal(address_info['iswatchonly'], False) |
| 80 | assert_equal(address_info['ismine'], False) |
| 81 | |
| 82 | # RPC importmulti ----------------------------------------------- |
| 83 | |
| 84 | # Bitcoin Address (implicit non-internal) |
| 85 | self.log.info("Should import an address") |
| 86 | key = get_key(self.nodes[0]) |
| 87 | self.test_importmulti({"scriptPubKey": {"address": key.p2pkh_addr}, |
| 88 | "timestamp": "now", |
| 89 | # ELEMENTS: Also import blinding key |
| 90 | "blinding_privkey": key.blinding_privkey, |
| 91 | }, |
| 92 | success=True) |
| 93 | test_address(self.nodes[1], |
| 94 | key.p2pkh_addr, |
| 95 | iswatchonly=True, |
| 96 | ismine=False, |
| 97 | timestamp=timestamp, |
| 98 | ischange=False) |
| 99 | watchonly_address = key.p2pkh_addr |
| 100 | watchonly_timestamp = timestamp |
| 101 | |
| 102 | self.log.info("Should not import an invalid address") |
| 103 | self.test_importmulti({"scriptPubKey": {"address": "not valid address"}, |
| 104 | "timestamp": "now"}, |
| 105 | success=False, |
| 106 | error_code=-5, |
| 107 | error_message='Invalid address \"not valid address\"') |
| 108 | |
| 109 | # ScriptPubKey + internal |
| 110 | self.log.info("Should import a scriptPubKey with internal flag") |
| 111 | key = get_key(self.nodes[0]) |
| 112 | self.test_importmulti({"scriptPubKey": key.p2pkh_script, |
| 113 | "timestamp": "now", |
| 114 | "internal": True, |
| 115 | # ELEMENTS: Also import blinding key |
| 116 | "blinding_privkey": key.blinding_privkey, |
| 117 | }, |
| 118 | success=True) |
| 119 | test_address(self.nodes[1], |
| 120 | key.p2pkh_addr, |
nothing calls this directly
no test coverage detected