Commit Graph

166 Commits

Author SHA1 Message Date
Sangbida Chaudhuri
1279a58910 pytest: changed old_hsmsecret to default to false.
This changes various tests in minor ways:

1. The "l2" secret key in tests/plugins/channeld_fakenet.c is updated.
2. The decompressed gossip data node id needs changing.
3. The coinmoves order changes in bookkeeper for anchors.
4. Various harcoded gossip constants change.
5. Some hardcoded makesecret results change.
6. zeroconf tests which hardcoded node ids change.
7. Arbitrary rune strings change.
8. A log message which uses node ids changes.
2026-01-27 09:32:49 +10:30
Rusty Russell
c10c54ff23 pytest: don't record IO when we kill nodes
```
ERROR tests/test_connection.py::test_channel_persistence - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```

Similarly:

```
ERROR tests/test_opening.py::test_sendpsbt_crash - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-14 15:41:45 +10:30
Rusty Russell
b15f386df6 pytest: fix bad gossip flake in test_buy_liquidity_ad_check_bookkeeping
If we don't wait for the channel announcement to be processed, we can
get bad gossip:

```
lightningd-2 2026-01-08T04:53:53.795Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#2: Funding tx 2f41b1cc99dea016b7feddbeb1f31ae21b30f56d77ecb2ecb2b2f0faff4808fe depth 12 of 1
lightningd-2 2026-01-08T04:53:53.795Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#2: Funding tx 2f41b1cc99dea016b7feddbeb1f31ae21b30f56d77ecb2ecb2b2f0faff4808fe confirmed, but peer in state ONCHAIN
lightningd-2 2026-01-08T04:53:53.802Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-onchaind-chan#2: Got new message WIRE_ONCHAIND_DEPTH
lightningd-2 2026-01-08T04:53:53.802Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-onchaind-chan#2: Sending 0 missing htlc messages
lightningd-2 2026-01-08T04:53:53.802Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-onchaind-chan#2: FUNDING_TRANSACTION/FUNDING_OUTPUT->MUTUAL_CLOSE depth 6
lightningd-2 2026-01-08T04:53:53.802Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-onchaind-chan#2: billboard: All outputs resolved: waiting 94 more blocks before forgetting channel
lightningd-2 2026-01-08T04:53:53.812Z DEBUG   gossipd: gossmap_manage: new block, adding 104x1x1 to pending...
lightningd-2 2026-01-08T04:53:53.812Z DEBUG   gossipd: REPLY WIRE_GOSSIPD_NEW_BLOCKHEIGHT_REPLY with 0 fds
lightningd-1 2026-01-08T04:53:53.819Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-connectd: peer_in WIRE_WARNING
lightningd-1 2026-01-08T04:53:53.820Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-connectd: Received WIRE_WARNING: WARNING: channel_announcement: no unspent txout 104x1x1
lightningd-2 2026-01-08T04:53:53.820Z TRACE   gossipd: channel_announcement: got reply for 104x1x1...
lightningd-2 2026-01-08T04:53:53.820Z TRACE   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-gossipd: Bad gossip order: channel_announcement: no unspent txout 104x1x1
lightningd-2 2026-01-08T04:53:53.820Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: peer_out WIRE_WARNING
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-08 22:33:19 +10:30
Rusty Russell
2520bd5b90 pytest: test withhold parameter to fundchannel_complete.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-19 07:23:39 +10:30
Rusty Russell
df5f38dbc1 spender: look for unsigned PSBT on awaiting channels on startup, and re-send.
This covers the other corner case, where we crash before actually
signing and sending the PSBT.  We can spot this because the channel is
in AWAITING_LOCKIN and we have a PSBT, but it's not signed yet.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-19 07:23:39 +10:30
Rusty Russell
409beb6923 pytest: test failure if we crash after fundchannel_complete but before sendpsbt.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-19 07:23:39 +10:30
Rusty Russell
d44fa2f3bd lightningd: re-xmit funding txs on startup.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Protocol: we now re-transmit unseen funding transactions on startup, for more robustness.
2025-11-19 07:23:39 +10:30
Rusty Russell
21d19546d5 pytest: test case where we crash before bitcoind gets the opening tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-19 07:23:39 +10:30
Rusty Russell
1e7ffeb89d tests: don't assume newaddr returns bech32 by default.
Either use p2tr (if not elements) or explicitly ask for a bech32 address.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-07 10:51:04 +10:30
Rusty Russell
0d97631075 connectd: simplify logic, and add a "reconnected" message.
One issue we have in CI is reconnection races: if an incoming
connection arrives while an outgoing one is negotiated, we close the
outgoing one and issue a disconnect, which fails any connect attempts.

