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

Function json_add_sendpay_result

plugins/pay.c:107–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107static void json_add_sendpay_result(struct json_stream *s, const struct payment_result *r)
108{
109 if (r->code != 0) {
110 /* This is a failure */
111 json_add_string(s, "message", r->message);
112 json_add_u32(s, "code", r->code);
113
114 json_object_start(s, "data");
115 json_add_u32(s, "id", r->id);
116 json_add_hex(s, "raw_message", r->raw_message, tal_bytelen(r->raw_message));
117 json_add_num(s, "failcode", r->failcode);
118 json_add_string(s, "failcodename", r->failcodename);
119
120 if (r->erring_index)
121 json_add_num(s, "erring_index", *r->erring_index);
122
123 if (r->erring_node)
124 json_add_node_id(s, "erring_node", r->erring_node);
125
126 if (r->erring_channel)
127 json_add_short_channel_id(s, "erring_channel",
128 r->erring_channel);
129
130 if (r->erring_direction)
131 json_add_num(s, "erring_direction",
132 *r->erring_direction);
133
134 json_object_end(s);
135 } else {
136 /* This is a success */
137 json_add_u32(s, "id", r->id);
138 json_add_preimage(s, "payment_preimage", r->payment_preimage);
139 }
140
141}
142
143static void paystatus_add_payment(struct json_stream *s, const struct payment *p)
144{

Callers 1

paystatus_add_paymentFunction · 0.85

Calls 10

json_add_hexFunction · 0.85
tal_bytelenFunction · 0.85
json_add_stringFunction · 0.50
json_add_u32Function · 0.50
json_object_startFunction · 0.50
json_add_numFunction · 0.50
json_add_node_idFunction · 0.50
json_object_endFunction · 0.50
json_add_preimageFunction · 0.50

Tested by

no test coverage detected