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

Function sendrawtx_callback

lightningd/bitcoind.c:339–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337};
338
339static void sendrawtx_callback(const char *buf, const jsmntok_t *toks,
340 const jsmntok_t *idtok,
341 struct sendrawtx_call *call)
342{
343 const jsmntok_t *resulttok;
344 const char *err;
345 const char *errmsg = NULL;
346 bool success = false;
347
348 resulttok = get_bitcoin_result(call->bitcoind, buf, toks, "sendrawtransaction");
349
350 err = json_scan(tmpctx, buf, resulttok, "{success:%}",
351 JSON_SCAN(json_to_bool, &success));
352 if (err) {
353 bitcoin_plugin_error(call->bitcoind, buf, resulttok,
354 "sendrawtransaction",
355 "bad 'result' field: %s", err);
356 } else if (!success) {
357 err = json_scan(tmpctx, buf, resulttok, "{errmsg:%}",
358 JSON_SCAN_TAL(tmpctx, json_strdup, &errmsg));
359 if (err)
360 bitcoin_plugin_error(call->bitcoind, buf, resulttok,
361 "sendrawtransaction",
362 "bad 'errmsg' field: %s",
363 err);
364 }
365
366 /* In case they don't free it, we will. */
367 tal_steal(tmpctx, call);
368 call->cb(call->bitcoind, success, errmsg, call->cb_arg);
369}
370
371void bitcoind_sendrawtx_(const tal_t *ctx,
372 struct bitcoind *bitcoind,

Callers

nothing calls this directly

Calls 3

get_bitcoin_resultFunction · 0.85
bitcoin_plugin_errorFunction · 0.85
json_scanFunction · 0.50

Tested by

no test coverage detected