common/coin_mvt: make it clear we're using Lightning HRP not BIP 173.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-12-29 10:39:58 +10:30
parent 425a7af512
commit ae4669f77f
3 changed files with 10 additions and 8 deletions

View file

@ -320,14 +320,14 @@ struct channel_coin_mvt *new_coin_channel_push(const tal_t *ctx,
struct coin_mvt *finalize_chain_mvt(const tal_t *ctx,
const struct chain_coin_mvt *chain_mvt,
const char *bip173_name TAKES,
const char *hrp_name TAKES,
u32 timestamp,
struct node_id *node_id)
{
struct coin_mvt *mvt = tal(ctx, struct coin_mvt);
mvt->account_id = tal_strdup(mvt, chain_mvt->account_name);
mvt->bip173_name = tal_strdup(mvt, bip173_name);
mvt->hrp_name = tal_strdup(mvt, hrp_name);
mvt->type = CHAIN_MVT;
mvt->id.tx_txid = chain_mvt->tx_txid;
@ -351,7 +351,7 @@ struct coin_mvt *finalize_chain_mvt(const tal_t *ctx,
struct coin_mvt *finalize_channel_mvt(const tal_t *ctx,
const struct channel_coin_mvt *chan_mvt,
const char *bip173_name TAKES,
const char *hrp_name TAKES,
u32 timestamp,
const struct node_id *node_id TAKES)
{
@ -359,7 +359,7 @@ struct coin_mvt *finalize_channel_mvt(const tal_t *ctx,
mvt->account_id = type_to_string(mvt, struct channel_id,
&chan_mvt->chan_id);
mvt->bip173_name = tal_strdup(mvt, bip173_name);
mvt->hrp_name = tal_strdup(mvt, hrp_name);
mvt->type = CHANNEL_MVT;
mvt->id.payment_hash = chan_mvt->payment_hash;
mvt->id.part_id = chan_mvt->part_id;

View file

@ -96,7 +96,9 @@ struct mvt_id {
struct coin_mvt {
/* name of 'account': wallet, external, <channel_id> */
const char *account_id;
const char *bip173_name;
/* Chain name: BIP 173, except signet lightning-style: tbs not tb */
const char *hrp_name;
/* type of movement: channel or chain */
enum mvt_type type;
@ -235,14 +237,14 @@ struct channel_coin_mvt *new_coin_channel_push(const tal_t *ctx,
struct coin_mvt *finalize_chain_mvt(const tal_t *ctx,
const struct chain_coin_mvt *chain_mvt,
const char *bip173_name,
const char *hrp_name,
u32 timestamp,
struct node_id *node_id)
NON_NULL_ARGS(2, 3);
struct coin_mvt *finalize_channel_mvt(const tal_t *ctx,
const struct channel_coin_mvt *chan_mvt,
const char *bip173_name,
const char *hrp_name,
u32 timestamp,
const struct node_id *node_id)
NON_NULL_ARGS(2, 3, 5);

View file

@ -495,7 +495,7 @@ static void coin_movement_notification_serialize(struct json_stream *stream,
json_add_null(stream, "blockheight");
}
json_add_u32(stream, "timestamp", mvt->timestamp);
json_add_string(stream, "coin_type", mvt->bip173_name);
json_add_string(stream, "coin_type", mvt->hrp_name);
json_object_end(stream);
}