Test that penalty transactions are RBFed.
(node_factory, bitcoind, executor, chainparams, anchors)
| 1599 | |
| 1600 | @pytest.mark.parametrize("anchors", [False, True]) |
| 1601 | def test_penalty_rbf_normal(node_factory, bitcoind, executor, chainparams, anchors): |
| 1602 | ''' |
| 1603 | Test that penalty transactions are RBFed. |
| 1604 | ''' |
| 1605 | if chainparams['elements'] and anchors: |
| 1606 | pytest.skip('elementsd anchors unsupported') |
| 1607 | |
| 1608 | # We track channel balances, to verify that accounting is ok. |
| 1609 | coin_mvt_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py') |
| 1610 | to_self_delay = 10 |
| 1611 | opts = {'dev-disable-commit-after': 1} |
| 1612 | if anchors is False: |
| 1613 | opts['dev-force-features'] = "-23" |
| 1614 | |
| 1615 | # l1 is the thief, which causes our honest upstanding lightningd |
| 1616 | # code to break, so l1 can fail. |
| 1617 | # Initially, disconnect before the HTLC can be resolved. |
| 1618 | l1 = node_factory.get_node(options=opts, may_fail=True) |
| 1619 | l2 = node_factory.get_node(options={**opts, |
| 1620 | **{'watchtime-blocks': to_self_delay, |
| 1621 | 'plugin': coin_mvt_plugin}}) |
| 1622 | |
| 1623 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 1624 | l1.fundchannel(l2, 10**7) |
| 1625 | channel_id = first_channel_id(l1, l2) |
| 1626 | scid = first_scid(l1, l2) |
| 1627 | |
| 1628 | # Trigger an HTLC being added. |
| 1629 | t = executor.submit(l1.pay, l2, 1000000 * 1000) |
| 1630 | |
| 1631 | # Make sure the channel is still alive. |
| 1632 | assert l1.is_local_channel_active(scid) |
| 1633 | assert l2.is_local_channel_active(scid) |
| 1634 | |
| 1635 | # Wait for the disconnection. |
| 1636 | l1.daemon.wait_for_log('dev-disable-commit-after: disabling') |
| 1637 | l2.daemon.wait_for_log('dev-disable-commit-after: disabling') |
| 1638 | # Make sure l1 gets the new HTLC. |
| 1639 | l1.daemon.wait_for_log('got commitsig') |
| 1640 | |
| 1641 | # l1 prepares a theft commitment transaction |
| 1642 | theft_tx = l1.rpc.dev_sign_last_tx(l2.info['id'])['tx'] |
| 1643 | |
| 1644 | # Now continue processing until fulfilment. |
| 1645 | l1.rpc.dev_reenable_commit(l2.info['id']) |
| 1646 | l2.rpc.dev_reenable_commit(l1.info['id']) |
| 1647 | |
| 1648 | # Wait for the fulfilment. |
| 1649 | l1.daemon.wait_for_log('peer_in WIRE_UPDATE_FULFILL_HTLC') |
| 1650 | l1.daemon.wait_for_log('peer_out WIRE_REVOKE_AND_ACK') |
| 1651 | l2.daemon.wait_for_log('peer_out WIRE_UPDATE_FULFILL_HTLC') |
| 1652 | l1.daemon.wait_for_log('peer_in WIRE_REVOKE_AND_ACK') |
| 1653 | |
| 1654 | # Now payment should complete. |
| 1655 | t.result(timeout=10) |
| 1656 | |
| 1657 | # l1 goes offline and bribes the miners to censor transactions from l2. |
| 1658 | l1.rpc.stop() |
nothing calls this directly
no test coverage detected