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

Function get_bitcoin_result

lightningd/bitcoind.c:116–142  ·  view source on GitHub ↗

Check response for error (fatal if found) and return result token (fatal if not found). */

Source from the content-addressed store, hash-verified

114
115/* Check response for error (fatal if found) and return result token (fatal if not found). */
116static const jsmntok_t *get_bitcoin_result(struct bitcoind *bitcoind,
117 const char *buf,
118 const jsmntok_t *toks,
119 const char *method)
120{
121 const jsmntok_t *err_tok, *msg_tok, *result_tok;
122
123 err_tok = json_get_member(buf, toks, "error");
124 if (err_tok) {
125 msg_tok = json_get_member(buf, err_tok, "message");
126 if (msg_tok)
127 bitcoin_plugin_error(bitcoind, buf, toks, method,
128 "%.*s", json_tok_full_len(msg_tok),
129 json_tok_full(buf, msg_tok));
130 else
131 bitcoin_plugin_error(bitcoind, buf, toks, method,
132 "%.*s", json_tok_full_len(err_tok),
133 json_tok_full(buf, err_tok));
134 }
135
136 result_tok = json_get_member(buf, toks, "result");
137 if (!result_tok)
138 bitcoin_plugin_error(bitcoind, buf, toks, method,
139 "missing 'result' field");
140
141 return result_tok;
142}
143
144/* Send a request to the Bitcoin plugin which registered that method,
145 * if it's still alive. */

Callers 5

estimatefees_callbackFunction · 0.85
sendrawtx_callbackFunction · 0.85
getchaininfo_callbackFunction · 0.85
getutxout_callbackFunction · 0.85

Calls 4

json_get_memberFunction · 0.85
bitcoin_plugin_errorFunction · 0.85
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50

Tested by

no test coverage detected