mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-04 11:08:03 +01:00
coin_mvt: only chain moves have a blockheight
channel moves don't have blockheights
This commit is contained in:
parent
7add7ca199
commit
b33868f7c2
4 changed files with 5 additions and 13 deletions
|
@ -376,8 +376,6 @@ struct coin_mvt *finalize_channel_mvt(const tal_t *ctx,
|
||||||
mvt->fees = tal(mvt, struct amount_msat);
|
mvt->fees = tal(mvt, struct amount_msat);
|
||||||
*mvt->fees = chan_mvt->fees;
|
*mvt->fees = chan_mvt->fees;
|
||||||
mvt->timestamp = timestamp;
|
mvt->timestamp = timestamp;
|
||||||
/* channel movements don't have a blockheight */
|
|
||||||
mvt->blockheight = 0;
|
|
||||||
mvt->version = COIN_MVT_VERSION;
|
mvt->version = COIN_MVT_VERSION;
|
||||||
mvt->node_id = tal_dup(mvt, struct node_id, node_id);
|
mvt->node_id = tal_dup(mvt, struct node_id, node_id);
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,7 @@ struct chain_coin_mvt {
|
||||||
/* label / tag array */
|
/* label / tag array */
|
||||||
enum mvt_tag *tags;
|
enum mvt_tag *tags;
|
||||||
|
|
||||||
/* block this transaction is confirmed in
|
/* block this transaction is confirmed in */
|
||||||
* zero means it's unknown/unconfirmed */
|
|
||||||
u32 blockheight;
|
u32 blockheight;
|
||||||
|
|
||||||
/* only one or the other */
|
/* only one or the other */
|
||||||
|
|
|
@ -713,7 +713,7 @@ i.e. only definitively resolved HTLCs or confirmed bitcoin transactions.
|
||||||
"output_count": 2, // ('chain_mvt' only, typically only channel closes)
|
"output_count": 2, // ('chain_mvt' only, typically only channel closes)
|
||||||
"fees": "382msat", // ('channel_mvt' only)
|
"fees": "382msat", // ('channel_mvt' only)
|
||||||
"tags": ["deposit"],
|
"tags": ["deposit"],
|
||||||
"blockheight":102, // (May be null)
|
"blockheight":102, // 'chain_mvt' only
|
||||||
"timestamp":1585948198,
|
"timestamp":1585948198,
|
||||||
"coin_type":"bc"
|
"coin_type":"bc"
|
||||||
}
|
}
|
||||||
|
|
|
@ -493,14 +493,9 @@ static void coin_movement_notification_serialize(struct json_stream *stream,
|
||||||
json_add_string(stream, NULL, mvt_tag_str(mvt->tags[i]));
|
json_add_string(stream, NULL, mvt_tag_str(mvt->tags[i]));
|
||||||
json_array_end(stream);
|
json_array_end(stream);
|
||||||
|
|
||||||
/* Only chain movements have blockheights. A blockheight
|
if (mvt->type == CHAIN_MVT)
|
||||||
* of 'zero' means we haven't seen this tx confirmed yet. */
|
|
||||||
if (mvt->type == CHAIN_MVT) {
|
|
||||||
if (mvt->blockheight)
|
|
||||||
json_add_u32(stream, "blockheight", mvt->blockheight);
|
json_add_u32(stream, "blockheight", mvt->blockheight);
|
||||||
else
|
|
||||||
json_add_null(stream, "blockheight");
|
|
||||||
}
|
|
||||||
json_add_u32(stream, "timestamp", mvt->timestamp);
|
json_add_u32(stream, "timestamp", mvt->timestamp);
|
||||||
json_add_string(stream, "coin_type", mvt->hrp_name);
|
json_add_string(stream, "coin_type", mvt->hrp_name);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue