MCPcopy Create free account
hub / github.com/ElementsProject/lightning / add_to_debug_log

Function add_to_debug_log

plugins/spender/splice.c:46–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46static void add_to_debug_log(struct splice_cmd *scmd, const char *phase)
47{
48 char **log = &scmd->debug_log;
49 if (!*log)
50 return;
51
52 tal_append_fmt(log, "#%d: (%s)\n", ++scmd->debug_counter, phase);
53
54 for (size_t i = 0; i < tal_count(scmd->actions); i++) {
55 struct splice_script_result *action = scmd->actions[i];
56 struct splice_cmd_action_state *state = scmd->states[i];
57 bool simulate_wallet_amount = false;
58 bool hide_fee = false;
59
60 if (action->onchain_wallet && action->pays_fee) {
61 if (amount_sat_is_zero(action->out_sat)) {
62 simulate_wallet_amount = true;
63 action->out_sat = scmd->needed_funds;
64 } else {
65 hide_fee = true;
66 action->pays_fee = false;
67 }
68 }
69
70 tal_append_fmt(log, "[%s] %s\n",
71 cmd_state_string(state->state),
72 splice_to_string(tmpctx, action));
73
74 if (simulate_wallet_amount)
75 action->out_sat = AMOUNT_SAT(0);
76
77 if (hide_fee)
78 action->pays_fee = true;
79 }
80}
81
82static void debug_log_to_json(struct json_stream *response,
83 const char *debug_log)

Callers 3

calc_in_ppm_and_feeFunction · 0.85
continue_spliceFunction · 0.85
execute_spliceFunction · 0.85

Calls 4

tal_append_fmtFunction · 0.85
amount_sat_is_zeroFunction · 0.85
cmd_state_stringFunction · 0.85
splice_to_stringFunction · 0.85

Tested by

no test coverage detected