MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_change_chaining

Function test_change_chaining

tests/test_connection.py:3444–3466  ·  view source on GitHub ↗

Test change chaining of unconfirmed fundings Change chaining is the case where one transaction is broadcast but not confirmed yet and we already build a followup on top of the change. If the first transaction doesn't confirm we may end up creating a series of unconfirmable transacti

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

3442@pytest.mark.openchannel('v1')
3443@pytest.mark.openchannel('v2')
3444def test_change_chaining(node_factory, bitcoind):
3445 """Test change chaining of unconfirmed fundings
3446
3447 Change chaining is the case where one transaction is broadcast but not
3448 confirmed yet and we already build a followup on top of the change. If the
3449 first transaction doesn't confirm we may end up creating a series of
3450 unconfirmable transactions. This is why we generally disallow chaining.
3451
3452 """
3453 l1, l2, l3 = node_factory.get_nodes(3)
3454 l1.fundwallet(10**8) # This will create an output with 1 confirmation
3455
3456 # Now fund a channel from l1 to l2, that should succeed, with minconf=1 but not before
3457 l1.connect(l2)
3458 with pytest.raises(RpcError):
3459 l1.rpc.fundchannel(l2.info['id'], 10**7, minconf=2)
3460 l1.rpc.fundchannel(l2.info['id'], 10**7) # Defaults to minconf=1
3461
3462 # We don't have confirmed outputs anymore, so this should fail without minconf=0
3463 l1.connect(l3)
3464 with pytest.raises(RpcError):
3465 l1.rpc.fundchannel(l3.info['id'], 10**7) # Defaults to minconf=1
3466 l1.rpc.fundchannel(l3.info['id'], 10**7, minconf=0)
3467
3468
3469@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "Fees on elements are different")

Callers

nothing calls this directly

Calls 4

get_nodesMethod · 0.80
fundwalletMethod · 0.80
connectMethod · 0.45
fundchannelMethod · 0.45

Tested by

no test coverage detected