rgb-cln/wallet
Rusty Russell d3e33cfd14 wallet: fix crash on listtransactions.
We removed the (experimental-only!) annotation output in 611795beee
but we still loaded them from the db.  Turns out that we were putting bogus
annotations into the db, and accessing out of range when loading them.

Consider the following db entry in transaction_annotations:

```
CREATE TABLE transaction_annotations (  txid BLOB, idx INTEGER, location INTEGER, type INTEGER, channel INTEGER REFERENCES channels(id), UNIQUE(txid, idx));
...
INSERT INTO transaction_annotations VALUES(X'19706f9af2875508a06c7db1754ef7ecb3da745ead005992e626441e4e83465f',18,1,129,53699);
```

Here is the corresponding entry in txs:

```
INSERT INTO transactions VALUES(X'19706f9af2875508a06c7db1754ef7ecb3da745ead005992e626441e4e83465f',710327,966,X'02000000000101f2add69112a1d557317826120e1f4ea3bc1cbe4674d720325695b26ecfe8355d120000000000000000013634000000000000160014dca21f104359bbb81e88ed7da985549f2cd0cbc30347304402201cdc854b76c4c7523e3ca09f38a81539d3b2f7fbd9a0de6ae10b7ceaa65ed9d402205a1770058cd1ef081c77c2fe957c07a334cb3a11bc0cc502834a29c59424fe010120589da1f809d955c7af150bf53123c27ffc0a741489b5291f6be811189863ec838576a9142f188d0d973c4ad1865a619d3748340b30746e088763ac672103b7bbcd592197ba6501e7176aabd3f908d94b126ae82ab1e7a4c58f5a789782e57c820120876475527c21029bcf62114eb36758fcb1aead7e67b6f707d32f34e67816894d5211ac9f2d6ce752ae67a9144483a115219ba65c63a3844be8445f739703bea988ac686800000000',NULL,NULL);
```

The annotation refers to output 18 of the tx, but it only has one output!

However, decoding the tx shows that it spent output 18 of a previous tx, so
that's probably where the `18` came from.

Remove this logic: we can remove the remaining (clearly broken!) annotation
adding code in another cleanup commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-29 18:41:46 +09:30
..
test db: make db_exec_prepared_v2 return void. 2023-04-06 09:50:32 +09:30
.gitignore reorganize .gitignore entries across subdirs. 2021-05-18 09:43:50 +09:30
Makefile wallet/psbt_fixup: routine to fix invalid PBSTs which modern libwally won't load. 2023-03-31 09:16:25 +10:30
db.c wallet: add channel_type field to db. 2023-04-10 17:26:47 +09:30
db.h database: pull out database code into a new module 2022-03-05 15:03:34 +10:30
invoices.c wallet: use db_col_optional. 2023-03-25 15:28:02 +10:30
invoices.h delinvoice: allow desconly arg to only remove the description. 2022-03-29 10:04:16 +10:30
psbt_fixup.c wallet/psbt_fixup: routine to fix invalid PBSTs which modern libwally won't load. 2023-03-31 09:16:25 +10:30
psbt_fixup.h wallet/psbt_fixup: routine to fix invalid PBSTs which modern libwally won't load. 2023-03-31 09:16:25 +10:30
reservation.c wallet: allow psbt_using_utxos to take a starter psbt. 2023-04-10 17:26:47 +09:30
txfilter.c all: no longer need to call htable_clear to free htable contents. 2023-01-12 11:44:10 +10:30
txfilter.h common: use bitcoin_outpoint. 2021-10-15 12:09:36 +02:00
wallet.c wallet: fix crash on listtransactions. 2023-05-29 18:41:46 +09:30
wallet.h wallet: fix crash on listtransactions. 2023-05-29 18:41:46 +09:30
walletrpc.c listtransactions: remove annotations, which were only in EXPERIMENTAL_FEATURES. 2023-05-23 09:34:08 +09:30
walletrpc.h daemons: remove unused functions or make static. 2021-12-06 10:05:39 +10:30