Commit Graph

13301 Commits

Author SHA1 Message Date
Rusty Russell 0d34f4916e pytest: fix timeout in test_sql
The logs show we're not waiting for the right transaction, so be explicit.

```
        # Check that channels gets refreshed!
        scid = l1.get_channel_scid(l2)
        l1.rpc.setchannel(scid, feebase=123)
        wait_for(lambda: l3.rpc.sql("SELECT short_channel_id FROM channels WHERE base_fee_millisatoshi = 123;")['rows'] == [[scid]])
        l3.daemon.wait_for_log("Refreshing channels...")
        l3.daemon.wait_for_log("Refreshing channel: {}".format(scid))
    
        # This has to wait for the hold_invoice plugin to let go!
        l1.rpc.close(l2.info['id'])
        bitcoind.generate_block(13, wait_for_mempool=1)
>       wait_for(lambda: len(l3.rpc.listchannels()['channels']) == 2)

tests/test_plugin.py:4143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

success = <function test_sql.<locals>.<lambda> at 0x7fde3b9cd3a0>, timeout = 180

    def wait_for(success, timeout=TIMEOUT):
        start_time = time.time()
        interval = 0.25
        while not success():
            time_left = start_time + timeout - time.time()
            if time_left <= 0:
>               raise ValueError("Timeout while waiting for {}".format(success))
E               ValueError: Timeout while waiting for <function test_sql.<locals>.<lambda> at 0x7fde3b9cd3a0>
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 08:52:55 +09:30
Rusty Russell 6a7a0ea7d0 pytest: fix flake handling intest_restorefrompeer.
We tried to fix this flake before, but now it actually happened again it shows that
b5845afd43 wasn't correct.

```
        # If this happens fast enough, connect fails with "disconnected
        # during connection"
        try:
            l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
        except RpcError as err:
>           assert "disconnected during connection" in err.error
E           assert 'disconnected during connection' in {'code': 402, 'message': 'disconnected during connection'}
E            +  where {'code': 402, 'message': 'disconnected during connection'} = RpcError("RPC call failed: method: connect, payload: {'id': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59', 'host': 'localhost', 'port': 41849}, error: {'code': 402, 'message': 'disconnected during connection'}").error

tests/test_misc.py:2728: AssertionError
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 08:52:55 +09:30
Rusty Russell 36b323e6d2 connectd: fix memleak report.
h->ss is allocated, but the previous not freed.  It will be freed as soon as the
`struct handshake` is freed, but a temporary "leak" got reported:

```
**BROKEN** connectd: MEMLEAK: 0x55adfcff2f48
**BROKEN** connectd:   label=connectd/handshake.c:647:struct secret
**BROKEN** connectd:   backtrace:
**BROKEN** connectd:     ccan/ccan/tal/tal.c:477 (tal_alloc_)
**BROKEN** connectd:     connectd/handshake.c:647 (act_one_initiator)
**BROKEN** connectd:     connectd/handshake.c:1023 (initiator_handshake_)
**BROKEN** connectd:     connectd/connectd.c:615 (connection_out)
**BROKEN** connectd:     ccan/ccan/io/io.c:59 (next_plan)
**BROKEN** connectd:     ccan/ccan/io/io.c:407 (do_plan)
**BROKEN** connectd:     ccan/ccan/io/io.c:423 (io_ready)
**BROKEN** connectd:     ccan/ccan/io/poll.c:453 (io_loop)
**BROKEN** connectd:     connectd/connectd.c:2215 (main)
**BROKEN** connectd:   parents:
**BROKEN** connectd:     connectd/handshake.c:402:struct handshake
**BROKEN** connectd:     connectd/connectd.c:1774:struct connecting
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 08:52:55 +09:30
Rusty Russell 2e28226e18 pytest: fix timeout in test_channel_lease_unilat_closes
Sometimes syncing 4032 blocks can take too long:

```
        # This can timeout, so do it in easy stages.
        for i in range(16):
            bitcoind.generate_block(4032 // 16)
>       sync_blockheight(bitcoind, [l2, l3])

tests/test_closing.py:996: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
contrib/pyln-testing/pyln/testing/utils.py:135: in sync_blockheight
    wait_for(lambda: n.rpc.getinfo()['blockheight'] == height)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

success = <function sync_blockheight.<locals>.<lambda> at 0x7ffb00227670>
timeout = 180

    def wait_for(success, timeout=TIMEOUT):
        start_time = time.time()
        interval = 0.25
        while not success():
            time_left = start_time + timeout - time.time()
            if time_left <= 0:
>               raise ValueError("Timeout while waiting for {}".format(success))
E               ValueError: Timeout while waiting for <function sync_blockheight.<locals>.<lambda> at 0x7ffb00227670>
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 08:52:55 +09:30
Rusty Russell e91f8ddb51 pytest: fix test_anchor_min_emergency "bad gossip" messages.
l1 shuts down too fast, channeld doesn't get to tell gossipd about the channel,
and l2 sends (private) update_channel and we complain:

```
lightningd-2 2023-07-20T03:42:37.744Z DEBUG   gossipd: received private channel announcement from channeld for 103x1x0
lightningd-2 2023-07-20T03:42:37.791Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-hsmd: Got WIRE_HSMD_CUPDATE_SIG_REQ
lightningd-2 2023-07-20T03:42:37.796Z DEBUG   hsmd: Client: Received message 3 from client
lightningd-1 2023-07-20T03:42:37.857Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-gossipd: Bad gossip order: WIRE_CHANNEL_UPDATE before announcement 103x1x0/0
lightningd-1 2023-07-20T03:42:37.864Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-gossipd: Bad gossip order: WIRE_CHANNEL_UPDATE before announcement 103x1x0/0
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 08:52:55 +09:30
Rusty Russell c205970035 connectd: fix transient memleak report.
We left their_features dangling allocated off the hook_payload, whereas
we explicitly move it to the peer, so steal/take it onto that.

```
- Node /tmp/ltests-gh55a_h2/test_connection_moved_1/lightning-2/ has memory leaks: [
    {
        "backtrace": [
            "/home/runner/work/lightning/lightning/ccan/ccan/tal/tal.c:477 (tal_alloc_)",
            "/home/runner/work/lightning/lightning/ccan/ccan/tal/tal.c:506 (tal_alloc_arr_)",
            "/home/runner/work/lightning/lightning/connectd/connectd_wiregen.c:410 (fromwire_connectd_peer_connected)",
            "/home/runner/work/lightning/lightning/lightningd/peer_control.c:1418 (peer_connected)",
            "/home/runner/work/lightning/lightning/lightningd/connect_control.c:592 (connectd_msg)",
            "/home/runner/work/lightning/lightning/lightningd/subd.c:557 (sd_msg_read)",
            "/home/runner/work/lightning/lightning/ccan/ccan/io/io.c:59 (next_plan)",
            "/home/runner/work/lightning/lightning/ccan/ccan/io/io.c:407 (do_plan)",
            "/home/runner/work/lightning/lightning/ccan/ccan/io/io.c:417 (io_ready)",
            "/home/runner/work/lightning/lightning/ccan/ccan/io/poll.c:453 (io_loop)",
            "/home/runner/work/lightning/lightning/lightningd/io_loop_with_timers.c:22 (io_loop_with_timers)",
            "/home/runner/work/lightning/lightning/lightningd/lightningd.c:1243 (main)"
        ],
        "label": "connectd/connectd_wiregen.c:410:u8[]",
        "parents": [
            "lightningd/peer_control.c:1415:struct peer_connected_hook_payload",
            "lightningd/plugin_hook.c:260:struct plugin_hook_request **NOTLEAK**",
            "lightningd/plugin_hook.c:87:struct hook_instance *[] **NOTLEAK**"
        ],
        "value": "0x5582622b1ff8"
    }
]
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 08:52:55 +09:30
Rusty Russell 745d3f6226 pytest: fix race in test_gossip_not_dying
Writing to the gossip_store file is not explicitly synchronized, so it
seems that connectd has not caught up with the dying flags we've set.

Simply wait for a second.  Hacky, but should work.

```
    def test_gossip_not_dying(node_factory, bitcoind):
        l1 = node_factory.get_node()
        l2, l3 = node_factory.line_graph(2, wait_for_announce=True)
    
        l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
        # Wait until it sees all the updates, node announcments.
        wait_for(lambda: len([n for n in l1.rpc.listnodes()['nodes'] if 'alias' in n])
                 + len(l1.rpc.listchannels()['channels']) == 4)
    
        def get_gossip(node):
            out = subprocess.run(['devtools/gossipwith',
                                  '--initial-sync',
                                  '--timeout-after=2',
                                  '{}@localhost:{}'.format(node.info['id'], node.port)],
                                 check=True,
                                 timeout=TIMEOUT, stdout=subprocess.PIPE).stdout
    
            msgs = []
            while len(out):
                l, t = struct.unpack('>HH', out[0:4])
                msg = out[2:2 + l]
                out = out[2 + l:]
    
                # Ignore pings, timestamp_filter
                if t == 265 or t == 18:
                    continue
                # channel_announcement node_announcement or channel_update
                assert t == 256 or t == 257 or t == 258
                msgs.append(msg)
    
            return msgs
    
        assert len(get_gossip(l1)) == 5
    
        # Close l2->l3, mine block.
        l2.rpc.close(l3.info['id'])
        bitcoind.generate_block(1, wait_for_mempool=1)
    
        l1.daemon.wait_for_log("closing soon due to the funding outpoint being spent")
    
        # We won't gossip the dead channel any more (but we still propagate node_announcement)
>       assert len(get_gossip(l1)) == 2
E       assert 4 == 2
E        +  where 4 = len([b'\x01\x01L\xc2\xbe\x08\xbb\xa8~\x8f\x80R\x9e`J\x1cS\x18|\x12\n\xe5_6\xb0\xa6S\x9fU\xae\x19\x9c\x1fXB\xab\x81N\x13\xdc\x8e}\xb9\xb0\xb6\xe6\x14h\xd4:\x90\xce\xc3\xad\x9ezR`~\xba@\xc9\x91e\x89\xab\x00\x07\x88\xa0\x00\n\x02i\xa2d\xb8\xa9`\x02-"6 \xa3Y\xa4\x7f\xf7\xf7\xacD|\x85\xc4l\x92=\xa53\x89"\x1a\x00T\xc1\x1c\x1e<\xa3\x1dY\x02-"SILENTARTIST-27fc801-modded\x00\x00\x00\x00\x00\x00\x00', b'\x01\x01M\x00\x86\x8e4\xc8\x90p\n\x98\xf7\xce4\x1e\xd9\xd6-6\xfb(\xf0\xe4\xb7\x90\x7f\x89\xb9\xfa\x00\x82\x1b\xeb\x1fY\x93\x1e\xe0c\xb2\x0e<\xe6\x06x\xb7\xe54};\xfbd\xa0\x01S\xcf\xe8{\xf8\x8f/\xa7\xc0\xe2h\x00\x07\x88\xa0\x00\n\x02i\xa2d\xb8\xa9`\x03]+\x11\x92\xdf\xba\x13N\x10\xe5@\x87]6n\xbc\x8b\xc3S\xd5\xaavk\x80\xc0\x90\xb3\x9c:]\x88]\x03]+HOPPINGFIRE-27fc801-modded\x00\x00\x00\x00\x00\x00\x00\x00', b'\x01\x02~\xe0\x13\xb4\x84Gz\xcf(\xd4w\xa7\x9bZ\x1a\xe82\xd1\xe1\x1bLm\xc8\n\xcd\xd4\xfb\x88\xf8\xc6\xdbt\\v\x89~\xd1.e\xc8\xa8o\x9c`\xd5\xa8\x97\x11l\xf2g\xcb\xa8\xcf\r\x869\xd3\xb5\xd5\x9a\xa0my\x9f\x87\xebX\x0b\x9e_\x11\xdc!\x1e\x9f\xb6j\xbb6\x99\x99\x90D\xf8\xfe\x14h\x01\x16#\x936B\x86\xc6\x00\x00g\x00\x00\x01\x00\x00d\xb8\xa9d\x01\x02\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\n\x00\x00\x00\x00;\x023\x80', b"\x01\x0284\xf1a\x86z\x8e\xf2\xe5'\xf7\xfe1\x8d\x96R\x0c\xe7\x1fj#\xaf\xbd/\xba\x10e\xd1\xccQ-\xcf/>\xa5g\xc6\xd8\x9cO \xe7~\xb3\xda\xe0\\vg\xfb\x02&T\x93\xa0\xd4\x95\x8e\xd5L\x12\x9a\xf7\xe6\x9f\x87\xebX\x0b\x9e_\x11\xdc!\x1e\x9f\xb6j\xbb6\x99\x99\x90D\xf8\xfe\x14h\x01\x16#\x936B\x86\xc6\x00\x00g\x00\x00\x01\x00\x00d\xb8\xa9d\x01\x03\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\n\x00\x00\x00\x00;\x023\x80"])
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 08:52:55 +09:30
Rusty Russell 0ceee9390a lightningd: avoid notleak markers: move global into struct runes.
This is neater anyway, but we still need to tell memleak code about the htable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 16:44:22 +09:30
Rusty Russell d492c74e3d docs: document all the rune commands which look like the now-deprecated commando ones.
Rune functionality moved into core from commando plugin.

Changelog-Added: JSON-RPC: `checkrune`: check rune validity for authorization; `createrune` to create/modify rune; `listrunes` to list existing runes; `blacklistrune` to revoke permission of rune

Changelog-Deprecated: JSON-RPC: `commando-rune`, `commando-listrunes` and `commando-blacklist`.

No-schema-diff-check
2023-07-21 16:44:22 +09:30
Shahana Farooqui 4d16b220c2 lightningd: implement `blacklistrune` command. 2023-07-21 16:44:22 +09:30
Rusty Russell 5774737a5c lightningd: implement `checkrune` command.
This extracts the core checking functionality for a rune, so they can
easily be used more widely than just commando.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 16:44:22 +09:30
Rusty Russell 77d08d13a2 pytest: test for runes, based on commando tests.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 16:44:22 +09:30
Rusty Russell b9169d7862 lightningd: implement `createrune` command.
This looks suspiciously like `commando-rune`!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 16:44:22 +09:30
Rusty Russell 5987c156a0 lightningd: implement listrunes command.
Most code stolen from commando, but uses db directly not datastore.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 16:44:22 +09:30
Rusty Russell 9177084505 lightningd: new runes infrastructure.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 16:44:22 +09:30
Rusty Russell c4e84bcbe2 db: add runes tables and accessors.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 16:44:22 +09:30
Christian Decker 975046a790 pyln: Make the grpcio dependencies optional
We also document how the grpc test mode works, and why it currently
lacks coverage.