By sending a "reconnected" message instead of disconnect/connect we
can avoid disturbing in-progress connection attempts which happens in CI
quite a bit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-01 12:12:56 +09:30
Rusty Russell
9b68ba0903 openingd: test that channel open seems possible before bothering peer.
Fixes: https://github.com/ElementsProject/lightning/issues/4873

In particular, we used to get upset when a peer accepts our channel,
if it was too small!  We should do reasonable checks first.

We no longer try to send requests to delay for 2017 blocks though,
so remove that test.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Protocol: trying to create a channel below our own min-capacity-sat will now fail before asking the peer, not with an error blaming the peer when they accept!
2025-08-18 16:19:22 +09:30
Rusty Russell
2ef776bd75 pytest: test that opening a channel below our own minimum fails *gracefully*.
At the moment it fails after the *peer* responds.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-08-18 16:19:22 +09:30
Rusty Russell
506fa914e0 lightningd: always tell openingd/dualopend what channel type we want.
Prior to it being compulsory, these daemons would need a default value.  Now it's
always required, it's clearer if it's always told.

There's no "default_channel_type" now everyone has to specify channel_type either,
so rename it to "desired_channel_type" and put it in lightningd specifically.

Note that the channel_type can have options added: either option_scid_alias or option_zeroconf.

This results in a slight behavior change: we will get type zeroconf even if we didn't ask for it, if they gave it to us.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: fundchannel / fundchannel_start returned `channel_type` will include option_zeroconf if it was implied by a 0 minimum_depth, even if we didn't explicitly ask for a zero conf channel.
2025-08-13 14:20:28 +09:30
Rusty Russell
a7316fef83 pytest: actually test channel_type when negotiating prviate channel.
Makes sure we don't break it!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-08-13 14:20:28 +09:30
Rusty Russell
193ac6fc77 pytest: test what happens if we *explicitly* ask for a zeroconf channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-08-13 14:20:28 +09:30
Rusty Russell
7893c878b1 pytest: use _ not - in plugin options to zeroconf-selective.py.
This allows us to specify:

	l2.rpc.plugin_start(plugin_path, zeroconf_allow=l1.info['id'])

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-08-13 14:20:28 +09:30
Rusty Russell
40dfbcc124 pytest: make test_v2_rbf_liquidity_ad more robust against other datastore users.
When peer backup is enabled by default, it puts things in the datastore, breaking
this assumption.  Narrow the test to examine the specific funder directory.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-16 23:39:35 +09:30
Rusty Russell
d39220ecbc pytest: fix flake in replay tests.
channeld complains if it sees blocks going backwards, but that's
actually expected: allow those log messages:

