(node_factory, bitcoind, chainparams)
| 851 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 852 | @pytest.mark.openchannel('v2') |
| 853 | def test_v2_rbf_multi(node_factory, bitcoind, chainparams): |
| 854 | l1, l2 = node_factory.get_nodes(2, |
| 855 | opts={'may_reconnect': True, |
| 856 | 'dev-no-reconnect': None, |
| 857 | 'allow_warning': True}) |
| 858 | |
| 859 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 860 | amount = 2**24 |
| 861 | chan_amount = 100000 |
| 862 | bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['p2tr'], amount / 10**8 + 0.01) |
| 863 | bitcoind.generate_block(1) |
| 864 | # Wait for it to arrive. |
| 865 | wait_for(lambda: len(l1.rpc.listfunds()['outputs']) > 0) |
| 866 | |
| 867 | res = l1.rpc.fundchannel(l2.info['id'], chan_amount) |
| 868 | chan_id = res['channel_id'] |
| 869 | vins = bitcoind.rpc.decoderawtransaction(res['tx'])['vin'] |
| 870 | assert(only_one(vins)) |
| 871 | prev_utxos = ["{}:{}".format(vins[0]['txid'], vins[0]['vout'])] |
| 872 | |
| 873 | # Check that we're waiting for lockin |
| 874 | l1.daemon.wait_for_log(' to DUALOPEND_AWAITING_LOCKIN') |
| 875 | |
| 876 | # Attempt to do abort, should fail since we've |
| 877 | # already gotten an inflight |
| 878 | with pytest.raises(RpcError): |
| 879 | l1.rpc.openchannel_abort(chan_id) |
| 880 | |
| 881 | rate = int(find_next_feerate(l1, l2)[:-5]) |
| 882 | # We 4x the feerate to beat the min-relay fee |
| 883 | next_feerate = '{}perkw'.format(rate * 4) |
| 884 | |
| 885 | # Initiate an RBF |
| 886 | startweight = 42 + 172 # base weight, funding output |
| 887 | initpsbt = l1.rpc.utxopsbt(chan_amount, next_feerate, startweight, |
| 888 | prev_utxos, reservedok=True, |
| 889 | excess_as_change=True) |
| 890 | |
| 891 | # Do the bump |
| 892 | bump = l1.rpc.openchannel_bump(chan_id, chan_amount, |
| 893 | initpsbt['psbt'], |
| 894 | funding_feerate=next_feerate) |
| 895 | |
| 896 | # Abort this open attempt! We will re-try |
| 897 | aborted = l1.rpc.openchannel_abort(chan_id) |
| 898 | assert not aborted['channel_canceled'] |
| 899 | # We no longer disconnect on aborts, because magic! |
| 900 | assert only_one(l1.rpc.listpeers()['peers'])['connected'] |
| 901 | |
| 902 | # Do the bump, again, same feerate |
| 903 | bump = l1.rpc.openchannel_bump(chan_id, chan_amount, |
| 904 | initpsbt['psbt'], |
| 905 | funding_feerate=next_feerate) |
| 906 | |
| 907 | update = l1.rpc.openchannel_update(chan_id, bump['psbt']) |
| 908 | assert update['commitments_secured'] |
| 909 | |
| 910 | # Sign our inputs, and continue |
nothing calls this directly
no test coverage detected