Changelog-Changed: pyln-testing: The grpc dependencies are now optional.
2023-07-21 15:12:03 +09:30
Christian Decker 22462e1d91 libplugin: Remove presplitter from the API 2023-07-21 07:13:48 +09:30
Christian Decker b768804734 pay: Remove the presplitter modifier
The presplitter modifier would split a payment before trying the first
attempt based on some common sizes. Its goal was to have smaller parts
in flight over different paths, in order to make it more difficult for
a forwarding node to learn payment amount. However it was causing some
issues for direct payments, and estimates on spendable amounts which
considers only the first HTLC being added, but presplitter would
always cause multiple HTLCs to be kicked off, causing the estimate to
be off.

Removing the presplitter fixes this, making draining channels easier,
and worse success rates, due to more HTLCs in flight directly
impacting the changes of getting stuck.

Changelog-Removed: pay: `pay` no longer splits based on common size, as it was causing issues in various scenarios.
2023-07-21 07:13:48 +09:30
Christian Decker c3a983375c pytest: Remove tests that rely on presplit behavior
These tests make assumptions about the presplitter behavior which
we'll remove in the next commit. We remove them here so we don't cause
temporary breaks in the git history.
2023-07-21 07:13:48 +09:30
Rusty Russell 55d6a13ffc gossipd: aggressively advertize *both* sides of channel_update.
While one side was not produced by us, we have a vested interest in propagating it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: When we send our own gossip when a peer connects, also send any incoming channel_updates.
2023-07-21 07:13:11 +09:30
Rusty Russell 7409a93d17 gossipd: when we dump our own gossip, include our node_announcement.
@endothermicdev and I found this while investigating a "nobody sees my node_announcement" bug report.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: #6410
Reported-by: benjaminchodroff on discord
Changelog-Fixed: Protocol: When we send our own gossip when a peer connects, send our node_announcement too (regression in v23.05)
2023-07-21 07:13:11 +09:30
Rusty Russell ef4db6648d pytest: test for force-broadcasting our own gossip.
We do this as suggested by the spec: send our own gossip even if they didn't ask for it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 07:13:11 +09:30
Rusty Russell 63b622ec62 gossipd: clean up dump_our_gossip.
Alex and I were reading it and I got confused: it's really a simpler loop
than it seems, with all those redundant `continue` statements.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-21 07:13:11 +09:30
Rusty Russell 656517f643 connectd: don't gossip dying channels.
Fixes: #6368
Changelog-Fixed: Protocol: we no longer gossip about recently-closed channels (Eclair gets upset with this).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-20 11:47:32 +09:30
Rusty Russell 26bb791298 pytest: test for whether we gossip spent channels.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-20 11:47:32 +09:30
Rusty Russell d16797ce58 gossipd: add dying marker to channel_announcement/channel_update.
We don't actually delete them for 12 blocks, but we can't avoid
propagating them.  We don't mark node_announcements, which is a bit
weird, but avoids us tracking logic to un-dying them if a channel is
opened.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-20 11:47:32 +09:30
Rusty Russell 8178b7389f gossip_store: add "dying" flag to indicate not to gossip dying channels.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-20 11:47:32 +09:30
Shahana Farooqui c0bb7f0721 lightningd: updating python v3.7 to v3.8 2023-07-20 11:44:46 +09:30
Shahana Farooqui 2e72387700 lightningd: removing bionic and python 3.7 support
Changelog-Removed: support for python v<=3.7 & Ubuntu bionic has been
removed.

clnrest's flask & gevent libraries require Python v>=3.8.
2023-07-20 11:44:46 +09:30
Rusty Russell e5d0d6958c lightningd: fix up log filtering for generic daemons (e.g. connectd).
Without this, only per-peer daemons were filtered correctly.  For generic
daemons, we need to filter with the actual nodeid they use (if any).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: config: `log-level` filters now apply correctly to messages from `connectd`.
2023-07-19 19:13:57 +09:30
Rusty Russell 4a7b1b457e lightningd: extend log-level to support filter per-file.
Fixes: #5392
Changelog-Added: config: `log-level` can be specified on a per-logfile basis.
2023-07-19 19:13:57 +09:30
Rusty Russell 4e8e9c2417 lightningd: add support for per-logfile filters.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-19 19:13:57 +09:30
Rusty Russell e0c1c8ec81 lightningd: clean up logging initializations.
Rather than initializating the "print_level" field on first use, we can
do it in logging_options_parsed(), now we have a linked list of them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-19 19:13:57 +09:30
Rusty Russell 8c89d618cb lightningd: keep linked list of all loggers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-19 19:13:57 +09:30
Rusty Russell 39415d3df3 lightningd: have opt_log_level take the log_book.
This is where it's set, not some random logger.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-19 19:13:57 +09:30
Rusty Russell 2bf0b922ca lightningd: add "has_io_logging" helper.
Rather than exposing the filtering internals.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-19 19:13:57 +09:30
Rusty Russell c074fe050f lightningd/log: clean up nomenclature.
`struct log` becomes `struct logger`, and the member which points to the
`struct log_book` becomes `->log_book` not `->lr`.