```
2025-05-13T10:28:56.3283346Z _______________ ERROR at teardown of test_v2_replay_bookkeeping ________________
...
2025-05-13T10:28:56.3301378Z             request.node.has_errors = True
2025-05-13T10:28:56.3301833Z >           raise ValueError(str(errors))
2025-05-13T10:28:56.3302268Z E           ValueError: 
2025-05-13T10:28:56.3303425Z E           Node errors:
2025-05-13T10:28:56.3303923Z E            - lightningd-1: had BROKEN messages
2025-05-13T10:28:56.3304404Z E           Global errors:
...
2025-05-13T10:28:56.4619742Z lightningd-1 2025-05-13T10:24:38.112Z **BROKEN** 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#2: current blockheight 109 less than last 111
2025-05-13T10:28:56.4620188Z lightningd-2 2025-05-13T10:24:38.112Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-channeld-chan#2: peer_in WIRE_SHUTDOWN
2025-05-13T10:28:56.4620600Z lightningd-1 2025-05-13T10:24:38.112Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#2: Trying commit
2025-05-13T10:28:56.4621119Z lightningd-2 2025-05-13T10:24:38.112Z INFO    0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#2: State changed from CHANNELD_NORMAL to CHANNELD_SHUTTING_DOWN
2025-05-13T10:28:56.4621623Z lightningd-1 2025-05-13T10:24:38.112Z **BROKEN** 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#2: current blockheight 109 less than last 111
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-14 12:19:10 +09:30
Rusty Russell
c6566cd6fd pytest: fix flake in test_zeroconf_forget
```
2025-05-12T04:37:57.4824338Z         else:
2025-05-12T04:37:57.4824626Z             # It will forget the older one.
2025-05-12T04:37:57.4825508Z >           l2.daemon.wait_for_log(r"UNUSUAL {}-chan#1: Forgetting channel: It has been {} blocks without the funding transaction ".format(l1.info['id'], blocks + 1))
```

This fails because l3 can still transmit, so the second channel can confirm in time.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-14 12:19:10 +09:30
Rusty Russell
2a42125278 pytest: fix flake in test_rbf_to_chain_before_commit
Once we speed things up, this can receive COMMITMENT_SIGNED, and hence succeed.  Let's
drop on receive, not send!

```
2025-05-06T06:07:51.5997333Z         # Peers try RBF, break on initial COMMITMENT_SIGNED
2025-05-06T06:07:51.5997855Z         bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt'])
2025-05-06T06:07:51.5998214Z >       with pytest.raises(RpcError):
2025-05-06T06:07:51.5998542Z E       Failed: DID NOT RAISE <class 'pyln.client.lightning.RpcError'>
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-08 14:01:38 +09:30
Rusty Russell
86e5b146b6 pytest: fix flake in test_rbf_reconnect_tx_construct
Once we speed things up, we can *receive* commitment_signed before we disconnect
due to sending ours: in this case, we *will* have a scratch tx.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-08 14:01:38 +09:30
Rusty Russell
8e41ee4eac pytest: fix another flake in test_zeroconf_forget.
fundwallet generates a block: if l2 sees one block and not the other, it can
consider the time on the first fundchannel to be one block earlier than expected:

```
2025-05-05T21:05:33.6260600Z E                   TimeoutError: Unable to find "[re.compile('UNUSUAL 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Forgetting channel: It has been 51 blocks without the funding transaction ')]" in logs.
...
2025-05-05T21:05:33.7179461Z lightningd-2 2025-05-05T20:44:26.141Z UNUSUAL 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Forgetting channel: It has been 52 blocks without the funding transaction 5a18d113f53df8b205ab679924babde4068f2d1876d34edc43701bf92b8ff13f getting deeply confirmed. We are fundee and can forget channel without loss of funds.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-06 12:27:53 +09:30
Rusty Russell
1d5cb4b49c bitcoin: fix out-by-one-error in bitcoin_tx_input_weight.
We need one byte for the number of witness elements.  Some callers added it themselves,
but it's always needed.  So document and fix the callers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-06 12:27:53 +09:30
Rusty Russell
4ed0435619 pytest: fix block count in test_zeroconf_forget.
We actually need to mine another block, so that lightningd considers both
channels candidates for forgetting (and forgets the older one).

Reported-by: daywalker90
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-05 12:44:46 -07:00
Rusty Russell
a12c02b1d0 pytest: fix race in test_zeroconf_forget
fundwallet() actually mines a block, putting our count out.  If we see
both blocks at once, we will say "52" blocks instead of "51":

```
2025-05-02T05:28:40.5315155Z         have_forgotten = l2.daemon.is_in_log(
2025-05-02T05:28:40.5315650Z             r"UNUSUAL {}-chan#1: Forgetting channel: It has been 51 blocks without the funding transaction ".format(l1.info['id'])
2025-05-02T05:28:40.5316105Z         )
2025-05-02T05:28:40.5316263Z     
2025-05-02T05:28:40.5316417Z         if dopay:
2025-05-02T05:28:40.5316616Z             assert not have_forgotten
2025-05-02T05:28:40.5317056Z             assert set([c['peer_id'] for c in l2.rpc.listpeerchannels()["channels"]]) == set([l1.info['id'], l3.info['id']])
2025-05-02T05:28:40.5317477Z         else:
2025-05-02T05:28:40.5317662Z >           assert have_forgotten
2025-05-02T05:28:40.5317887Z E           assert None
```

```
0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Forgetting channel: It has been 52 blocks without the funding transaction 0bb0579df6b1d983dda49dad47513afc71696c9d5bea3c8b955ba4b76bb053de getting deeply confirmed. We are fundee and can forget channel without loss of funds.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-02 13:25:11 -07:00
Rusty Russell
3b80a81031 lightningd: allow up to 100 "slow open" channels before forgetting them.
Michael of Boltz told me this long ago, that when fees spiked some of their clients' opens got stuck.  After two weeks their node forgot them, and when fees came back down the opens still failed.  Unfortunately, I can't see an issue for this!

