From 5756b54f383d3ee393254c9b63a864b827eccd81 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 14 Aug 2025 10:57:54 +0930 Subject: [PATCH] common: rename enum mvt_tag values. Prefix MVT_ to them, for clarity. Signed-off-by: Rusty Russell --- common/coin_mvt.c | 20 +++++------ common/coin_mvt.h | 50 +++++++++++++------------- lightningd/chaintopology.c | 2 +- lightningd/channel_control.c | 2 +- lightningd/coin_mvts.c | 8 ++--- lightningd/onchain_control.c | 2 +- onchaind/onchaind.c | 60 ++++++++++++++++---------------- plugins/bkpr/bookkeeper.c | 20 +++++------ plugins/bkpr/incomestmt.c | 6 ++-- plugins/bkpr/recorder.c | 52 +++++++++++++-------------- plugins/bkpr/test/run-recorder.c | 16 ++++----- wallet/wallet.c | 2 +- wallet/walletrpc.c | 2 +- 13 files changed, 121 insertions(+), 121 deletions(-) diff --git a/common/coin_mvt.c b/common/coin_mvt.c index 078984c07..5dc7843bf 100644 --- a/common/coin_mvt.c +++ b/common/coin_mvt.c @@ -223,10 +223,10 @@ struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx, bool is_splice) { struct chain_coin_mvt *mvt; - enum mvt_tag *tags = new_tag_arr(NULL, CHANNEL_CLOSE); + enum mvt_tag *tags = new_tag_arr(NULL, MVT_CHANNEL_CLOSE); if (is_splice) - tal_arr_expand(&tags, SPLICE); + tal_arr_expand(&tags, MVT_SPLICE); mvt = new_chain_coin_mvt(ctx, channel, alt_account, txid, out, NULL, blockheight, @@ -249,16 +249,16 @@ struct chain_coin_mvt *new_coin_channel_open_proposed(const tal_t *ctx, struct chain_coin_mvt *mvt; mvt = new_chain_coin_mvt(ctx, channel, NULL, NULL, out, NULL, 0, - take(new_tag_arr(NULL, CHANNEL_PROPOSED)), + take(new_tag_arr(NULL, MVT_CHANNEL_PROPOSED)), COIN_CREDIT, amount, output_val, 0); mvt->peer_id = tal_dup(mvt, struct node_id, peer_id); /* If we're the opener, add to the tag list */ if (is_opener) - tal_arr_expand(&mvt->tags, OPENER); + tal_arr_expand(&mvt->tags, MVT_OPENER); if (is_leased) - tal_arr_expand(&mvt->tags, LEASED); + tal_arr_expand(&mvt->tags, MVT_LEASED); return mvt; } @@ -276,17 +276,17 @@ struct chain_coin_mvt *new_coin_channel_open(const tal_t *ctx, struct chain_coin_mvt *mvt; mvt = new_chain_coin_mvt(ctx, channel, NULL, NULL, out, NULL, blockheight, - take(new_tag_arr(NULL, CHANNEL_OPEN)), + take(new_tag_arr(NULL, MVT_CHANNEL_OPEN)), COIN_CREDIT, amount, output_val, 0); mvt->peer_id = tal_dup(mvt, struct node_id, peer_id); /* If we're the opener, add to the tag list */ if (is_opener) - tal_arr_expand(&mvt->tags, OPENER); + tal_arr_expand(&mvt->tags, MVT_OPENER); if (is_leased) - tal_arr_expand(&mvt->tags, LEASED); + tal_arr_expand(&mvt->tags, MVT_LEASED); return mvt; } @@ -300,7 +300,7 @@ struct chain_coin_mvt *new_onchain_htlc_deposit(const tal_t *ctx, return new_chain_coin_mvt_sat(ctx, NULL, "", NULL, outpoint, payment_hash, blockheight, - take(new_tag_arr(NULL, HTLC_FULFILL)), + take(new_tag_arr(NULL, MVT_HTLC_FULFILL)), COIN_CREDIT, amount); } @@ -316,7 +316,7 @@ struct chain_coin_mvt *new_onchain_htlc_withdraw(const tal_t *ctx, return new_chain_coin_mvt_sat(ctx, NULL, EXTERNAL, NULL, outpoint, payment_hash, blockheight, - take(new_tag_arr(NULL, HTLC_FULFILL)), + take(new_tag_arr(NULL, MVT_HTLC_FULFILL)), COIN_CREDIT, amount); } diff --git a/common/coin_mvt.h b/common/coin_mvt.h index 668c329de..d96a34c5d 100644 --- a/common/coin_mvt.h +++ b/common/coin_mvt.h @@ -9,32 +9,32 @@ #define COIN_MVT_VERSION 2 #define WALLET "wallet" -#define NUM_MVT_TAGS (SPLICE + 1) enum mvt_tag { - DEPOSIT = 0, - WITHDRAWAL = 1, - PENALTY = 2, - INVOICE = 3, - ROUTED = 4, - PUSHED = 5, - CHANNEL_OPEN = 6, - CHANNEL_CLOSE = 7, - CHANNEL_TO_US = 8, - HTLC_TIMEOUT = 9, - HTLC_FULFILL = 10, - HTLC_TX = 11, - TO_WALLET = 12, - ANCHOR = 13, - TO_THEM = 14, - PENALIZED = 15, - STOLEN = 16, - TO_MINER = 17, - OPENER = 18, - LEASE_FEE = 19, - LEASED = 20, - STEALABLE = 21, - CHANNEL_PROPOSED = 22, - SPLICE = 23, + MVT_DEPOSIT = 0, + MVT_WITHDRAWAL = 1, + MVT_PENALTY = 2, + MVT_INVOICE = 3, + MVT_ROUTED = 4, + MVT_PUSHED = 5, + MVT_CHANNEL_OPEN = 6, + MVT_CHANNEL_CLOSE = 7, + MVT_CHANNEL_TO_US = 8, + MVT_HTLC_TIMEOUT = 9, + MVT_HTLC_FULFILL = 10, + MVT_HTLC_TX = 11, + MVT_TO_WALLET = 12, + MVT_ANCHOR = 13, + MVT_TO_THEM = 14, + MVT_PENALIZED = 15, + MVT_STOLEN = 16, + MVT_TO_MINER = 17, + MVT_OPENER = 18, + MVT_LEASE_FEE = 19, + MVT_LEASED = 20, + MVT_STEALABLE = 21, + MVT_CHANNEL_PROPOSED = 22, + MVT_SPLICE = 23, +#define NUM_MVT_TAGS (MVT_SPLICE + 1) }; enum coin_mvt_dir { diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 05c0b81aa..3735d629f 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -882,7 +882,7 @@ static void record_wallet_spend(struct lightningd *ld, notify_chain_mvt(ld, new_coin_wallet_withdraw(tmpctx, txid, outpoint, tx_blockheight, - utxo->amount, WITHDRAWAL)); + utxo->amount, MVT_WITHDRAWAL)); } /** diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index e6ab5169c..2273d1991 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -1030,7 +1030,7 @@ void channel_record_open(struct channel *channel, u32 blockheight, bool record_p new_coin_channel_push(tmpctx, channel, channel->opener == REMOTE ? COIN_CREDIT : COIN_DEBIT, channel->push, - is_leased ? LEASE_FEE : PUSHED)); + is_leased ? MVT_LEASE_FEE : MVT_PUSHED)); } void lockin_has_completed(struct channel *channel, bool record_push) diff --git a/lightningd/coin_mvts.c b/lightningd/coin_mvts.c index c365a7bf1..2b70cfec0 100644 --- a/lightningd/coin_mvts.c +++ b/lightningd/coin_mvts.c @@ -13,7 +13,7 @@ struct channel_coin_mvt *new_channel_mvt_invoice_hin(const tal_t *ctx, return new_channel_coin_mvt(ctx, channel, &hin->payment_hash, NULL, NULL, COIN_CREDIT, hin->msat, - new_tag_arr(ctx, INVOICE), + new_tag_arr(ctx, MVT_INVOICE), AMOUNT_MSAT(0)); } @@ -33,7 +33,7 @@ struct channel_coin_mvt *new_channel_mvt_routed_hin(const tal_t *ctx, return new_channel_coin_mvt(ctx, channel, &hin->payment_hash, NULL, NULL, COIN_CREDIT, hin->msat, - new_tag_arr(ctx, ROUTED), + new_tag_arr(ctx, MVT_ROUTED), fees_collected); } @@ -46,7 +46,7 @@ struct channel_coin_mvt *new_channel_mvt_invoice_hout(const tal_t *ctx, &hout->partid, &hout->groupid, COIN_DEBIT, hout->msat, - new_tag_arr(ctx, INVOICE), + new_tag_arr(ctx, MVT_INVOICE), hout->fees); } @@ -57,7 +57,7 @@ struct channel_coin_mvt *new_channel_mvt_routed_hout(const tal_t *ctx, return new_channel_coin_mvt(ctx, channel, &hout->payment_hash, NULL, NULL, COIN_DEBIT, hout->msat, - new_tag_arr(ctx, ROUTED), + new_tag_arr(ctx, MVT_ROUTED), hout->fees); } diff --git a/lightningd/onchain_control.c b/lightningd/onchain_control.c index e7758ce52..7310b8a46 100644 --- a/lightningd/onchain_control.c +++ b/lightningd/onchain_control.c @@ -578,7 +578,7 @@ static void onchain_add_utxo(struct channel *channel, const u8 *msg) csv_lock); mvt = new_coin_wallet_deposit(msg, &outpoint, blockheight, - amount, DEPOSIT); + amount, MVT_DEPOSIT); mvt->originating_acct = new_mvt_account_id(mvt, channel, NULL); notify_chain_mvt(channel->peer->ld, mvt); diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c index 21c42c798..c23c42a3c 100644 --- a/onchaind/onchaind.c +++ b/onchaind/onchaind.c @@ -295,7 +295,7 @@ static void record_mutual_close(const struct tx_parts *tx, record_external_output(&out, amount_sat(tx->outputs[i]->satoshi), blockheight, - TO_THEM); + MVT_TO_THEM); break; } } @@ -339,7 +339,7 @@ static void record_our_anchor(struct tracked_output *out) * it can be spent by anyone after 16 blocks. Our * implementation doesn't ever spend it unless it needs to * boost, so it's fair to record it as going "external". */ - record_external_deposit(out, out->tx_blockheight, ANCHOR); + record_external_deposit(out, out->tx_blockheight, MVT_ANCHOR); } static void record_coin_movements(struct tracked_output *out, @@ -355,10 +355,10 @@ static void record_coin_movements(struct tracked_output *out, * AND so we can accurately calculate our on-chain fee burden */ if (out->tx_type == OUR_HTLC_TIMEOUT_TX || out->tx_type == OUR_HTLC_SUCCESS_TX) - record_channel_deposit(out, out->tx_blockheight, HTLC_TX); + record_channel_deposit(out, out->tx_blockheight, MVT_HTLC_TX); if (out->resolved->tx_type == OUR_HTLC_TIMEOUT_TO_US) - record_channel_deposit(out, out->tx_blockheight, HTLC_TIMEOUT); + record_channel_deposit(out, out->tx_blockheight, MVT_HTLC_TIMEOUT); /* there is a case where we've fulfilled an htlc onchain, * in which case we log a deposit to the channel */ @@ -371,20 +371,20 @@ static void record_coin_movements(struct tracked_output *out, if (out->tx_type == OUR_UNILATERAL) { if (out->output_type == DELAYED_OUTPUT_TO_US) record_channel_deposit(out, out->tx_blockheight, - CHANNEL_TO_US); + MVT_CHANNEL_TO_US); else if (out->output_type == OUR_HTLC) { record_channel_deposit(out, out->tx_blockheight, - HTLC_TIMEOUT); + MVT_HTLC_TIMEOUT); record_channel_withdrawal(txid, out, blockheight, - HTLC_TIMEOUT); + MVT_HTLC_TIMEOUT); } else if (out->output_type == THEIR_HTLC) record_channel_withdrawal(txid, out, blockheight, - HTLC_FULFILL); + MVT_HTLC_FULFILL); } if (out->tx_type == THEIR_REVOKED_UNILATERAL || out->resolved->tx_type == OUR_PENALTY_TX) - record_channel_deposit(out, out->tx_blockheight, PENALTY); + record_channel_deposit(out, out->tx_blockheight, MVT_PENALTY); if (out->resolved->tx_type == OUR_DELAYED_RETURN_TO_WALLET || out->resolved->tx_type == THEIR_HTLC_FULFILL_TO_US @@ -393,9 +393,9 @@ static void record_coin_movements(struct tracked_output *out, || out->resolved->tx_type == OUR_PENALTY_TX) { /* penalty rbf cases, the amount might be zero */ if (amount_sat_is_zero(out->sat)) - record_channel_withdrawal(txid, out, blockheight, TO_MINER); + record_channel_withdrawal(txid, out, blockheight, MVT_TO_MINER); else - record_channel_withdrawal(txid, out, blockheight, TO_WALLET); + record_channel_withdrawal(txid, out, blockheight, MVT_TO_WALLET); } } @@ -1229,14 +1229,14 @@ static bool output_spent(struct tracked_output ***outs, case DELAYED_OUTPUT_TO_US: unknown_spend(out, tx_parts); record_external_deposit(out, out->tx_blockheight, - PENALIZED); + MVT_PENALIZED); break; case THEIR_HTLC: if (out->tx_type == THEIR_REVOKED_UNILATERAL) { enum mvt_tag *tags; - tags = new_tag_arr(NULL, HTLC_TIMEOUT); - tal_arr_expand(&tags, STEALABLE); + tags = new_tag_arr(NULL, MVT_HTLC_TIMEOUT); + tal_arr_expand(&tags, MVT_STEALABLE); record_external_deposit_tags(out, out->tx_blockheight, /* This takes tags */ @@ -1284,8 +1284,8 @@ static bool output_spent(struct tracked_output ***outs, if (out->tx_type == THEIR_REVOKED_UNILATERAL) { enum mvt_tag *tags = new_tag_arr(NULL, - HTLC_FULFILL); - tal_arr_expand(&tags, STEALABLE); + MVT_HTLC_FULFILL); + tal_arr_expand(&tags, MVT_STEALABLE); record_external_spend_tags(&tx_parts->txid, out, tx_blockheight, @@ -1297,7 +1297,7 @@ static bool output_spent(struct tracked_output ***outs, } else { record_external_spend(&tx_parts->txid, out, tx_blockheight, - HTLC_FULFILL); + MVT_HTLC_FULFILL); /* BOLT #5: * * ## HTLC Output Handling: Local Commitment, @@ -1326,7 +1326,7 @@ static bool output_spent(struct tracked_output ***outs, resolved_by_other(out, &tx_parts->txid, THEIR_DELAYED_CHEAT); - record_external_deposit(out, out->tx_blockheight, STOLEN); + record_external_deposit(out, out->tx_blockheight, MVT_STOLEN); break; /* Um, we don't track these! */ case OUTPUT_TO_THEM: @@ -1430,7 +1430,7 @@ static void tx_new_depth(struct tracked_output **outs, if (outs[i]->proposal->tx_type == THEIR_HTLC_TIMEOUT_TO_THEM) record_external_deposit(outs[i], outs[i]->tx_blockheight, - HTLC_TIMEOUT); + MVT_HTLC_TIMEOUT); } } } @@ -2310,7 +2310,7 @@ static void handle_our_unilateral(const struct tx_parts *tx, OUTPUT_TO_THEM, NULL, NULL, NULL); ignore_output(out); - record_external_deposit(out, tx_blockheight, TO_THEM); + record_external_deposit(out, tx_blockheight, MVT_TO_THEM); script[REMOTE] = NULL; continue; } @@ -2339,7 +2339,7 @@ static void handle_our_unilateral(const struct tx_parts *tx, ANCHOR_TO_THEM, NULL, NULL, NULL); ignore_output(out); - record_external_deposit(out, tx_blockheight, ANCHOR); + record_external_deposit(out, tx_blockheight, MVT_ANCHOR); anchor[REMOTE] = NULL; continue; } @@ -2413,7 +2413,7 @@ static void handle_our_unilateral(const struct tx_parts *tx, ignore_output(out); record_external_deposit(out, tx_blockheight, - TO_THEM); + MVT_TO_THEM); script[REMOTE] = NULL; found = true; break; @@ -2428,7 +2428,7 @@ static void handle_our_unilateral(const struct tx_parts *tx, record_external_output(&outpoint, amt, tx_blockheight, - PENALTY); + MVT_PENALTY); status_failed(STATUS_FAIL_INTERNAL_ERROR, "Could not find resolution for output %zu", i); @@ -2823,7 +2823,7 @@ static void handle_their_cheat(const struct tx_parts *tx, ANCHOR_TO_THEM, NULL, NULL, NULL); ignore_output(out); - record_external_deposit(out, tx_blockheight, ANCHOR); + record_external_deposit(out, tx_blockheight, MVT_ANCHOR); anchor[REMOTE] = NULL; continue; } @@ -2893,7 +2893,7 @@ static void handle_their_cheat(const struct tx_parts *tx, if (!found) { record_external_output(&outpoint, amt, tx_blockheight, - PENALTY); + MVT_PENALTY); status_broken("Could not find resolution" " for output %zu: did" " *we* cheat?", i); @@ -3120,7 +3120,7 @@ static void handle_their_unilateral(const struct tx_parts *tx, DELAYED_OUTPUT_TO_THEM, NULL, NULL, NULL); ignore_output(out); - record_external_deposit(out, tx_blockheight, TO_THEM); + record_external_deposit(out, tx_blockheight, MVT_TO_THEM); continue; } if (anchor[LOCAL] @@ -3150,7 +3150,7 @@ static void handle_their_unilateral(const struct tx_parts *tx, NULL, NULL, NULL); ignore_output(out); anchor[REMOTE] = NULL; - record_external_deposit(out, tx_blockheight, ANCHOR); + record_external_deposit(out, tx_blockheight, MVT_ANCHOR); continue; } @@ -3215,7 +3215,7 @@ static void handle_their_unilateral(const struct tx_parts *tx, ignore_output(out); record_external_deposit(out, tx_blockheight, - TO_THEM); + MVT_TO_THEM); found = true; break; } @@ -3226,7 +3226,7 @@ static void handle_their_unilateral(const struct tx_parts *tx, record_external_output(&outpoint, amt, tx_blockheight, - PENALTY); + MVT_PENALTY); status_failed(STATUS_FAIL_INTERNAL_ERROR, "Could not find resolution for output %zu", i); @@ -3362,7 +3362,7 @@ found: record_external_output(&outpoint, amt, tx_blockheight, - PENALTY); + MVT_PENALTY); } if (to_us_output == -1) { diff --git a/plugins/bkpr/bookkeeper.c b/plugins/bkpr/bookkeeper.c index dd7623cba..fb331c190 100644 --- a/plugins/bkpr/bookkeeper.c +++ b/plugins/bkpr/bookkeeper.c @@ -756,7 +756,7 @@ static bool new_missed_channel_account(struct command *cmd, acct->name); chain_ev = tal(cmd, struct chain_event); - chain_ev->tag = mvt_tag_str(CHANNEL_OPEN); + chain_ev->tag = mvt_tag_str(MVT_CHANNEL_OPEN); chain_ev->debit = AMOUNT_MSAT(0); ok = amount_msat_add(&chain_ev->output_value, amt, remote_amt); @@ -775,7 +775,7 @@ static bool new_missed_channel_account(struct command *cmd, /* Update the account info too */ tags = tal_arr(chain_ev, enum mvt_tag, 1); - tags[0] = CHANNEL_OPEN; + tags[0] = MVT_CHANNEL_OPEN; is_opener = streq(opener, "local"); @@ -785,9 +785,9 @@ static bool new_missed_channel_account(struct command *cmd, &is_leased); if (is_leased) - tal_arr_expand(&tags, LEASED); + tal_arr_expand(&tags, MVT_LEASED); if (is_opener) - tal_arr_expand(&tags, OPENER); + tal_arr_expand(&tags, MVT_OPENER); chain_ev->credit = amt; db_begin_transaction(db); @@ -814,7 +814,7 @@ static bool new_missed_channel_account(struct command *cmd, chan_tag = tal_fmt(tmpctx, "%s", mvt_tag_str( is_leased ? - LEASE_FEE : PUSHED)); + MVT_LEASE_FEE : MVT_PUSHED)); chan_ev = new_channel_event(tmpctx, chan_tag, push_credit, @@ -1451,7 +1451,7 @@ listpeerchannels_done(struct command *cmd, plugin_err(cmd->plugin, "%s", err); if (info->ev->payment_id && - streq(info->ev->tag, mvt_tag_str(INVOICE))) { + streq(info->ev->tag, mvt_tag_str(MVT_INVOICE))) { return lookup_invoice_desc(cmd, info->ev->credit, info->ev->payment_id); } @@ -1567,8 +1567,8 @@ parse_and_log_chain_move(struct command *cmd, e->stealable = false; e->splice_close = false; for (size_t i = 0; i < tal_count(tags); i++) { - e->stealable |= tags[i] == STEALABLE; - e->splice_close |= tags[i] == SPLICE; + e->stealable |= tags[i] == MVT_STEALABLE; + e->splice_close |= tags[i] == MVT_SPLICE; } db_begin_transaction(db); @@ -1667,7 +1667,7 @@ parse_and_log_chain_move(struct command *cmd, /* Check for invoice desc data, necessary */ if (e->payment_id) { for (size_t i = 0; i < tal_count(tags); i++) { - if (tags[i] != INVOICE) + if (tags[i] != MVT_INVOICE) continue; return lookup_invoice_desc(cmd, e->credit, @@ -1741,7 +1741,7 @@ parse_and_log_channel_move(struct command *cmd, /* Check for invoice desc data, necessary */ if (e->payment_id) { for (size_t i = 0; i < tal_count(tags); i++) { - if (tags[i] != INVOICE) + if (tags[i] != MVT_INVOICE) continue; /* We only do rebalance checks for debits, diff --git a/plugins/bkpr/incomestmt.c b/plugins/bkpr/incomestmt.c index 5bcf6a102..74faa71e0 100644 --- a/plugins/bkpr/incomestmt.c +++ b/plugins/bkpr/incomestmt.c @@ -164,7 +164,7 @@ static struct income_event *maybe_chain_income(const tal_t *ctx, ev->debit, ev->credit); /* Also, really a withdrawal.. phh */ - iev->tag = tal_strdup(iev, mvt_tag_str(WITHDRAWAL)); + iev->tag = tal_strdup(iev, mvt_tag_str(MVT_WITHDRAWAL)); return iev; } @@ -533,7 +533,7 @@ static void cointrack_entry(const tal_t *ctx, FILE *csvf, struct income_event *e /* "Fee Amount,Fee Currency," */ if (!amount_msat_is_zero(ev->fees) - && streq(ev->tag, mvt_tag_str(INVOICE))) { + && streq(ev->tag, mvt_tag_str(MVT_INVOICE))) { fprintf(csvf, "%s", fmt_amount_msat_btc(ctx, ev->fees, false)); fprintf(csvf, ","); fprintf(csvf, "%s", convert_asset_type(ev)); @@ -606,7 +606,7 @@ static void koinly_entry(const tal_t *ctx, FILE *csvf, struct income_event *ev) /* "Fee Amount,Fee Currency," */ if (!amount_msat_is_zero(ev->fees) - && streq(ev->tag, mvt_tag_str(INVOICE))) { + && streq(ev->tag, mvt_tag_str(MVT_INVOICE))) { fprintf(csvf, "%s", fmt_amount_msat_btc(ctx, ev->fees, false)); fprintf(csvf, ","); fprintf(csvf, "%s", convert_asset_type(ev)); diff --git a/plugins/bkpr/recorder.c b/plugins/bkpr/recorder.c index 02535cbac..80daf2f36 100644 --- a/plugins/bkpr/recorder.c +++ b/plugins/bkpr/recorder.c @@ -449,7 +449,7 @@ static struct txo_set *find_txo_set(const tal_t *ctx, if (pr) { /* Disappear "channel_proposed" events */ if (streq(pr->txo->tag, - mvt_tag_str(CHANNEL_PROPOSED))) + mvt_tag_str(MVT_CHANNEL_PROPOSED))) pr = tal_free(pr); else tal_arr_expand(&txos->pairs, pr); @@ -573,7 +573,7 @@ struct account *find_close_account(const tal_t *ctx, /* ignore splicing 'close' events */ " AND e.spliced = 0 ")); - db_bind_text(stmt, mvt_tag_str(CHANNEL_CLOSE)); + db_bind_text(stmt, mvt_tag_str(MVT_CHANNEL_CLOSE)); db_bind_txid(stmt, txid); db_query_prepared(stmt); @@ -1430,13 +1430,13 @@ void maybe_update_account(struct db *db, for (size_t i = 0; i < tal_count(tags); i++) { switch (tags[i]) { - case CHANNEL_PROPOSED: - case CHANNEL_OPEN: + case MVT_CHANNEL_PROPOSED: + case MVT_CHANNEL_OPEN: updated = true; acct->open_event_db_id = tal(acct, u64); *acct->open_event_db_id = e->db_id; break; - case CHANNEL_CLOSE: + case MVT_CHANNEL_CLOSE: /* Splices dont count as closes */ if (e->splice_close) break; @@ -1444,33 +1444,33 @@ void maybe_update_account(struct db *db, acct->closed_event_db_id = tal(acct, u64); *acct->closed_event_db_id = e->db_id; break; - case LEASED: + case MVT_LEASED: updated = true; acct->leased = true; break; - case OPENER: + case MVT_OPENER: updated = true; acct->we_opened = true; break; - case DEPOSIT: - case WITHDRAWAL: - case PENALTY: - case INVOICE: - case ROUTED: - case PUSHED: - case CHANNEL_TO_US: - case HTLC_TIMEOUT: - case HTLC_FULFILL: - case HTLC_TX: - case TO_WALLET: - case ANCHOR: - case TO_THEM: - case PENALIZED: - case STOLEN: - case TO_MINER: - case LEASE_FEE: - case STEALABLE: - case SPLICE: + case MVT_DEPOSIT: + case MVT_WITHDRAWAL: + case MVT_PENALTY: + case MVT_INVOICE: + case MVT_ROUTED: + case MVT_PUSHED: + case MVT_CHANNEL_TO_US: + case MVT_HTLC_TIMEOUT: + case MVT_HTLC_FULFILL: + case MVT_HTLC_TX: + case MVT_TO_WALLET: + case MVT_ANCHOR: + case MVT_TO_THEM: + case MVT_PENALIZED: + case MVT_STOLEN: + case MVT_TO_MINER: + case MVT_LEASE_FEE: + case MVT_STEALABLE: + case MVT_SPLICE: /* Ignored */ break; } diff --git a/plugins/bkpr/test/run-recorder.c b/plugins/bkpr/test/run-recorder.c index 8a887f956..e4475e41e 100644 --- a/plugins/bkpr/test/run-recorder.c +++ b/plugins/bkpr/test/run-recorder.c @@ -552,7 +552,7 @@ static bool test_onchain_fee_chan_close(const tal_t *ctx, struct plugin *p) blockheight, 'X', 0, '*'); log_chain_event(db, acct, ev); - tags[0] = CHANNEL_OPEN; + tags[0] = MVT_CHANNEL_OPEN; maybe_update_account(db, acct, ev, tags, 0, NULL); ev = make_chain_event(ctx, "channel_close", @@ -564,7 +564,7 @@ static bool test_onchain_fee_chan_close(const tal_t *ctx, struct plugin *p) log_chain_event(db, acct, ev); /* Update the account to have the right info! */ - tags[0] = CHANNEL_CLOSE; + tags[0] = MVT_CHANNEL_CLOSE; maybe_update_account(db, acct, ev, tags, close_output_count, NULL); log_chain_event(db, acct, @@ -1357,8 +1357,8 @@ static bool test_account_crud(const tal_t *ctx, struct plugin *p) tags = tal_arr(ctx, enum mvt_tag, 2); /* should not update the account info */ - tags[0] = PUSHED; - tags[1] = PENALTY; + tags[0] = MVT_PUSHED; + tags[1] = MVT_PENALTY; maybe_update_account(db, acct, ev1, tags, 0, peer_id); acct2 = find_account(ctx, db, "wallet"); accountseq(acct, acct2); @@ -1366,8 +1366,8 @@ static bool test_account_crud(const tal_t *ctx, struct plugin *p) /* channel_open -> open event db updated */ CHECK(!acct->leased); CHECK(acct->open_event_db_id == NULL); - tags[0] = CHANNEL_OPEN; - tags[1] = LEASED; + tags[0] = MVT_CHANNEL_OPEN; + tags[1] = MVT_LEASED; maybe_update_account(db, acct, ev1, tags, 2, peer_id); acct2 = find_account(ctx, db, "wallet"); accountseq(acct, acct2); @@ -1375,8 +1375,8 @@ static bool test_account_crud(const tal_t *ctx, struct plugin *p) CHECK(acct->open_event_db_id != NULL); CHECK(acct->closed_count == 2); - tags[0] = CHANNEL_CLOSE; - tags[1] = OPENER; + tags[0] = MVT_CHANNEL_CLOSE; + tags[1] = MVT_OPENER; CHECK(acct->closed_event_db_id == NULL); CHECK(!acct->we_opened); maybe_update_account(db, acct, ev1, tags, 0, NULL); diff --git a/wallet/wallet.c b/wallet/wallet.c index e8533616f..6b2b0564d 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -3130,7 +3130,7 @@ type_ok: mvt = new_coin_wallet_deposit(tmpctx, &utxo->outpoint, *blockheight, utxo->amount, - DEPOSIT); + MVT_DEPOSIT); notify_chain_mvt(w->ld, mvt); } diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index 726361937..dc559ca56 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -946,7 +946,7 @@ static void maybe_notify_new_external_send(struct lightningd *ld, mvt = new_coin_external_deposit(NULL, &outpoint, 0, amount, - DEPOSIT); + MVT_DEPOSIT); mvt->originating_acct = new_mvt_account_id(mvt, NULL, WALLET);