Send funds to the daemon without telling it explicitly
(node_factory, bitcoind)
| 233 | |
| 234 | |
| 235 | def test_addfunds_from_block(node_factory, bitcoind): |
| 236 | """Send funds to the daemon without telling it explicitly |
| 237 | """ |
| 238 | # Previous runs with same bitcoind can leave funds! |
| 239 | coin_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py') |
| 240 | l1 = node_factory.get_node(random_hsm=True, options={'plugin': coin_plugin}) |
| 241 | |
| 242 | addr = l1.rpc.newaddr()['bech32'] |
| 243 | bitcoind.rpc.sendtoaddress(addr, 0.1) |
| 244 | bitcoind.generate_block(1) |
| 245 | |
| 246 | wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 1) |
| 247 | |
| 248 | outputs = l1.db_query('SELECT value FROM outputs WHERE status=0;') |
| 249 | assert only_one(outputs)['value'] == 10000000 |
| 250 | |
| 251 | # The address we detect must match what was paid to. |
| 252 | output = only_one(l1.rpc.listfunds()['outputs']) |
| 253 | assert output['address'] == addr |
| 254 | |
| 255 | # Send all our money to a P2WPKH address this time. |
| 256 | addr = l1.rpc.newaddr("bech32")['bech32'] |
| 257 | l1.rpc.withdraw(addr, "all") |
| 258 | bitcoind.generate_block(1) |
| 259 | sync_blockheight(bitcoind, [l1]) |
| 260 | |
| 261 | # The address we detect must match what was paid to. |
| 262 | output = only_one(l1.rpc.listfunds()['outputs']) |
| 263 | assert output['address'] == addr |
| 264 | |
| 265 | # We don't print a 'external deposit' event |
| 266 | # for funds that come back to our own wallet |
| 267 | expected_utxos = { |
| 268 | '0': [('wallet', ['deposit'], ['withdrawal'], 'A')], |
| 269 | 'A': [('wallet', ['deposit'], None, None)], |
| 270 | } |
| 271 | |
| 272 | check_utxos_channel(l1, [], expected_utxos) |
| 273 | |
| 274 | |
| 275 | def test_txprepare_multi(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected