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

Function json_add_sendpay_result

plugins/pay.c:99–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

paystatus_add_paymentFunction · 0.85

Calls 10

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

Tested by

no test coverage detected