| 337 | }; |
| 338 | |
| 339 | static 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 | |
| 371 | void bitcoind_sendrawtx_(const tal_t *ctx, |
| 372 | struct bitcoind *bitcoind, |
nothing calls this directly
no test coverage detected