Also, we don't need to keep the log_book in struct plugin, since it has
access to ld's log_book.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-19 19:13:57 +09:30
Vincenzo Palazzo 19d80e1f08 wallet: Fixes the compilation error due the db_binindings change
Currently our CI is not able to complete the compilation because
there is the following compilation error introduced in `0bcff1e76d`

```
cc wallet/db.c
wallet/db.c: In function 'migrate_normalize_invstr':
wallet/db.c:1734:3: error: too many arguments to function 'db_bind_text'
 1734 |   db_bind_text(update_stmt, 0, invstr);
      |   ^~~~~~~~~~~~
In file included from wallet/db.c:10:
./db/bindings.h:25:6: note: declared here
   25 | void db_bind_text(struct db_stmt *stmt, const char *val);
      |      ^~~~~~~~~~~~
wallet/db.c:1735:3: error: too many arguments to function 'db_bind_u64'
 1735 |   db_bind_u64(update_stmt, 1, id);
      |   ^~~~~~~~~~~
In file included from wallet/db.c:10:
./db/bindings.h:23:6: note: declared here
   23 | void db_bind_u64(struct db_stmt *stmt, u64 val);
      |      ^~~~~~~~~~~
wallet/db.c:1758:3: error: too many arguments to function 'db_bind_text'
 1758 |   db_bind_text(update_stmt, 0, invstr);
      |   ^~~~~~~~~~~~
In file included from wallet/db.c:10:
./db/bindings.h:25:6: note: declared here
   25 | void db_bind_text(struct db_stmt *stmt, const char *val);
      |      ^~~~~~~~~~~~
wallet/db.c:1759:3: error: too many arguments to function 'db_bind_u64'
 1759 |   db_bind_u64(update_stmt, 1, id);
      |   ^~~~~~~~~~~
In file included from wallet/db.c:10:
./db/bindings.h:23:6: note: declared here
   23 | void db_bind_u64(struct db_stmt *stmt, u64 val);
      |      ^~~~~~~~~~~
make: *** [Makefile:299: wallet/db.o] Error 1
make: *** Waiting for unfinished jobs....
rm external/build-x86_64-linux-gnu/libwally-core-build/src/secp256k1/libsecp256k1.la
```

Fixes: 0bcff1e76d
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-07-19 05:50:02 +09:30
Shahana Farooqui 93a3d7f632 commando: added check for empty params
Changelog-Changed: Protocol: commando commands now allow a missing params field, instead of requiring an empty field.

No-schema-diff-check
2023-07-19 05:40:30 +09:30
Shahana Farooqui a4835cf266 commando: changed listrunes schema for `restrictions` `english` key
Changelog: None
2023-07-19 05:40:30 +09:30
Rusty Russell 0bcff1e76d db/bindings: now bindings are always in order, remove index.
Simply always bind the next one.  No arithmetic required now!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell 9af407a47a bkpr: use BIND_NEXT.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell eee40615e2 wallet/invoices.c: use BIND_NEXT
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell 27cedeb629 wallet: convert to BIND_NEXT.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell a1c20bfc87 db: implement BIND_NEXT for autocounting.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell b7b3cbc84a db: enforce that bindings be done in order.
This is almost always true already; fix up the few non-standard ones.

This is enforced with an assert, and I ran the entire test suite to
double-check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell d17506b899 wallet: use standard-style iterators for invoices.
Same as we use for offers, etc.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell c814cd0142 wallet/invoice: remove indirection.
We can expose the dbid, rather than pretending we have some "struct
invoice" which is actually just the dbid.  And don't have a pile of
"wallet_" wrappers for redirection.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell c7026e56a4 wallet: rename enum wallet_payment_status to payment_status.
We use it everywhere, the wallet_ prefix is weird.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30