Send funds to the daemon without telling it explicitly
(node_factory, bitcoind)
| 268 | |
| 269 | @unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "BIP86 random_hsm not compatible with liquid-regtest bech32") |
| 270 | def test_addfunds_from_block(node_factory, bitcoind): |
| 271 | """Send funds to the daemon without telling it explicitly |
| 272 | """ |
| 273 | # Previous runs with same bitcoind can leave funds! |
| 274 | coin_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py') |
| 275 | l1 = node_factory.get_node(random_hsm=True, options={'plugin': coin_plugin}) |
| 276 | |
| 277 | addr = l1.rpc.newaddr(good_addrtype())[good_addrtype()] |
| 278 | bitcoind.rpc.sendtoaddress(addr, 0.1) |
| 279 | bitcoind.generate_block(1) |
| 280 | |
| 281 | wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 1) |
| 282 | |
| 283 | outputs = l1.db_query('SELECT value FROM outputs WHERE status=0;') |
| 284 | assert only_one(outputs)['value'] == 10000000 |
| 285 | |
| 286 | # The address we detect must match what was paid to. |
| 287 | output = only_one(l1.rpc.listfunds()['outputs']) |
| 288 | assert output['address'] == addr |
| 289 | |
| 290 | # Send all our money to a P2WPKH address this time. |
| 291 | addr = l1.rpc.newaddr("bech32")['bech32'] |
| 292 | l1.rpc.withdraw(addr, "all") |
| 293 | bitcoind.generate_block(1) |
| 294 | sync_blockheight(bitcoind, [l1]) |
| 295 | |
| 296 | # The address we detect must match what was paid to. |
| 297 | output = only_one(l1.rpc.listfunds()['outputs']) |
| 298 | assert output['address'] == addr |
| 299 | |
| 300 | # We don't print a 'external deposit' event |
| 301 | # for funds that come back to our own wallet |
| 302 | expected_utxos = { |
| 303 | '0': [('wallet', ['deposit'], ['withdrawal'], 'A')], |
| 304 | 'A': [('wallet', ['deposit'], None, None)], |
| 305 | } |
| 306 | |
| 307 | check_utxos_channel(l1, [], expected_utxos) |
| 308 | |
| 309 | |
| 310 | def test_txprepare_multi(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected