| 355 | }; |
| 356 | |
| 357 | static void sendrawtx_callback(const char *buf, const jsmntok_t *toks, |
| 358 | const jsmntok_t *idtok, |
| 359 | struct sendrawtx_call *call) |
| 360 | { |
| 361 | const jsmntok_t *resulttok; |
| 362 | const char *err; |
| 363 | const char *errmsg = NULL; |
| 364 | bool success = false; |
| 365 | |
| 366 | resulttok = get_bitcoin_result(call->bitcoind, buf, toks, "sendrawtransaction"); |
| 367 | |
| 368 | err = json_scan(tmpctx, buf, resulttok, "{success:%}", |
| 369 | JSON_SCAN(json_to_bool, &success)); |
| 370 | if (err) { |
| 371 | bitcoin_plugin_error(call->bitcoind, buf, resulttok, |
| 372 | "sendrawtransaction", |
| 373 | "bad 'result' field: %s", err); |
| 374 | } else if (!success) { |
| 375 | err = json_scan(tmpctx, buf, resulttok, "{errmsg:%}", |
| 376 | JSON_SCAN_TAL(tmpctx, json_strdup, &errmsg)); |
| 377 | if (err) |
| 378 | bitcoin_plugin_error(call->bitcoind, buf, resulttok, |
| 379 | "sendrawtransaction", |
| 380 | "bad 'errmsg' field: %s", |
| 381 | err); |
| 382 | } |
| 383 | |
| 384 | /* In case they don't free it, we will. */ |
| 385 | tal_steal(tmpctx, call); |
| 386 | call->cb(call->bitcoind, success, errmsg, call->cb_arg); |
| 387 | } |
| 388 | |
| 389 | void bitcoind_sendrawtx_(const tal_t *ctx, |
| 390 | struct bitcoind *bitcoind, |
nothing calls this directly
no test coverage detected