Test that the penalizing node claims any published HTLC transactions Node topology: l1 <-> l2 <-> l3 <-> l4 ^---> l5 l1 pushes money to l5, who doesn't fulfill (freezing htlc across l2-l3) l4 pushes money to l1, who doesn't fulfill (freezing ht
(node_factory, bitcoind, chainparams)
| 1314 | @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Makes use of the sqlite3 db") |
| 1315 | @pytest.mark.slow_test |
| 1316 | def test_penalty_htlc_tx_timeout(node_factory, bitcoind, chainparams): |
| 1317 | """ Test that the penalizing node claims any published |
| 1318 | HTLC transactions |
| 1319 | |
| 1320 | Node topology: |
| 1321 | l1 <-> l2 <-> l3 <-> l4 |
| 1322 | ^---> l5 |
| 1323 | |
| 1324 | l1 pushes money to l5, who doesn't fulfill (freezing htlc across l2-l3) |
| 1325 | l4 pushes money to l1, who doesn't fulfill (freezing htlc across l2-l3) |
| 1326 | we snapshot l2 |
| 1327 | l2 pushes money to l3 (updating state) |
| 1328 | l2 + l3 go offline; l2 is backed up from snapshot |
| 1329 | l1 fails the channel with l2, fulfilling the stranded htlc onchain |
| 1330 | l2 comes back online, force closes channel with l3 |
| 1331 | |
| 1332 | block chain advances, l2 broadcasts the timeout htlc_tx + fulfill htlc_tx |
| 1333 | both of which have a delay. l2 goes ahead and 'steals back' their |
| 1334 | output + the htlc they fulfill |
| 1335 | |
| 1336 | l3 comes back online, sees l2's cheat. takes funds from htlc timeout tx |
| 1337 | some blocks are mined. the dust settles. |
| 1338 | |
| 1339 | we check the accounting. |
| 1340 | """ |
| 1341 | |
| 1342 | # We track channel balances, to verify that accounting is ok. |
| 1343 | coin_mvt_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py') |
| 1344 | |
| 1345 | l1, l2, l3, l4, l5 = node_factory.get_nodes( |
| 1346 | 5, |
| 1347 | opts=[ |
| 1348 | { |
| 1349 | 'disconnect': ['-WIRE_UPDATE_FULFILL_HTLC'], |
| 1350 | 'may_reconnect': True, |
| 1351 | 'dev-no-reconnect': None, |
| 1352 | }, { |
| 1353 | 'plugin': coin_mvt_plugin, |
| 1354 | 'dev-no-reconnect': None, |
| 1355 | 'may_reconnect': True, |
| 1356 | 'allow_broken_log': True, |
| 1357 | }, { |
| 1358 | 'plugin': coin_mvt_plugin, |
| 1359 | 'dev-no-reconnect': None, |
| 1360 | 'may_reconnect': True, |
| 1361 | 'allow_broken_log': True, |
| 1362 | }, { |
| 1363 | 'dev-no-reconnect': None, |
| 1364 | }, { |
| 1365 | 'disconnect': ['-WIRE_UPDATE_FULFILL_HTLC'], |
| 1366 | 'may_reconnect': True, |
| 1367 | 'dev-no-reconnect': None, |
| 1368 | 'allow_broken_log': True, |
| 1369 | } |
| 1370 | ] |
| 1371 | ) |
| 1372 | |
| 1373 | node_factory.join_nodes([l1, l2, l3, l4], wait_for_announce=True) |
nothing calls this directly
no test coverage detected