wallet: remove unused TX_ANNOTATION type in transaction_annotations table.

We only ever use this table for output and input transactions: indeed, my node
doesn't have any annotation types 0.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-01-30 16:35:03 +10:30 committed by Alex Myers
parent 4b9cb7eb76
commit 578f075407
2 changed files with 9 additions and 8 deletions

View File

@ -21,10 +21,8 @@ enum wallet_tx_type {
TX_CHANNEL_CHEAT = 1024,
};
/* What part of a transaction are we annotating? The entire transaction, an
* input or an output. */
/* What part of a transaction are we annotating? An input or an output. */
enum wallet_tx_annotation_type {
TX_ANNOTATION = 0,
OUTPUT_ANNOTATION = 1,
INPUT_ANNOTATION = 2,
};

View File

@ -4863,14 +4863,17 @@ struct wallet_transaction *wallet_transactions_get(struct wallet *w, const tal_t
struct tx_annotation *ann;
/* Select annotation from array to fill in. */
if (loc == OUTPUT_ANNOTATION)
switch (loc) {
case OUTPUT_ANNOTATION:
ann = &cur->output_annotations[idx];
else if (loc == INPUT_ANNOTATION)
goto got_ann;
case INPUT_ANNOTATION:
ann = &cur->input_annotations[idx];
else
fatal("Transaction annotations are only available for inputs and outputs. Value %d", loc);
goto got_ann;
}
fatal("Transaction annotations are only available for inputs and outputs. Value %d", loc);
/* cppcheck-suppress uninitvar - false positive on fatal() above */
got_ann:
ann->type = db_col_int(stmt, "annotation_type");
if (!db_col_is_null(stmt, "c.scid"))
db_col_scid(stmt, "c.scid", &ann->channel);