We can give some grace: we don't want to waste too many resources, but 100 channels is nothing.

The test needs to be adjusted to have *two* slow open channels, now.

Changelog-Changed: Protocol: we won't forget still-opening channels after 2016 blocks, unless there are more than 100.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-04-29 13:31:23 +09:30
Christian Decker
2b761b00b8 pytest: Test that we don't forget zeroconf channels
Modified by Rusty:
- Simplify (we only need to suppress l1's txs, since it opens)
- Use synchronize_blockheight instead of log messages to ensure l2 has processed the block
- Use listpeerchannels instead of log messages for balance (should be more robust against changes)
- Open-code assertions for better debugging if they're wrong.
2025-03-19 17:32:26 +01:00
Rusty Russell
e1e476fd39 pytest: mark test_rbf_reconnect_tx_construct flaky:
Doesn't always die messily, it seems?


```
    @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
    @pytest.mark.openchannel('v2')
    def test_rbf_reconnect_tx_construct(node_factory, bitcoind, chainparams):
        disconnects = ['=WIRE_TX_ADD_INPUT',  # Initial funding succeeds
                       '-WIRE_TX_ADD_INPUT',
                       '+WIRE_TX_ADD_INPUT',
                       '-WIRE_TX_ADD_OUTPUT',
                       '+WIRE_TX_ADD_OUTPUT',
                       '-WIRE_TX_COMPLETE',
                       '+WIRE_TX_COMPLETE',
                       '-WIRE_COMMITMENT_SIGNED',
                       '+WIRE_COMMITMENT_SIGNED']
    
        l1, l2 = node_factory.get_nodes(2,
                                        opts=[{'disconnect': disconnects,
                                               'may_reconnect': True,
                                               'dev-no-reconnect': None},
                                              {'may_reconnect': True,
                                               'dev-no-reconnect': None,
                                               'broken_log': 'dualopend daemon died before signed PSBT returned'}])
    
        l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
        amount = 2**24
        chan_amount = 100000
        bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'], amount / 10**8 + 0.01)
        bitcoind.generate_block(1)
        # Wait for it to arrive.
        wait_for(lambda: len(l1.rpc.listfunds()['outputs']) > 0)
    
        res = l1.rpc.fundchannel(l2.info['id'], chan_amount)
        chan_id = res['channel_id']
        vins = bitcoind.rpc.decoderawtransaction(res['tx'])['vin']
        assert(only_one(vins))
        prev_utxos = ["{}:{}".format(vins[0]['txid'], vins[0]['vout'])]
    
        # Check that we're waiting for lockin
        l1.daemon.wait_for_log(' to DUALOPEND_AWAITING_LOCKIN')
    
        # rbf the lease with a higher amount
        rate = int(find_next_feerate(l1, l2)[:-5])
        # We 4x the feerate to beat the min-relay fee
        next_feerate = '{}perkw'.format(rate * 4)
    
        # Initiate an RBF
        startweight = 42 + 172  # base weight, funding output
        initpsbt = l1.rpc.utxopsbt(chan_amount, next_feerate, startweight,
                                   prev_utxos, reservedok=True,
                                   excess_as_change=True)
    
        # Run through TX_ADD wires
        for d in disconnects[1:-4]:
            l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
            with pytest.raises(RpcError):
                l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt'])
            wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'] is False)
    
        # The first TX_COMPLETE breaks
        l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
        bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt'])
        with pytest.raises(RpcError):
            update = l1.rpc.openchannel_update(chan_id, bump['psbt'])
        wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'] is False)
        l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
        # l1 should remember, l2 has forgotten
        # l2 should send tx-abort, to reset
        l2.daemon.wait_for_log(r'tx-abort: Sent next_funding_txid .* doesn\'t match ours .*')
        l1.daemon.wait_for_log(r'Cleaned up incomplete inflight')
        # abort doesn't cause a disconnect
        assert l1.rpc.getpeer(l2.info['id'])['connected']
    
        # The next TX_COMPLETE break (both remember) + they break on the
        # COMMITMENT_SIGNED during the reconnect
        bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt'])
        with pytest.raises(RpcError):
            update = l1.rpc.openchannel_update(chan_id, bump['psbt'])
        wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'] is False)
        l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
        l2.daemon.wait_for_logs([r'Got dualopend reestablish',
                                 r'No commitment, not sending our sigs'])
        l1.daemon.wait_for_logs([r'Got dualopend reestablish',
                                 r'No commitment, not sending our sigs',
                                 r'dev_disconnect: -WIRE_COMMITMENT_SIGNED',
                                 'peer_disconnect_done'])
        assert not l1.rpc.getpeer(l2.info['id'])['connected']
        l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
    
        # COMMITMENT_SIGNED disconnects *during* the reconnect
        # We can't bump because the last negotiation is in the wrong state
        with pytest.raises(RpcError, match=r'Funding sigs for this channel not secured'):
            l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt'])
        # l2 reconnects, but doesn't have l1's commitment
>       l2.daemon.wait_for_logs([r'Got dualopend reestablish',
                                 r'No commitment, not sending our sigs',
                                 # This is a BROKEN log, it's expected!
                                 r'dualopend daemon died before signed PSBT returned'])

tests/test_opening.py:944: 
...
>                   raise TimeoutError('Unable to find "{}" in logs.'.format(exs))
E                   TimeoutError: Unable to find "[re.compile('dualopend daemon died before signed PSBT returned')]" in logs.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-01-27 11:07:04 +10:30
Rusty Russell
229fc3f2b4 xpay: make the xpay layer persistent.
As the first user of a persistent layer, this tripped tests which
assumed the datastore would be empty!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
c79a89d557 pytest: adapt tests to avoid deprecated APIs in close (tx and txid).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 16:04:06 +10:30
Rusty Russell
fcebb33180 lightningd: deprecate decodepay.
It only works on BOLT11, and has long been replaced by the more
generic "decode".

Removing it will stop the confusion!

(Note: documentation claims it was introduced in 23.08, but that was
 wrong, as it's been in CLN since the beginning).

[ Fixup from: niftynei <niftynei@gmail.com> ]
Fixes: https://github.com/ElementsProject/lightning/issues/6419
Changelog-Deprecated: JSON-RPC: `decodepay`: use `decode`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:21:23 +10:30
Rusty Russell
991f6dcb0f config: actually deprecate --experimental-anchors.
Document and enforce the --experimental-anchors deprecation, which was somehow missed in v24.02

Changelog-Deprecated: Config: the --experimental-anchors option is ignored (on by default since v24.02).
2024-07-09 15:09:29 +02:00
Rusty Russell
7f2aedc76f common: BOLT update: option_anchors_zero_fee_htlc_tx is now simply "option_anchors".
This is a difficult transition for us: this string appears in channel
types.  We make the transition now in the understanding that it will
be more difficult in future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Changelog-Deprecated: JSON-RPC: `listpeers` `features` array string "option_anchors_zero_fee_htlc_tx": use "option_anchors" (spec renamed it).
Changelog-Added: JSON-RPC: `listpeers` `features` array string uses "option_anchors" for feature 22/23, following renaming in BOLT 9.
Changelog-Changed: JSON-RPC: `listclosedchannels`, `listpeerchannels`, `openchannel_update`, `openchannel_init`, `fundchannel`, `fundchannel_start` and `multifundchannel`: `channel_type` array `names` now contains "anchors" instead of "anchors_zero_fee_htlc_tx".
Changelog-Changed: lightningd: `--list-features-only` now lists "option_anchors" instead of "option_anchors_zero_fee_htlc_tx".
2024-06-19 15:54:24 +09:30
Alex Myers
840374653a pytest: fix flake in test_rbf_non_last_mined
A race condition seemed to be redirecting rpc before bitcoind processed
the second rbf transaction.
2024-05-09 16:14:23 -05:00
Alex Myers
231a3bd9e8 pytest: update dual-fund tests
removing min-witness-weight requirement
2024-05-09 16:14:23 -05:00
Rusty Russell
901342b50d pyln-testing: require explicit pattern for BROKEN messages.
Rather than `allow_broken_log`, we have `broken_log` which is a regex
indicating what log lines are expected.  This tightens our tests
significantly, as it will catch *unexpected* brokenness.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-04-20 16:36:57 +09:30
Rusty Russell
f3cedb9aa7 pytest: rename lightning nodes to reduce confusion.
I was trying to debug test_zeroconf_open and getting very confused.
The reason: l0 is lightning-1, l1 is lightning-2, etc!  And there are
two other tests where an l0 has been added at the front: fix them all
to avoid future confusion!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-04-01 13:20:53 +02:00
Rusty Russell
42207eb239 plugins/spender: fix multifundchannel all on more than 1 channel.
We tried to put *everything* into the "all" output, which didn't work
if there were other outputs!

Fixes: https://github.com/ElementsProject/lightning/issues/6664
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `multifundchannel` with `all` as an amount works as expected.
2024-03-21 19:52:56 +10:30
daywalker90
59b6cf8253 tests: multifundchannel and "all" amount 2024-03-21 19:52:56 +10:30
Rusty Russell
689e596036 options: make anchors enabled by default, ignore experimental-anchors.
We still want to test non-anchor channels, as we still support them, but
we've made it non-experimental.  To test non-anchor channels, we
use dev-force-features: -23.

Changelog-Added: Protocol: `option_anchors_zero_fee_htlc_tx` enabled, no longer experimental.
Changelog-Changed: Config: `experimental-anchors` now does nothing (it's enabled by default).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


Header from folded patch 'fixup!_options__make_anchors_enabled_by_default,_ignore_experimental-anchors.patch':

fixup! options: make anchors enabled by default, ignore experimental-anchors.
2024-02-08 06:32:01 +10:30
Rusty Russell
8c52efce37 funder: don't try to spend emergency_reserve
We might have (or be getting!) anchor channels, so keep this aside when funding.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-08 06:32:01 +10:30
Rusty Russell
97ccf05117 lightningd: ignore gossip messages from channeld, switch to our own.
This commit is a bit messy, but it tries to do the minimal switchover.

Some tests change, so those are included here. 

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-31 14:47:33 +10:30
Rusty Russell
a27bbbb734 pytest: fix up test_zeroconf_multichan_forward once routehints fixed.
After this, the invoice (correctly!) gives the zeroconf channel as a routehint,
so this test fails.  Simple workaround: make invoice before creating zeroconf
channel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-31 09:15:46 +10:30
Rusty Russell
11fa3da4cc pytest: Remove check for to-be-removed message about msg from channeld.
This race is resolved with the gossipd changes (and this message is
also removed!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-31 09:15:46 +10:30
Rusty Russell
8f9af62228 pytest: make sure listincoming sees remote update in test_zeroconf_forward.
Otherwise we get no routehint.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-31 09:15:46 +10:30
Rusty Russell
6778f320d2 openingd: make channel-type rejection message clearer.
For example, lnprototest got the error 'You gave bad parameters: Did not support channel_type ' which doesn't make it clear that it's rejecting the empty channel type.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-29 13:40:34 +10:30
Rusty Russell
b805899b06 pytest: check that listpeerchannels gives the same channel type as returned from fund/openchannel
Could have done this in an earlier commit, but that would be a messy rebase.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-29 13:40:34 +10:30
Rusty Russell
17d0d006d2 fundchannel_start & multifundchannel: add channel_type.
Let's tell the caller what channel_type they got!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `fundchannel`, `multifundchannel`, `fundchannel_start` and `openchannel_init`: new field `channel_type`.
2024-01-29 13:40:34 +10:30
Rusty Russell
08e29ab47f lightningd: make option_static_remotekey compulsory.
As suggested in https://github.com/lightning/bolts/pull/1092.

We still support channels opened without it, but you can no longer open new ones without it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Protocol: `option_gossip_queries` is now required (advertized by all but 16 nodes)
2024-01-29 13:40:34 +10:30
Rusty Russell
e531ff83b3 lightningd: add dev-any-channel-type to allow obsolete channel types.
We're about to make static_remotekey compulsory, but we still want to
do tests for pre-existing channels.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-29 13:40:34 +10:30