@@ -316,7 +316,8 @@ static struct command_result *json_inspect(struct command *cmd,
316316 ev -> output_value );
317317 json_add_amount_msat (res , "credit_msat" ,
318318 ev -> credit );
319- json_add_string (res , "currency" , ev -> currency );
319+ json_add_string (res , "currency" ,
320+ chainparams -> lightning_hrp );
320321 if (ev -> origin_acct )
321322 json_add_string (res , "originating_account" ,
322323 ev -> origin_acct );
@@ -333,7 +334,7 @@ static struct command_result *json_inspect(struct command *cmd,
333334 "output_value_msat" ,
334335 ev -> output_value );
335336 json_add_string (res , "currency" ,
336- ev -> currency );
337+ chainparams -> lightning_hrp );
337338 }
338339 json_add_string (res , "spend_tag" , ev -> tag );
339340 json_add_txid (res , "spending_txid" ,
@@ -628,7 +629,6 @@ struct new_account_info {
628629 struct account * acct ;
629630 struct amount_msat curr_bal ;
630631 u32 timestamp ;
631- char * currency ;
632632};
633633
634634static void try_update_open_fees (struct command * cmd ,
@@ -709,7 +709,6 @@ static bool new_missed_channel_account(struct command *cmd,
709709 const char * buf ,
710710 const jsmntok_t * result ,
711711 struct account * acct ,
712- const char * currency ,
713712 u64 timestamp )
714713{
715714 struct chain_event * chain_ev ;
@@ -762,7 +761,6 @@ static bool new_missed_channel_account(struct command *cmd,
762761 ok = amount_msat_add (& chain_ev -> output_value ,
763762 amt , remote_amt );
764763 assert (ok );
765- chain_ev -> currency = tal_strdup (chain_ev , currency );
766764 chain_ev -> origin_acct = NULL ;
767765 /* 2s before the channel opened, minimum */
768766 chain_ev -> timestamp = timestamp - 2 ;
@@ -821,7 +819,6 @@ static bool new_missed_channel_account(struct command *cmd,
821819 push_credit ,
822820 push_debit ,
823821 AMOUNT_MSAT (0 ),
824- currency ,
825822 NULL , 0 ,
826823 timestamp - 1 );
827824 log_channel_event (db , acct , chan_ev );
@@ -905,7 +902,6 @@ static char *msat_find_diff(struct amount_msat balance,
905902}
906903
907904static void log_journal_entry (struct account * acct ,
908- const char * currency ,
909905 u64 timestamp ,
910906 struct amount_msat credit_diff ,
911907 struct amount_msat debit_diff )
@@ -923,7 +919,6 @@ static void log_journal_entry(struct account *acct,
923919 credit_diff ,
924920 debit_diff ,
925921 AMOUNT_MSAT (0 ),
926- currency ,
927922 NULL , 0 ,
928923 timestamp );
929924 db_begin_transaction (db );
@@ -959,7 +954,6 @@ static struct command_result *listpeerchannels_multi_done(struct command *cmd,
959954
960955 if (!new_missed_channel_account (cmd , buf , result ,
961956 info -> acct ,
962- info -> currency ,
963957 info -> timestamp )) {
964958 plugin_log (cmd -> plugin , LOG_BROKEN ,
965959 "Unable to find account %s in listpeerchannels" ,
@@ -981,7 +975,6 @@ static struct command_result *listpeerchannels_multi_done(struct command *cmd,
981975 plugin_err (cmd -> plugin , "%s" , err );
982976
983977 log_journal_entry (info -> acct ,
984- info -> currency ,
985978 info -> timestamp - 1 ,
986979 credit_diff , debit_diff );
987980 }
@@ -1068,17 +1061,14 @@ static struct command_result *json_balance_snapshot(struct command *cmd,
10681061 json_for_each_arr (i , acct_tok , accounts_tok ) {
10691062 struct account * acct ;
10701063 struct amount_msat snap_balance , credit , debit , credit_diff , debit_diff ;
1071- char * acct_name , * currency ;
1064+ char * acct_name ;
10721065 bool existed ;
10731066
10741067 err = json_scan (cmd , buf , acct_tok ,
10751068 "{account_id:%"
1076- ",balance_msat:%"
1077- ",coin_type:%}" ,
1069+ ",balance_msat:%}" ,
10781070 JSON_SCAN_TAL (tmpctx , json_strdup , & acct_name ),
1079- JSON_SCAN (json_to_msat , & snap_balance ),
1080- JSON_SCAN_TAL (tmpctx , json_strdup ,
1081- & currency ));
1071+ JSON_SCAN (json_to_msat , & snap_balance ));
10821072 if (err )
10831073 plugin_err (cmd -> plugin ,
10841074 "`balance_snapshot` payload did not"
@@ -1129,8 +1119,6 @@ static struct command_result *json_balance_snapshot(struct command *cmd,
11291119 info -> acct = tal_steal (info , acct );
11301120 info -> curr_bal = snap_balance ;
11311121 info -> timestamp = timestamp_now ;
1132- info -> currency =
1133- tal_strdup (info , currency );
11341122
11351123 tal_arr_expand (& new_accts , info );
11361124 continue ;
@@ -1155,7 +1143,6 @@ static struct command_result *json_balance_snapshot(struct command *cmd,
11551143 credit_diff ,
11561144 debit_diff ,
11571145 AMOUNT_MSAT (0 ),
1158- currency ,
11591146 NULL , 0 ,
11601147 timestamp );
11611148
@@ -1372,7 +1359,6 @@ listpeerchannels_done(struct command *cmd,
13721359
13731360 if (new_missed_channel_account (cmd , buf , result ,
13741361 info -> acct ,
1375- info -> ev -> currency ,
13761362 info -> ev -> timestamp )) {
13771363 db_begin_transaction (db );
13781364 account_get_credit_debit (cmd -> plugin , db , info -> acct -> name ,
@@ -1389,7 +1375,6 @@ listpeerchannels_done(struct command *cmd,
13891375 plugin_err (cmd -> plugin , "%s" , err );
13901376
13911377 log_journal_entry (info -> acct ,
1392- info -> ev -> currency ,
13931378 info -> ev -> timestamp - 1 ,
13941379 credit_diff , debit_diff );
13951380 } else
@@ -1509,7 +1494,6 @@ parse_and_log_chain_move(struct command *cmd,
15091494
15101495 e -> credit = credit ;
15111496 e -> debit = debit ;
1512- e -> currency = tal_steal (e , coin_type );
15131497 e -> timestamp = timestamp ;
15141498 e -> tag = mvt_tag_str (tags [0 ]);
15151499 e -> desc = tal_steal (e , desc );
@@ -1671,7 +1655,6 @@ parse_and_log_channel_move(struct command *cmd,
16711655
16721656 e -> credit = credit ;
16731657 e -> debit = debit ;
1674- e -> currency = tal_steal (e , coin_type );
16751658 e -> timestamp = timestamp ;
16761659 e -> tag = mvt_tag_str (tags [0 ]);
16771660 e -> desc = tal_steal (e , desc );
@@ -1747,15 +1730,13 @@ static struct command_result *json_utxo_deposit(struct command *cmd, const char
17471730 ",transfer_from:%"
17481731 ",outpoint:%"
17491732 ",amount_msat:%"
1750- ",coin_type:%"
17511733 ",timestamp:%"
17521734 ",blockheight:%"
17531735 "}}}" ,
17541736 JSON_SCAN_TAL (tmpctx , json_strdup , & ev -> acct_name ),
17551737 JSON_SCAN_TAL (tmpctx , json_strdup , & ev -> origin_acct ),
17561738 JSON_SCAN (json_to_outpoint , & ev -> outpoint ),
17571739 JSON_SCAN (json_to_msat , & ev -> credit ),
1758- JSON_SCAN_TAL (tmpctx , json_strdup , & ev -> currency ),
17591740 JSON_SCAN (json_to_u64 , & ev -> timestamp ),
17601741 JSON_SCAN (json_to_u32 , & ev -> blockheight ));
17611742
@@ -1824,15 +1805,13 @@ static struct command_result *json_utxo_spend(struct command *cmd, const char *b
18241805 ",outpoint:%"
18251806 ",spending_txid:%"
18261807 ",amount_msat:%"
1827- ",coin_type:%"
18281808 ",timestamp:%"
18291809 ",blockheight:%"
18301810 "}}}" ,
18311811 JSON_SCAN_TAL (tmpctx , json_strdup , & acct_name ),
18321812 JSON_SCAN (json_to_outpoint , & ev -> outpoint ),
18331813 JSON_SCAN (json_to_txid , ev -> spending_txid ),
18341814 JSON_SCAN (json_to_msat , & ev -> debit ),
1835- JSON_SCAN_TAL (tmpctx , json_strdup , & ev -> currency ),
18361815 JSON_SCAN (json_to_u64 , & ev -> timestamp ),
18371816 JSON_SCAN (json_to_u32 , & ev -> blockheight ));
18381817
0 commit comments