From 5570c6da089c487f3e398eb5351afff42bd692e8 Mon Sep 17 00:00:00 2001 From: niftynei Date: Wed, 8 Dec 2021 12:37:35 -0600 Subject: [PATCH] coin_moves: cleanup tags list, update docs, remove unused method We don't use journal_entry any more; remove it and update all of the remaining tags (plus docs) --- common/coin_mvt.c | 17 ---------------- common/coin_mvt.h | 51 +++++++++++++++++++---------------------------- doc/PLUGINS.md | 37 +++++++++++++++++++++++----------- 3 files changed, 45 insertions(+), 60 deletions(-) diff --git a/common/coin_mvt.c b/common/coin_mvt.c index 37ae80093..8292991f6 100644 --- a/common/coin_mvt.c +++ b/common/coin_mvt.c @@ -19,14 +19,10 @@ const char *mvt_type_str(enum mvt_type type) static const char *mvt_tags[] = { "deposit", "withdrawal", - NULL, "penalty", "invoice", "routed", - "journal_entry", - NULL, "pushed", - NULL, "channel_open", "channel_close", "delayed_to_us", @@ -178,19 +174,6 @@ struct chain_coin_mvt *new_onchaind_deposit(const tal_t *ctx, amount, true); } -struct chain_coin_mvt *new_coin_journal_entry(const tal_t *ctx, - const struct bitcoin_txid *txid, - const struct bitcoin_outpoint *outpoint, - u32 blockheight, - struct amount_msat amount, - bool is_credit) -{ - return new_chain_coin_mvt(ctx, NULL, txid, - outpoint, NULL, - blockheight, new_tag_arr(ctx, JOURNAL), - amount, is_credit, AMOUNT_SAT(0)); -} - struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx, const struct bitcoin_txid *txid, const struct bitcoin_outpoint *out, diff --git a/common/coin_mvt.h b/common/coin_mvt.h index bac404974..026aead82 100644 --- a/common/coin_mvt.h +++ b/common/coin_mvt.h @@ -16,30 +16,26 @@ enum mvt_type { enum mvt_tag { DEPOSIT = 0, WITHDRAWAL = 1, - /* 2, CHAIN_FEES has been removed */ - PENALTY = 3, - INVOICE = 4, - ROUTED = 5, - JOURNAL = 6, - /* 7, ONCHAIN_HTLC has been removed */ - PUSHED = 8, - /* 9, SPEND_TRACK has been removed */ - CHANNEL_OPEN = 10, - CHANNEL_CLOSE = 11, - CHANNEL_TO_US = 12, - HTLC_TIMEOUT = 13, - HTLC_FULFILL = 14, - HTLC_TX = 15, - TO_WALLET = 16, - IGNORED = 17, - ANCHOR = 18, - TO_THEM = 19, - PENALIZED = 20, - STOLEN = 21, - TO_MINER = 22, - OPENER = 23, - LEASE_FEE = 24, - LEASED = 25, + 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, + IGNORED = 13, + ANCHOR = 14, + TO_THEM = 15, + PENALIZED = 16, + STOLEN = 17, + TO_MINER = 18, + OPENER = 19, + LEASE_FEE = 20, + LEASED = 21, }; struct channel_coin_mvt { @@ -156,13 +152,6 @@ struct chain_coin_mvt *new_onchaind_deposit(const tal_t *ctx, struct amount_sat amount, enum mvt_tag tag); -struct chain_coin_mvt *new_coin_journal_entry(const tal_t *ctx, - const struct bitcoin_txid *txid, - const struct bitcoin_outpoint *outpoint, - u32 blockheight, - struct amount_msat amount, - bool is_credit); - struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx, const struct bitcoin_txid *txid, const struct bitcoin_outpoint *out, diff --git a/doc/PLUGINS.md b/doc/PLUGINS.md index 76ae30f9e..1bc0b1711 100644 --- a/doc/PLUGINS.md +++ b/doc/PLUGINS.md @@ -701,15 +701,15 @@ i.e. only definitively resolved HTLCs or confirmed bitcoin transactions. "node_id":"03a7103a2322b811f7369cbb27fb213d30bbc0b012082fed3cad7e4498da2dc56b", "type":"chain_mvt", "account_id":"wallet", - "txid":"0159693d8f3876b4def468b208712c630309381e9d106a9836fa0a9571a28722", // (`chain_mvt` type only, mandatory) - "utxo_txid":"0159693d8f3876b4def468b208712c630309381e9d106a9836fa0a9571a28722", // (`chain_mvt` type only, optional) - "vout":1, // (`chain_mvt` type only, optional) + "txid":"0159693d8f3876b4def468b208712c630309381e9d106a9836fa0a9571a28722", // (`chain_mvt` only, optional) + "utxo_txid":"0159693d8f3876b4def468b208712c630309381e9d106a9836fa0a9571a28722", // (`chain_mvt` only) + "vout":1, // (`chain_mvt` only) "payment_hash": "xxx", // (either type, optional on `chain_mvt`) - "part_id": 0, // (`channel_mvt` type only, mandatory) + "part_id": 0, // (`channel_mvt` only, mandatory) "credit":"2000000000msat", "debit":"0msat", "output_value": "2000000000msat", // ('chain_mvt' only) - "fees": "382msat", // ('channel_mvt' only, optional) + "fees": "382msat", // ('channel_mvt' only) "tags": ["deposit"], "blockheight":102, // (May be null) "timestamp":1585948198, @@ -763,13 +763,26 @@ both the debit/credit contain fees. Technically routed debits are the `tag` is a movement descriptor. Current tags are as follows: - `deposit`: funds deposited - `withdrawal`: funds withdrawn - - `penalty`: funds paid or gained from a penalty tx. `chain_mvt` only - - `invoice`: funds paid to or recieved from an invoice. `channel_mvt` only - - `routed`: funds routed through this node. `channel_mvt` only - - `journal_entry`: a balance reconciliation event, typically triggered - by a penalty tx onchain. `chain_mvt` only - - `onchain_htlc`: funds moved via an htlc onchain. `chain_mvt` only - - `pushed`: funds pushed to peer. `channel_mvt` only. + - `penalty`: funds paid or gained from a penalty tx. + - `invoice`: funds paid to or recieved from an invoice. + - `routed`: funds routed through this node. + - `pushed`: funds pushed to peer. + - channel_open : channel is opened, initial channel balance + - channel_close: channel is closed, final channel balance + - delayed_to_us : on-chain output to us, spent back into our wallet + - htlc_timeout : on-chain htlc timeout output + - htlc_fulfill : on-chian htlc fulfill output + - htlc_tx : on-chain htlc tx has happened + - to_wallet : output being spent into our wallet + - ignored : output is being ignored + - anchor : an anchor output + - to_them : output intended to peer's wallet + - penalized : output we've 'lost' due to a penalty (failed cheat attempt) + - stolen : output we've 'lost' due to peer's cheat + - to_miner : output we've burned to miner (OP_RETURN) + - opener : tags channel_open, we are the channel opener + - lease_fee: amount paid as lease fee + - leased: tags channel_open, channel contains leased funds `blockheight` is the block the txid is included in.