(node_factory, bitcoind, chainparams)
| 850 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 851 | @pytest.mark.openchannel('v2') |
| 852 | def test_rbf_reconnect_tx_construct(node_factory, bitcoind, chainparams): |
| 853 | disconnects = ['=WIRE_TX_ADD_INPUT', # Initial funding succeeds |
| 854 | '-WIRE_TX_ADD_INPUT', |
| 855 | '+WIRE_TX_ADD_INPUT', |
| 856 | '-WIRE_TX_ADD_OUTPUT', |
| 857 | '+WIRE_TX_ADD_OUTPUT', |
| 858 | '-WIRE_TX_COMPLETE', |
| 859 | '+WIRE_TX_COMPLETE', |
| 860 | '-WIRE_COMMITMENT_SIGNED', |
| 861 | '+WIRE_COMMITMENT_SIGNED'] |
| 862 | |
| 863 | l1, l2 = node_factory.get_nodes(2, |
| 864 | opts=[{'disconnect': disconnects, |
| 865 | 'may_reconnect': True, |
| 866 | 'dev-no-reconnect': None}, |
| 867 | {'may_reconnect': True, |
| 868 | 'dev-no-reconnect': None, |
| 869 | 'broken_log': 'dualopend daemon died before signed PSBT returned'}]) |
| 870 | |
| 871 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 872 | amount = 2**24 |
| 873 | chan_amount = 100000 |
| 874 | bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['p2tr'], amount / 10**8 + 0.01) |
| 875 | bitcoind.generate_block(1) |
| 876 | # Wait for it to arrive. |
| 877 | wait_for(lambda: len(l1.rpc.listfunds()['outputs']) > 0) |
| 878 | |
| 879 | res = l1.rpc.fundchannel(l2.info['id'], chan_amount) |
| 880 | chan_id = res['channel_id'] |
| 881 | vins = bitcoind.rpc.decoderawtransaction(res['tx'])['vin'] |
| 882 | assert(only_one(vins)) |
| 883 | prev_utxos = ["{}:{}".format(vins[0]['txid'], vins[0]['vout'])] |
| 884 | |
| 885 | # Check that we're waiting for lockin |
| 886 | l1.daemon.wait_for_log(' to DUALOPEND_AWAITING_LOCKIN') |
| 887 | |
| 888 | # rbf the lease with a higher amount |
| 889 | rate = int(find_next_feerate(l1, l2)[:-5]) |
| 890 | # We 4x the feerate to beat the min-relay fee |
| 891 | next_feerate = '{}perkw'.format(rate * 4) |
| 892 | |
| 893 | # Initiate an RBF |
| 894 | startweight = 42 + 172 # base weight, funding output |
| 895 | initpsbt = l1.rpc.utxopsbt(chan_amount, next_feerate, startweight, |
| 896 | prev_utxos, reservedok=True, |
| 897 | excess_as_change=True) |
| 898 | |
| 899 | # Run through TX_ADD wires |
| 900 | for d in disconnects[1:-4]: |
| 901 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 902 | with pytest.raises(RpcError): |
| 903 | l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt']) |
| 904 | wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'] is False) |
| 905 | |
| 906 | # The first TX_COMPLETE breaks |
| 907 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 908 | bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt']) |
| 909 | with pytest.raises(RpcError): |
nothing calls this directly
no test coverage detected